Hacker Alarm Clock

A Tech article with View Comments posted 25 August 2007.
Tags: , ,

I was at the ELCA Central States Synod Candidacy Retreat with my wife last night, and we realized far too late that we lacked a travel alarm clock. Also lacking an internet connection, it was impossible to download an alarm clock program from the Ubuntu apt repositories. Instead, I quickly coded up this Hacker Alarm Clock in perl. It sounds just like the alarm clock we have at home! Who says that you can’t use a Computer Science degree in ministry? If you can think of other approaches, post them in the comments.


#!/usr/bin/perl

my $s = time();
my $e = $s + (3600 * .005);

print "Starting at: $s\n";

while (time() < $e) {
print "Ending at: $e (".($e-time())." secs from now)\n";
sleep 5;
}
print "Press Control-C (or Mute) to turn off alarm.\n";

open( DSP, '>', '/dev/dsp' );
while (1) { print DSP (\001 x 150); sleep 1; }

You might also enjoy:

  1. Debugging long-running perl programs in Debian
  2. Installing BackupPC on OpenWRT

  • Ya know, if you were using Windows, you could have just created a scheduled task... ;)

    I kid, I kid!

    Hope things are going well!

    - Cory
blog comments powered by Disqus