BASH puzzle

January 23rd, 2009

Although only 1½ people read this blog, I’m hoping I’ll get some responses to this puzzle. I figured out a solution, but I’m worried i was being too clever and that there’s an even simpler BASH way of handling this.

You receive a string of argument pairs like:

ARGSTRING="a1 a2 b1 b2 c1 c2 …"

You don’t know how long the ARGSTRING will be ahead of time. How do you take this list of argument pairs and send each pair to get processed by another command? In other words, let’s say you just want to echo out each pair, then your solution would run like:

solution $ARGSTRING

and produce:

a1 a2
b1 b2
c1 c2

Post your solutions!! Only use BASH, do not call external programs.

Back at the old Harris Ranch …

December 30th, 2008

A good, week-long, winter respite at the old Sonoma house …

Standard sunset over the vineyard

Disco Barn

Brandon\'s Barn

Brandon also put a couple of images on his blog.

Patch: Ubuntu DRBD now can haz run after boot

December 9th, 2008

Ubuntu server edition “brings the power of inexpensive shared storage to your servers”. In particular, they tout DRBD support. Unfortunately, in Ubuntu 8.10 Intrepid Ibex, DRBD won’t start at boot.

The bug wasn’t too hard to track down. The problem is the update-rc.d script (run in the package postinst) is parsing the LSB headers in the DRBD init.d script. The LSB headers tell update-rc.d to not include runlevel 2 (Ubuntu’s default) when installing symlinks, so none is made in rc2.d. Hence, the init script is not run during startup.

I put documentation and a debdiff (package patch) on the launchpad bug report. However, even though this package is in main, I have no faith this bug will be fixed by Ubuntu (see update below the fold). So, for your server’s enjoyment, grab the patched packages we are using at my company:

Read the rest of this entry »

Halloween Critical Mass

November 6th, 2008

This year’s Halloween Critical Mass was as awesome as always. A few thousand (my guess) people showed up in costumes and lights and (of course) political motifs. After many rides over many years in San Francisco, and a few scary, but important, rides in Manhattan, the SF Halloween Mass is one event I’ll keep showing up to year after year. In fact, it sounds like this year it was the main Halloween event in the city!

There’s a great video made by Streetfilms and some wonderful pictures posted on the sfwiggle blog. Found via a Bike Blog NYC post. The Streetfilms‘ video is below.

A way to STOP text message spam

October 31st, 2008

If you are being text spammed by a short-code (a mobile number typically 5 digits long), just reply with “STOP”. This should work if it’s a service that cares to not piss off its recipients. This probably won’t work for an annoying relative. In my case, spam was coming from a service called Kadoink, and after I sent “STOP”, I got back a text that said I’d receive no more messages. I suspect this is some sort of industry accepted command: I found it in AT&T’s, What YOU can do to control cell phone spam.

Read the rest of this entry »