Merge branch 'master' of ssh://git.dismyserver.net:22516/WhatTheMike/scripts

master
commit 200749bf8b

@ -5,19 +5,23 @@ use strict;
use Term::ANSIColor;
use Time::HiRes qw(usleep nanosleep);
use Time::localtime;
use Getopt::Long;
# "User modifiable" data
my $MY_COL=3;
my $DFCMD="/usr/bin/df";
my $TPUT="/usr/bin/tput";
my $DFARGS="-h";
my $CLEAR_SCREEN=`/usr/bin/clear`;
# Arguments
my ($CLS, $RBG, $ARGDEX, $MY_COL) = (0,0,0,3);
for (@ARGV) {
if ($_ eq "-p") {$RBG=1;}
elsif ($_ eq "-c") {$MY_COL=$ARGV[$ARGDEX+1];}
elsif ($_ eq "--help" or $_ eq "-h" ) {get_help();}
$ARGDEX++;
}
# Static data
#GetOptions("=s" => \( my $INTERVAL=300 ),"header|h=i" => \( my $HEADER_REPEAT = 24 ),) or die "command line arguments error";
my $CLS = grep( /^-c/, @ARGV ) ? 1 : 0;
my $RBG = grep( /^-p/, @ARGV ) ? 1 : 0;
my $ROW_START=`$TPUT cub 120`; # If this doesn't work on your terminal, make the value more than 120 lol
my $UP_ONE_ROW=`$TPUT cuu1`;
my $CLEAR_TO_END=`$TPUT el`;
@ -31,6 +35,16 @@ my $COLOR_OFFSET=9;
sub clean {my $text = shift; $text=~s/\n//g; $text=~s/\r//g;return $text;}
sub randcol {return int(rand(6)+1);}
sub cachemath {my $lcache=(localtime->min*60)+localtime->sec;return $lcache;}
sub get_help {
my ($underline,$undereset)=(`tput smul`,`tput sgr0`);
my @help_columns=qw(12);
printf("\n%s%s%s\n\n","$underline","DF Highlight Script Usage","$undereset");
printf("");
printf(" %-$help_columns[0]s %s\n","-h, --help","Displays this help and exits");
printf(" %-$help_columns[0]s %s\n","-c #","Highlights the specified column (default: 3)");
printf(" %-$help_columns[0]s %s\n","-p","Enables a pinball-esque color mode before highlighting the chosen column");
exit 0;
}
# Runtime data
my @linedata=();
@ -75,13 +89,15 @@ sub dfboi {
}
}
my $blinky=10;
my $undoline=0;
while ($blinky--) {
if ($RBG) {
my $blinky=10;
my $undoline=0;
while ($blinky--) {
dfboi(randcol());
select()->flush();
usleep($blinky < 2 ? 600000 : $blinky < 4 ? 300000 : 150000);
$undoline=0;
while ($undoline < $rows) {printf("%s",$UP_ONE_ROW);$undoline++;}
}
}
dfboi($MY_COL);

Loading…
Cancel
Save