Skip to content

Instantly share code, notes, and snippets.

@JBlond
Forked from jezstephens/gist:c34b3b803928a22631df
Created November 28, 2017 15:18
Show Gist options
  • Save JBlond/64efe41234c87eea3b8fa94e4683e08e to your computer and use it in GitHub Desktop.
Save JBlond/64efe41234c87eea3b8fa94e4683e08e to your computer and use it in GitHub Desktop.
#!/bin/env sh
lines=$(tput lines)
cols=$(tput cols)
awkscript='
{
letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"
lines=$1
random_col=$3
c=$4
letter=substr(letters,c,1)
cols[random_col]=0;
for (col in cols) {
line=cols[col];
cols[col]=cols[col]+1;
printf "\033[%s;%sH\033[2;32m%s", line, col, letter;
printf "\033[%s;%sH\033[1;37m%s\033[0;0H", cols[col], col, letter;
if (cols[col] >= lines) {
cols[col]=0;
}
}
}
'
echo -e "\e[1;40m"
clear
while :; do
echo $lines $cols $(( $RANDOM % $cols)) $(( $RANDOM % 72 ))
sleep 0.05
done | awk "$awkscript"
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment