Last active
April 14, 2020 14:28
-
-
Save mcornella/e7eb49ab5e5b072f57260b7e1ef05513 to your computer and use it in GitHub Desktop.
Some stupid shit
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
#!/usr/bin/env zsh | |
randcase() { | |
local line ch z=$RANDOM | |
while read line; do | |
if [[ $z -lt 10000 ]]; then | |
echo ${(U)line} | |
elif [[ $z -lt 20000 ]]; then | |
echo ${(L)line} | |
else | |
for ch in "${(s::)line}" | |
do | |
[[ $RANDOM -lt 16384 ]] && ch=${(U)ch} || ch=${(L)ch} | |
echo -n $ch | |
done | |
echo | |
fi | |
done | |
} | |
# $1 = how many columns of text per line | |
# $2 = text to print | |
dotheshining() { | |
for i in {1..$1}; do | |
echo -n "$(randcase <<< $2) " | |
: $RANDOM # Rotate $RANDOM for subshells | |
done | |
echo | |
} | |
# $2 = which line to print | |
case "${2:-simpsons}" in | |
shining) line="All work and no play makes Jack a dull boy" ;; | |
simpsons) line="No TV and no beer make Homer go crazy" ;; | |
*) line="$2" ;; | |
esac | |
while true; do dotheshining ${1:-4} "$line"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment