Hacker Alarm Clock
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:
- Cory Foy


