Created
October 25, 2018 04:36
-
-
Save mbdmbd/7d06fd83a878f90d0c11b25e3d31242e to your computer and use it in GitHub Desktop.
This file contains 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
matrix () { | |
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 | |
if [ -t 0 ] | |
then | |
stty -echo -icanon -icrnl time 0 min 0 | |
fi | |
keypress='' | |
while [ "x$keypress" = "x" ] | |
do | |
echo $lines $cols $(( $RANDOM % $cols)) $(( $RANDOM % 72 )) | |
sleep 0.03 | |
keypress="`cat -v`" | |
done | awk "$awkscript" | |
if [ -t 0 ] | |
then | |
stty sane | |
fi | |
clear | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment