Skip to content

Instantly share code, notes, and snippets.

@renatoassis01
Created April 9, 2021 23:07
Show Gist options
  • Save renatoassis01/c897a9513c5d7311ff56b433506d5151 to your computer and use it in GitHub Desktop.
Save renatoassis01/c897a9513c5d7311ff56b433506d5151 to your computer and use it in GitHub Desktop.
matrix for bash
# Matrix of this post: https://twitter.com/climagic/status/1380542449861427202
#!/usr/bin/env bash
while :; do
LINES=$(tput lines) COLUMNS=$(tput cols)
echo $LINES $COLUMNS $[RANDOM%COLUMNS] $(printf "\U$[ RANDOM%500]")
sleep 0.05
done | gawk '{c=$4; l=$4;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,l;printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,l;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