<3 sed

Posted Fri 27 April 2012 17:41 under category tech

I wrote a fun sed script today:

sed -E -n -e ':t ; s/(.{21})(.*)/\\bf\{\1\}\n\2/ ; p ; s/\\bf\{(.*)\}\n.*/\1/ ; h ; :q { n ; G ; s/(.{21})(.*)\n\1/\2/ ; tp ; s/(.+)\n.*/\1/ ; bt} ; :p { P ; bq }'

Short, but effective. Can you figure out what it does?

(solution after the break)

read more

My Storage Problem

Posted Sat 28 January 2012 19:07 under category tech

Storage is cheap, or so we're told. Amazon will sell me storage for $0.055/GB/month in “the cloud”; 3.5" hard drives are hovering around $0.06/GB. However, my laptop has a little 250GB SATA drive that is (a) slow and (b) getting full. So I desire to replace it with a fast little SSD. But that raises the question of what to do with my stuff. I'm asking you, Internet. Details below the fold.

read more

TouchPad!

Posted Fri 02 September 2011 01:23 under category tech

TouchPad So, I got one of the Internet-legendary $99 TouchPads (well, $149 actually, but whatever). As some of you may know, I was an enormous Palm fanboy during the 90's. So it was pretty inevitable that I would end up purchasing one of their WebOS products, even though there's not a lot in common between this and Jeff Hawkins' wooden cutout Palm Pilot. Anyhow, this is probably going to be the nerdiest review of the TouchPad posted on the Internet. It mostly is concerned with keyboard mappings. Enjoy!

read more

*nix Tip of the Day: Unix Time

Posted Sun 06 March 2011 21:43 under category tips

As the unix-savvy among you probably know, there is One True Way to tell the time: the number of seconds elapsed since midnight on January 1, 1970 +0000. It's an extremely convenient way for computers to represent the time, since it's just an integer that goes up. There's no parsing to be done, and arithmetic is just regular math. If you want a brain-numbingly-detailed overview, Wikipedia's article on unix time is, as usual, sufficient.

However, what I'd like to talk about here is converting back and forth between unix time and meatware time. I imagine ...

read more

sietchtabr reboot

Posted Sun 27 February 2011 12:56 under category tech

I have a VM slice that I use to run DNS, a bzflag server, and a few other incidental things. This is what I see on it right now:

% uptime
12:05:13 up 450 days, 15:17,  5 users,  load average: 1.93, 1.35, 0.60

It's currently running Debian lenny, but I decided that I wanted to get with the times and upgrade it to squeeze. As expected the upgrade was fairly painless (took me a bit to figure out that booting by label was broken and I needed to boot by disk UUID), but it ...

read more

Linix Tip of the Day: SystemTap

Posted Wed 16 February 2011 09:08 under category tips

The other day, one of my co-workers, Evan, presented an interesting problem to me. Every day, at some point, a file named ] gets created in his home directory. He assumes that it is being created by a script with a typo in it... somewhere. But how to find out? It's a hard thing to grep for.

My initial solution was to use inotify (which you might remember from a previous post) combined with libnotify to alert him if it happens while he was at his computer. It looked like the following:

$ inotifywait -t 0 --exclude='.*[^]]$' $HOME && notify-send "something just ...
read more