Pandora from the Command Line
I like having Pandora going pretty much all the time, be it Bach when I’m coding, Techno for sysadmin tasks, or indulging my shameful pop music addiction. I wanted a way to control Pandora without having to drop out of the shell. I wanted it for my Mac, but lucked out and found one that works across all the platforms I use. Pianobar is a command line Pandora client and it works in Mac and Linux. (And Windows too.)
I was having a little trouble building it in Snow Leopard using the instructions from here, when I discovered that it’s already available in MacPorts. So I installed it with:
In Linux, you can find links to the repos for your distro of choice on the Pianobar website.
Next, I wanted it to login automatically and start playing when I launched it. On Mac, you can create a config file at ~/.config/pianobar/config, with contents similar to the following:
password = s3cR3t_sQu1RR3L
user = johnny.chimpo@afghanistanimation.org
To get the station ID for the autostart_station parameter:
- Run pianobar
- Log in manually
- Launch your favorite station
- Hit i to see the station and song info.
- The station ID will be in parentheses after the station name.
After you’ve got your file saved, you should be able to launch pianobar and have it start playing auto-magically.
Now, my next step was to use at so I could start pianobar at a given time and use it as an alarm clock.
You need to enable atrun on your Mac to use at to schedule jobs. (It’s enabled by default on most Linux distros.) You can schedule the launch like so:
pianobar #hit enter
#hit Ctl+D
If you start pianobar with at, it’s not on an interactive shell so you have no way to interact with it, or so I thought. You can create a fifo file to pass controls to the process:
Once you have that, you can control pianobar by echoing commands into the fifo:
echo p > ~/.config/pianobar/ctl
#To quit:
echo q > ~/.config/pianobar/ctl
#etc. etc.
Hopefully that’s food for though enough to get you started. Enjoy.
PHP Choose Your Own Adventure
It all started with a whim. “I wonder if anyone has written a choose your own adventure game in PHP?” That landed me on Cal Henderson’s “choose” game. That, in turn, led me to Club-Ubuntu’s fork. I started playing around with the stock version and found myself making quite a few changes, so I decided to dig in a little deeper and make it an official fork. I added support for Google Adsense and Analytics, ReCaptcha on the user forms, and an admin page to manage some of the new features as well as some of the copy throughout the site.
I pushed the initial release to github tonight. You can find the code here. There is also a working demo available.
Enjoy!
Cleaning out the the wiki
I started going through my wiki and some old folders on my NAS this week. I have several old projects that may be of use to someone. Over the next few weeks, I’m going to try to post a whole slew of stuff. I’m also working on a few new projects that are nearly ready to be put out into the wild. So, in short, stay tuned.
Samba Network TIFF Printing
For over a year now, we have been using a samba shared network printer to generate TIFF files from electronic documents so that they can be imported directly in to iPerms. The TIFF printer is simply a script that takes PostScript input from the client machine’s print driver and converts it to an iPerms compatible TIFF image. This is primarily useful for an Army installation, but may be relevant if your site is using some other form of document archiving system that uses TIFF images. I can say that ours has spit out over 30,000 pages.
How it works:
Users setup the printer on their system using a PS print driver. (On Vista, I usually use the HP Color Laserjet 2500 PS driver) When they print a document to the printer, it generate a PDF, converts the PDF to a TIFF file and removes the interim PDF. The completed file is dropped into a share with 0600 file permissions. I use 0600 because I set the share to only display readable files. Thus, while everyone is printing to the same folder, they only see their files when they open the share. Less chance of PII leakage.
Read more 
PHP Crontab Timeline Generator
First, the goods: http://jeffgeiger.com/cron/ (Source available for download from that page.)
This little app parses your crontab and generates a gantt chart of the task time line. It uses the twzCronChart class. I basically took their example and modified it to:
- Accept input via an html textarea.
- Parse out the comments and blank lines.
- Show a corresponding list of which cron line corresponds to which “Task”.
I’ll update this post if I make more changes.
Redesign!
Switched back to WordPress. Isn’t it exciting?
The links in my old posts don’t work yet, but I’ll get them fixed. Tomorrow. Probably.
Bash Dynamic DNS Updater (ZoneEdit)
This is a quick BASH script I whipped up to update my domains dynamic DNS records at ZoneEdit. It’s meant to be ran from cron. See the script here.
Movie Collection Script
Over the past few months, one of my “As time allows” projects has been a movie collection cataloguing script. Basically it reads through your collection of digitally stored movies, catalogues them in mySQL, and gives you a PHP interface to your collection. It’s not fancy, it’s not pretty, and it almost certainly doesn’t adhere to any good coding practices.
I will try to keep this updated as I “improve” the script and pages. Also, if by some twist of fate, you’re a skilled bash scripter with some free time, I’m open to suggestions on how this can be improved.
Portable Apps
Now that’s it’s “cool” to keep all your apps on your thumb drive, I thought I’d spit out a list of good resources.
Portable Apps has some major applications rewritten for portability. Notably Portable Firefox, Thunderbird (+ gpg and enigma), and OpenOffice.
Portable Freeware has tons of little apps to meet just about any need.
KeePass is a powerful, yet simple password manager that stores your password in a database encrypted with FIPS-compliant encryption.
TrueCrypt allows you to keep all your sensitive documents without having to worry about someone getting acces to them if they swipe your drive.
DVI Recover
After almost 3 years, it appears that Dell, among others, has still not fixed the EDID corruption issue on DVI LCD monitors. I’m still seeing 100+ hits a day on the DVI recovery utility page. If you ended up here in search of the utility, I hope it works for you.
If you are a Dell employee/tech and you know a better way to fix the issue, or there’s a new utility, please let me know.

