Friday, October 24, 2008

Plotting with one-line bash scripts

Problem: every now and then i want to make a quick plot with numbers extracted with awk or something similar. gnuplot is great, but sucks for non-interactive use. perldl is easily scripted, but overkill for this. my specific need was to make quick-n-dirty histograms of a column of numbers.

Solution: the gsl package has a 'gsl-histogram' task while the plotutils package has 'graph'. this combination was exactly what i was looking for. here's an example one-liner:

cat *.output | awk '{print $9}' | gsl-histogram 0 2.5 25 | awk '{print $1, $3 ; print $2, $3}' | graph -T X

this plots up a histogram with 25 bins between 0 and 2.5 using the X-windows driver. refer to the plotutils documentation for other driver types and output options.

Wednesday, October 8, 2008

Using mac laptop to host remote speakers in lieu of an airport express

Problem: we currently use my old 12" powerbook G4 as the living room itunes server. it hosts my entire collection and is hooked up to my marantz receiver which powers the speakers that are installed around the house. this is fine and dandy as far as it goes, but has a few drawbacks. the main one is because my iphone can only sync with one computer, i have to sync it with my macbook to keep up with contacts, calendar, mail, etc. this means that i need to keep a separate copy of some of my music on the macbook.

what i want to do is replace my linux desktop with a mac mini and make that the primary mac data/music/media hub. however, it will be in the office rather in the living room. what i would like to do is keep the powerbook where it is and use it as an airtunes client much like an airport express. i know that i could run itunes and access my library over the net via itunes sharing. however, that's pretty slow to start due to my large library and doesn't work well with party shuffle and a few other things. i also have an office stereo and it'd be nice to play the same thing on it and the main stereo at the same time.

an airport express would pretty much solve this problem to my satisfaction, but i'd rather utilize what i already have and not spend the $99.

Solution (provisional): it appears that Airfoil and Airfoil Speakers does exactly what i want, but costs $25. cheaper than an airport express, though an AE would have other uses such as wireless bridging. if we ditch vonage, i'll need some way to hook up the DVR to the network via ethernet. the powerbook may be sufficient for this if i can sort out wake-on-lan so that it'll wake up automatically when the DVR wants to connect.

Update: resurrected my old linksys wrt54g and configured it as a client bridge. better reception than my powerbook and feeds ethernet to the DVR just fine. the linksys is a little flaky, but should be sufficient for this.

FC9 machine no longer automounts removable media

Problem: a machine in our control room would no longer automatically mount removable media like thumb drives or external USB drives. this used to work, but hadn't been tested since upgrading to FC9.

Solution: FC9 changed the handling of external devices through the use of gvfs and PolicyKit. it turns out that my upgrade process did not install pam_mount which is now required for non-root users to automount external drives. installing this via yum fixed the problem.