Created
December 3, 2015 16:42
-
-
Save hc0d3r/b961cdc87b4c975764a2 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
#!/bin/bash | |
# mosaico.sh | |
# c0ded by @hc0d3r | |
move_xy(){ | |
printf "\e[$2;$1H" | |
} | |
clear_screen(){ | |
printf "\e[2J" | |
} | |
hide_cursor(){ | |
printf "\e[?25l" | |
} | |
show_cursor(){ | |
printf "\e[?12l\e[?25h" | |
} | |
hide_cursor | |
move_xy 0 0 | |
clear_screen | |
lines=$(tput lines) | |
cols=$(tput cols) | |
while [ $lines != "0" ];do | |
arr=() | |
tamanho=0 | |
while [ $tamanho != $cols ];do | |
while [ 1 ];do | |
x=$((RANDOM%cols)) | |
if [[ " ${arr[*]} " != *" $x "* ]];then | |
arr=("${arr[@]}" "$x") | |
break | |
fi | |
done | |
y=0 | |
color="\e[$((40 + RANDOM%8))m" | |
while [ $y != $lines ];do | |
move_xy $x $y | |
printf "$color \e[0m" | |
move_xy $x $y | |
printf " " | |
((y++)) | |
move_xy $x $y | |
printf "$color \e[0m" | |
done | |
((tamanho++)) | |
done | |
((lines--)) | |
done | |
move_xy 0 $(tput lines) | |
printf "\n" | |
show_cursor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment