Skip to content

Instantly share code, notes, and snippets.

@mcornella
Last active April 14, 2020 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcornella/e7eb49ab5e5b072f57260b7e1ef05513 to your computer and use it in GitHub Desktop.
Save mcornella/e7eb49ab5e5b072f57260b7e1ef05513 to your computer and use it in GitHub Desktop.
Some stupid shit
#!/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