Embroidered lab coat fun

Sunday, April 12th, 2009

My colleague, Mr. Rice, has a first name starting with ‘D’. This means his chat username at work is ‘drice’. At some point it was noted that you could read that as ‘Dr. Ice’ and a nickname was born.

To celebrate his third year with us I got a embroidered coat made.

Editing puppet files with vim: now with ‘quickfix’ support.

Tuesday, March 31st, 2009

So the puppet guys provide some notes and files on running puppet with vim.
One thing I didn’t see anything that provided a ‘compiler’, so I could edit a ‘.pp’ file, then do :make to check for errors. (Check out :help make in your vim for more information about the quickfix tool.)

This little tar contains all the files you need to make this work. Careful with it, as I have provided a minimalist .vimrc so don’t unpack this in your home directory.

puppet_vim.tar.gz

DTrace on OSX: incredibly useful.

Saturday, March 21st, 2009

So because I am insane and completely unable to master one thing before becoming fascinated with something new, I’m learning Haskell. By “learning” I mean “will be able to do simple apps and have a good sense for what it’s good for.”

In any case, it’s easy to install on a Mac if you’ve got MacPorts set up:
sudo port install ghc

However, the install takes a LOOOONG time. So long, I was wondering if something had gotten hung. I could see (and hear from the fans doing their best) that the CPU was busy. Running top just showed that a process named ghc (the Haskell compiler itself) was working in some way. But DTrace shows exactly what’s going on.

This trivial example (from Brendan Gregg’s DTrace Oneliners) shows the files getting opened by matching the ‘open’ system call, when it’s entered, and printing out the name of the app that called it (execname) and the first argument to that function — in other words, the file.

sudo dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0)); }'


1 17657 open:entry tclsh8.4 /opt/local/var/macports/software/ghc/6.10.1_9+darwin_9_i386/opt/local/share/ghc-6.10.1/doc/ghc/libraries/directory/LICENSE
1 17657 open:entry mdworker /opt/local/var/macports/software/ghc/6.10.1_9+darwin_9_i386/opt/local/share/ghc-6.10.1/doc/ghc/libraries/containers/minus.gif
1 17657 open:entry mdworker /opt/local/var/macports/software/ghc/6.10.1_9+darwin_9_i386/opt/local/share/ghc-6.10.1/doc/ghc/libraries/containers/minus.gif

And there we go. You can see the installer monkeying around in the documentation directories.

This technique works for pretty much any installer/process you might be curious about. In the Bad Old Days, I’ve been able to get this kind of insight from things like strace — watching as it runs a given process. To me, one of the most beautiful things about the DTrace model is that it doesn’t matter if (as happened in this case) there are a lot of processes getting run — you can still find exactly what you need without stressing with PID’s. Strace works on a process, DTrace works on the system.

If you’re on a Mac, open up a terminal and have some fun with the one-liners I linked to. You’ll be amazed by what your computer’s doing when you’re not looking.