Fri, 16 May 2008

Those of you who like RSS feeds may have noticed that the feed for this blog has been broken since my site redesign. I'm glad to say that it's now working properly. There's a link at the end of each story, and the URL is: http://briantanaka.com/blog/index.rss. Enjoy!

Posted at: 20:25 | [Path: /misc] | Permalink | Comments disallowed | RSS

Lately, I've been using Ubuntu about fifty percent of the time throughout my workday. I used to use Linux 100% of the time (Slackware or Debian), but for the last few years I've been using Mac OS X 100% of the time. Making the switch from Linux to Mac OS X was largely snag-free, but I did have to spend a fair amount of time finding applications in Mac OS X that performed all the functionality I was used to in Linux. Now, that I'm using Linux again, at least half-time, I find I'm having to go through the same exercise of finding apps and utilities that do what I need. Mostly, this has been very easy.

One exception has been annoying because it's something that's so trivial, one would assume it'd be easy to take care of right off the bat. Namely, I need a simple "tea timer" utility. You know... you tell it how many minutes to count, and when that many minutes has passed, it makes an obnoxious sound.

I've looked around a few times now for such a beastie. There are a couple of things that are pretty close, but nothing that exactly fits the (simple) bill. Today, annoyed by the absence of a tea timer again (I use timers all the time for various reasons -- the major one right now being that I have to enforce typing breaks because I have a slipped disc and if I type like a fiend for hours on end, I end up in a lot of pain), I decided to just hack one out in Perl.

This was definitely a case of "Perl to the rescue." It took a couple of minutes to make a script that did exactly what I want -- much less time than I've spent scouring the 'net for a utility to do the same thing. Plus, since it uses mpg123 to play the alarm, I can use any sound I like, as long as mpg123 can play it. I ended up making a little series of chimes in Garageband for the alarm. Works great.

Here's the script. It's not the world's most elegant, but it's perfectly fine for the purpose at hand:

mbp:~$ cat bin/teatimer 
#!/usr/bin/perl

$limit = $ARGV[0] * 60;
print "Starting tea timer for $ARGV[0] minutes ($limit seconds)...\n";

while ( $limit > 0 ) {
	print "seconds remaining... $limit\n";
	sleep 1;
	$limit--;
}

print "ding!\n";
exec("/path/to/mpg123 /path/to/alarm.mp3");

Posted at: 20:19 | [Path: /linux] | Permalink | Comments disallowed | RSS

Tue, 06 May 2008

For various reasons, I've redesigned my site. By "redesign" I don't just mean how it looks. The fundamental underpinnings of the site -- how it works -- are totally different now. In future posts, I'll describe what changes I made, how, and why.

Posted at: 22:02 | [Path: /misc] | Permalink | Comments disallowed | RSS