Sunday, August 21, 2011

How to stream audio from mog.com on Ubuntu laptop to remote linux box

The problem: I recently got a linux set-top box that I have connected to my stereo in my living room. I use the internet music service mog.com and I'd like to be able to play it on my stereo and control it from my linux laptop.

I've tried lots of approaches that didn't work, like using vnc/nx/etc and setting up pulseaudio with module-tunnel-sink.

The way that seems to work the best for me is to first, setup pulseaudio on the settop box to install the module-native-protocol-tcp by adding the following line to /etc/pulse/default.pa:

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/16

and restart pulseaudio with:

pulseaudio --kill ; pulseaudio --start

This tells pulseaudio to accept network connections from other machines on the local network.

Then, on my laptop, I run google-chrome as follows:

PULSE_SERVER=tcp:[settop box hostname] google-chrome --user-data-dir=/home/redstone/tmp/chrome-mog --app=http://mog.com

This starts a separate chrome session that will stream audio to the settop box. Note: you are free to simultaneously start google-chrome without the flags and start a google chrome sessions that will use your local laptops speakers as well. The reason for the user-data flags is that you can only specify the pulse server to use when chrome starts a new session, and if you don't start chrome with the user-data flags, it will just open a new window in your existing chrome session rather than start a new one.

You may want to run:
PULSE_SERVER=tcp:[settop box hostname] pavucontrol
to fiddle with the audio settings on the settop box.

I suspect that this approach should work with any other internet music streaming service like spotify/pandora/etc.

Saturday, August 20, 2011

Back and internal pictures of Niles Audio PS-1 Phono/Aux A-B Switcher

For those of you who are considering buying a Niles Audio PS-1 and are wondering what it looks like on the back and inside, I took a few pics. Here they are:







Subscribing to a twitter feed in Google reader

Google reader is a bit picky about the types of feed URLs you can paste into it to subscribe to feeds. I found that the following works:

http://api.twitter.com/1/statuses/user_timeline/[username].atom

where you substitute [username] for the actual usename. For example, to subscribe in google reader to Facebook's twitter feed (http://twitter.com/#!/facebook) you click on 'Add a subscription' in reader.google.com and paste in:

http://api.twitter.com/1/statuses/user_timeline/facebook.atom

There is more documentation on this API at https://dev.twitter.com/docs/api/1/get/statuses/user_timeline. It's listed at the bottom in the 'Extended description' section with the words 'not recommended' :). The 'recommended' API, using URL parameters, doesn't work in google reader. Further note: I initially tried getting RSS feed format to work and didn't have any luck.

Plotting the ratio of two stocks

I found a website, stockcharts.com, that let's you plot the ratio of two stocks. In the 'symbol' field, you specify the two stocks separated by a ':'. For example, "goog:$SPX" to plot the ratio of Google and the S&P 500. As a side note, there is a link partway down, 'linkable version' that let's you bookmark the chart. A recent one I was interested in:

GOOG versus S&P 500 over the past year

Monday, March 7, 2011

Hot-water shower in my car for after surfing

One of the pain points to surfing in the winter is showering off in the ice-cold showers that are common in beach parking lots. So I built a hot-water shower contraption that I can load in the trunk of my car to provide a hot shower after surfing.



Basically, I bought a 12V water pump and attached it to a cigarette lighter power plug. I use the pump to pump water from a 5 gallon storage tank to a hand-held shower head. The idea is that I fill the tank with hot water from my bathtub before I head out surfing, I put the tank and pump in my car trunk, and, after I'm done surfing, I plug in the pump and shower off with the water from the tank. By the time I'm done surfing, the water should have cooled to a pleasant temperature.

I've tested the electrical work and full system test to come soon!
Here's a pic of the work area while I was putting it together:



Update 3/12/2011:
Surf shower v1.5. The water system test was a success! The pump has quick-connect plugs to which you attach the hoses. Mechanically, they are rather fragile. To protect the quick connects, I've mounted the pump inside a rubbermaid tub and used electric conduit clamps padded with a bit of neoprene to guide the hoses so that the hoses can flex and move around without straining the connectors. I also mounted a lighted power switch on the other side of the tub. I used a copy of the disappointing 'The World is Flat' book as a backstop for the drill and cutting board for the neoprene.




Update 7/12/2011:
I've been using the shower regularly after surfing and it works wonderfully. The 5-gallon tank has turned out to be a good size. Most full-flow shower heads flow at a rate of 2 to 2.5 gallons-per-minute. So a 5-gallon tank (which weighs 40 pounds, when full) will last a bit over 2 minutes of continuous usage. I find that by turning off the water switch on the shower head while I soap, I end up using about 3 to 4 gallons of water, and usually have plenty left over at the end.

Here's the final setup:



The water flows out of the resevoir, through the strainer (the black circular device attached to the tube), to the pump, then from the pump to the hand-held shower head. There is a lighted rocker switch mounted on the right side of the tub.