Recently, my wife (who knows I'm addicted to anything with blinking LEDs on it) suggested that I might hook a monitor to my headless Linux box and have it display just blinking lights in the screen. Once I tore myself away from staring at the modem and ethernet hub, I took a crash course in Curses and threw together the following script.
Of course, now I want to add more monitors to the box just to have more things blinking at me ;)
#!/usr/bin/perl -wT
use strict;
use Curses;
my $win = new Curses;
my ($x, $y, $color,$bold,$char);
initscr;
start_color;
# Initialize the 6 color pairs I'll use
init_pair 1, COLOR_GREEN, COLOR_BLACK;
init_pair 2, COLOR_RED, COLOR_BLACK;
init_pair 3, COLOR_YELLOW, COLOR_BLACK;
init_pair 4, COLOR_BLUE, COLOR_BLACK;
init_pair 5, COLOR_MAGENTA, COLOR_BLACK;
init_pair 6, COLOR_CYAN, COLOR_BLACK;
init_pair 7, COLOR_BLACK, COLOR_WHITE;
halfdelay(1); #wait for 1/10 secs for keystroke
noecho; #don't echo keystrokes
# Loop to continuously blink the lights
while (1) {
$x = int(rand(79));
$y = int(rand(23));
$color = int(rand(8)); # use one of my 7 color pairs
$bold = int(rand(2));
# Use a space as my character
$char = 32|COLOR_PAIR($color)|A_REVERSE;
if ( $bold > 0 ) { $char = $char|A_BOLD; }
$win->addch($y,$x,$char);
$win->refresh;
# exit loop when a key is pressed
last unless ($win->getch() eq -1);
}
endwin;