-
Notifications
You must be signed in to change notification settings - Fork 0
/
eyekiller
executable file
·54 lines (46 loc) · 974 Bytes
/
eyekiller
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env perl
# Copyright (c) 2008 Vsevolod Kozlov <[email protected]>
# License: public domain.
use strict;
use warnings;
use Curses;
my $window = new Curses;
my $timeout = shift || 0;
my ($i, $j, $k, $f, $b, $pair, $pair_num)=(0,0,0,0,0,0,0);
start_color();
my @colors = (
COLOR_BLACK,
COLOR_RED,
COLOR_GREEN,
COLOR_YELLOW,
COLOR_BLUE,
COLOR_MAGENTA,
COLOR_CYAN,
COLOR_WHITE,
);
$SIG{ALRM} = sub { exit 0 };
alarm $timeout;
while (1)
{
init_pair($k, $colors[rand(@colors)], $colors[rand(@colors)]);
for ($i = 0; $i < LINES; ++$i)
{
for ($j = 0; $j < COLS; ++$j)
{
$pair_num = rand(COLOR_PAIRS)+1;
$pair = COLOR_PAIR($pair_num);
pair_content($pair_num, $f, $b);
unless ($f == COLOR_BLACK)
{
# Random color pair
$window->attron($pair);
# Random ascii char ((0..94)+32 = 32..126)
$window->addch($i, $j, chr(rand(95)+32));
$window->attroff($pair);
}
}
$window->refresh;
}
$k++;
}
END { endwin }