Archive for September, 2009

Stream iTunes over SSH

September 28th, 2009 82 comments

Works with iTunes 10 and Lion

After (mostly unsuccessful) Googling for how to stream iTunes over SSH, I finally tracked down the difficult bits myself and put together a four three-line script:

dns-sd -P "Home iTunes" _daap._tcp local 3689 localhost.local. \ "Arbitrary text record" & 
trap "kill $!" 0 1 2 15
ssh -C -N -L 3689:localhost:3689

Update: I’ve cut this down to three lines using trap

Update: You can do this with iPhoto too.

Update: Works with OS X 10.7 Lion.


Read more…

Categories: Utility Tags: , , , , ,

ImageSnap: Capturing a Video Image with QTKit on Snow Leopard

September 14th, 2009 22 comments

ImageSnap is a Public Domain command-line tool that lets you capture still images from an iSight or other video source. You might remember Axel Bauer’s original isightcapture tool (that is no longer supported but still works on most systems). I wanted a similar tool with source available so I could make feature changes or at least recompile with Apple’s ever-changing architectures.

At some point Apple introduced QTKit, a new and oh-so-welcome abstraction bringing QuickTime programming into the 21st century. Nothing against die-hard ANSI C programming, but it fits awkwardly into what are otherwise clean Objective-C Cocoa programs.

Rather than provide a detailed tutorial about using QTKit (sorry if you wanted one), I’ll just point you to the ImageSnap code so you can take a look at a few useful things like starting a QTCaptureSession, capturing output with QTCaptureDecompressedVideoOutput, and saving an NSImage to disk.

Deleting Flash Cookies Daily Using Snow Leopard’s Semi-Broken Periodic Scripts

September 8th, 2009 3 comments

I was trying to find a convenient way to delete Flash cookies every day and wanted to run two simple lines automatically:

rm -rf /Users/rob/Library/Preferences/Macromedia/Flash\ Player/\#SharedObjects
rm -rf /Users/rob/Library/Preferences/Macromedia/Flash\ Player/

There are many ways to do this of course: launchd, cron, at, etc, but I thought it would be most elegant to tie into the Mac’s periodic maintenance scripts, and what a time I had debugging why I couldn’t get it to work.

Read more…

Two Factor Authentication in Snow Leopard SSH with Perfect Paper Passwords

September 2nd, 2009 4 comments

If you’re nobody special like me, you probably “only” get a few thousand failed SSH logins to your computer each day. If you run a high profile system, it’s probably worse. Of course you have a good password for your account (right?), but should someone actually get your password, like with a keystroke logger on the remote computer you’re using to log in, what protection do you have then?

Two factor authentication can increase your security by requiring more than just your password (one factor) to log in. I like using Perfect Paper Passwords from Gibson Research Corporation ( With this system after entering my username and password (even a wrong password) in an SSH session, I am then prompted for a four-digit passcode that I’ve previously printed out and stashed in my wallet. Each code is only used one time, and protects me even if someone manages to get my password. In the case where attackers are guessing my password, they cannot tell if the password or passcode was guessed incorrectly.

Sample PPP passcard (courtesy

Sample PPP passcard (courtesy

There’s only a little bit of trickery involved to compile it for Mac OS X 10.6 Snow Leopard, and if you had it working before in Leopard, you’ll need to recompile the PAM module (I know, it’s like “ATM machine”) for 64-bit mode.

Read more…