Convert pycairo ARGB32 surface to PIL RGB image

Cairo is great for rendering stuff, but doesn't give you many options to export your data. The Python Image Library has good options to save stuff. The problem I ran into is that I have a ARGB32 pycairo surface, and PIL doesn't support ARGB32. It supports RGBA instead. After much experimentation, I came up with the following piece of code, using numpy to solve this problem: def pilImageFromCairoSurface( surface ): cairoFormat = surface.

Using xlsclients to launch programs once from a window manager config

I spent some time mucking around with the awesome and xmonad tiling window managers this weekend. I ended up with an xmonad config that I'm sure is nothing special but that works well for me. One thing that I do want is to launch certain programs (like nm-applet) when I first log in. On top of that, I want to be able to restart the window manager without exiting all my running programs.

San Francisco Half Marathon

... or, how to run a half marathon with almost no run training. For a bit under a year, I've been going to a local CrossFit gym: Mad Dawg Fitness. If you haven't heard, CrossFit involves doing a little bit of everything, with a goal of getting decent at everything. This involves power lifting, Olympic lifting, pull ups, push ups, hand stands, jump ropes, box jumps, dips, short runs, rope climbs, farmer walks, lunges, etc.