Category Archives: Geek

All things geek

My biscuits is burning, my biscuits is burning!

Today two guys from FeedBurner come to visit another team at work.  I asked if I could sit in to get some idea of what FeedBurner can do.  Right now I don’t really get any stats out of my blog that Technorati or awstats can give me, and those aren’t that useful.  It’ll be interesting to see if I get any insight on my blog this way.

The cool part is that this took almost no time to setup.  Registering at FeedBurner and pointing it towards my blog took about 2 minutes, and there is a feedburner plugin for WordPress that automatically redirects the RSS feeds (with a 307, so I can switch back at any time.)  All in all, pretty painless.

fortune for xscreensaver for OS X

I love that jwz ported XScreenSaver to OS X at about the same time I moved to OS X for my laptop.  I got to keep all the screen savers I use and have used over the past decade or so.  Especially some of the cooler GL based ones.  (Its also nice that someone ported rss-glx as well, but that’s a different story.)  The only piece XScreenSaver is missing is the controller to randomly call only selected hacks.  Luckily, RandomExtra fills that hole.

One issue I’ve had with xscreensaver on OS X has been the difficulty/impossibility of having the text displaying hacks use fortune (or any program, for that matter) as the source of the text.  Mike mentioned this morning that all those hacks appear to be able to call out to a URL.  This morning I felt strangely motivated, so I whipped up a quick ruby script that is basically an HTTP based fortune server.  Since ruby ships with OS X, it’ll make it easier in case anyone else wants to get it running as well.  Once I got that working, the question was how to have this launch automatically on OS X so I wouldn’t have to worry about it.  I’ve played with Lingon on and off, and it seemed like the tool to help me do it.  I used Lingon to create a UserDeamon that should launch when one logs in, and should die when one logs out.  I then went through the screen savers that call out to text and pointed them at the localhost URL, and boom, I was back to fortune city.

To recreate this you’ll need this fortune_helper.rb script I whipped up, Lingon to create the launcher or this fortune.plist (put in /Library/LaunchDaemons) and fortune installed somewhere.  I installed fortune via DarwinPorts.

zsh word splitting

Awhile ago, after I showed him how I indexed my mail with mairix, MARK gave me a zsh function to wrap a call to mairix and then invoke mutt.  For some reason, when using the function, I was never able to pass multiple search terms to mairix and have it return results.  It always failed.

It turns out that this was a zshism that I wasn’t aware of, and Mark might not have been as well.  I finally took the time to get to the bottom of this and I found this FAQ which explains how word splitting differs in zsh.  (All OTHER shells do it wrong, of course.)  In any case, my multiple search terms were being passed to mairix as a single command line argument, so, of course nothing matched.  I edit the script to call mairix ${=*} instead of mairix $* and it works now.

MARK might not have run into this because he might have SH_WORD_SPLIT turned on.  I do not.

Anyway, here’s the function:

mairix_mail (){
  if (( ${#argv} == 0 )); then
    # nothing to do
    mairix --help
    return
  fi
  # search
  mairix ${=*}
  # see the results
  # assumes results are in ~/Maildir/search_results
  mutt -f=search_results
}
alias gm='mairix_mail';

I see your Nerd ABC and raise you a DORK ABC

Parent Hacks had a post that alerted me to the Nerd ABC flashcards, which I totally want to get for my daugther.  I shared this with the folks on IRC and it turned into a discussion, thanks to Steve thinking that Fruit Fly wasn’t nerdy enough, of what a set of Programming Language ABC flash cards should look like.

Steve was kind enough to write up what was created by commitee.

OS X moving unix forward

For every stupid hard coded Steve Jobism in OS X1, there’s some really awesome unix extentions I’d like to see elsewhere.  The big one for me today has to do with DNS handling.

I’ve been playing with OpenVPN to get access to my network at home.  Since I have a MacBook Pro from work, that’s been my end point client.  I’ve been using Tunnelblick as my OpenVPN client to connect to OpenVPN server on my linux box (installed via DAG’s RPM repository.)  One thing that bugged me was how to get DNS so I can see my internal home DNS without breaking access to work’s internal DNS.  If I was using a linux laptop, I think my solution would have to do with running a local instance of named with some wacked out config to do caching only and refer to different DNS servers.  Hardly dynamic and a giant PITA to get going.

I was curious about how to make this go though, and what general solutions people had when I came across a post by Mike Erdely titled OpenVPN + DNS + OS X.  That is exactly what I wanted to do!  As a bonus he’s even using Tunnelblick.

Mike shows how OS X’s DNS resolver uses an /etc/resolver directory to get additional per-domain configuration information, as opposed to the blanket /etc/resolve.conf that unix users have come to know.  To get the mac to resolve kgarner.com using my doman’s internal DNS server I just need to create /etc/resolver/kgarner.com and put nameserver 192.168.1.10 inside of it.  This directs OS X’s resolver to ask 192.168.1.10 for any kgarner.com query.  He also shows how to flush OS X’s DNS cache via lookupd so if I had hit any of my public kgarner.com IPs the resolver will send me to the private ip instead of the public one i’ve already hit.  There’s also two simple scripts that you can integrate with OpenVPN to add and remove the /etc/resolver entry as needed.

The fact that OS X’s resolver will check for entries /etc/resolver first is the type of smart unix extentions I’d like to see more of.  There’s no reason Linux’s resolver can’t be doing something like this.  It would make VPNs easier to implement, and doesn’t seem to be that hard to add to the resolver code.

Other examples of OS X moving stuff forward is the init/cron/at all in one launchd.  I’m slowly starting to agree that init, cron, and at are all sides of the same coin.  Don’t get me wrong, launchd has some issues, but the idea is a step in the right direction, especially for machines that will sleep.  A lot of what OS X has done to make unix better is especially for mobile sleep-capable devices like laptops.

1 Ask MARK for a laundry list of them…  🙂