Created
March 18, 2011 16:31
-
-
Save trapd00r/876373 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
# 8bit disco-terminal, by poisonbit. | |
use List::Util qw/shuffle/; | |
use Term::ANSIColor qw/:constants/; | |
use Term::Cap; | |
use Term::ReadKey; | |
use Time::HiRes qw(gettimeofday tv_interval usleep); | |
use Term::ExtendedColor qw/:attributes get_colors/; | |
$Term::ANSIColor::AUTORESET = 1; | |
my $clear = clear(); | |
my $ospeed; foreach (`stty`) { if (/^speed (\d+)/) { $ospeed = $1; last } } | |
my $term = Tgetent Term::Cap { 'TERM' => '', 'OSPEED' => $ospeed }; | |
my $handler = shift || *STDIN; | |
my ($cols, $lines, $txp, $typ) = Term::ReadKey::GetTerminalSize($handler); | |
sub get_random_foregrounds { | |
return shuffle( keys %{ get_colors() } ); | |
} | |
sub get_random_backgrounds { | |
return get_random_foregrounds(); | |
} | |
sub get_random_binary { return shuffle ( 0, 1); } | |
sub get_random_decimals { return shuffle ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, );} | |
sub get_random_chars { return shuffle ( '!', '#','$','%','&','?', 0, 1 );} | |
$term->Tputs( 'cl', 1, *STDOUT ); | |
$term->Tgoto( 'cm', 0, 0, *STDOUT ); | |
print DARK; | |
for my $col (1..$cols) { | |
for my $line (1..$lines) { | |
my @fores = get_random_foregrounds(); | |
my @backs = get_random_backgrounds(); | |
my @chars = get_random_binary(); | |
print fg($fores[0], bg($backs[0], $chars[0])); | |
} | |
} | |
while(1) { | |
my $col = shuffle (0..$cols); | |
my $line = shuffle (0..$lines); | |
$term->Tgoto( 'cm', $col, $line, *STDOUT ); | |
my @fores = get_random_foregrounds(); | |
my @backs = get_random_backgrounds(); | |
my @nums = get_random_binary(); | |
#my @modes = shuffle (CLEAR, DARK); | |
print fg($fores[0], bg($backs[0], $nums[0])); | |
#print $modes[0], fg($fores[0], $modes[1], $backs[0], $nums[0]; | |
usleep(300); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment