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.

When you don’t even have a pullup bar…

Friday, March 6th, 2009

I haven’t talked about it much on this site, other than on my twitter feed, but I’m really enjoying a fitness program I’ve been doing called CrossFit. (I go to Culver City Crossfit and it is awesome.)

In any case, there have been days (like this Friday) where for some reason I can’t make it. No problem, CrossFit can be done anywhere. However, a lot of the workouts, at the very least, require a pullup bar. I really want to get one for my house and office, but haven’t done that yet. Also, I wanted to find workouts I could do on the road as well where the equipment I’ve got on me is extremely limited. (Kettlebells and Packing Light don’t really go that well together.)

I googled for “CrossFit Bodyweight” and found this great document:
Bodyweight WOD’s. (A ‘WOD’ is the Workout Of The Day, the workout a given CrossFit affiliate has their athletes do that day.)

Lots of them still require the ability to do pullups (again, no bar) or include moves that I’m still working on, like handstand pushups or 1-legged squats.

So I clipped out (for my reference, but figured it might help someone else, too) a few of those that I am able to do, and only require one piece of equipment: some ability to keep time. (Well, and in some cases something approximately 2 feet tall that you can jump onto.)

I’ve retained the original sourcing on all of the WOD’s that had them.

3 rounds for time of:
50 Push­ups
50 Sit­ups
50 Squats

Four rounds for time of:
25 Lunges
50 Squats

Five rounds for time of:
100 squats
20 Lunges
35 push­ups

15 rounds for max reps:
Pull­ups, 30 seconds on / 30 seconds off

For total time:
Run 10 minutes max effort
200 squats
Run 10 minutes max effort
(Source: Shane Skowron)

4 rounds:
50 walking lunges
50 squats
Run 400m
(Source: Shane Skowron)

5 rounds:
10 burpees
20 box/bench jumps
30 pushups
40 squats
50 lunges
(Source: navyseals.com forums)

Run 5k for time, but every 5:00 do 50 pushups and 50 squats. 

1200m uphill sprint 
Rest 1:00
1200m downhill jog
Rest 1:00
Repeat

1:00 sprint / 1:00 rest
1:00 sprint / 0:50 rest
1:00 sprint / 0:40 rest
1:00 sprint / 0:30 rest
1:00 sprint / 0:20 rest
1:00 sprint / 0:10 rest
1:00 sprint / 0:20 rest
1:00 sprint / 0:30 rest
1:00 sprint / 0:40 rest
1:00 sprint / 0:50 rest
1:00 sprint / 1:00 rest
(Source:crossfitendurance.com)

10×100m with 2:00 rests

8×200m with 2:00 rests

4×400m with 5:00 rests

8 rounds of:
80 seconds sprint / 40 seconds recovery
(Source: crossfitendurance.com)

3 rounds:
100m sprint / Rest same amount of time you finished the sprint
200m sprint / Rest same amount of time you finished the sprint
300m sprint / Rest same amount of time you finished the sprint
(Source: crossfitendurance.com)