Skip to content

Instantly share code, notes, and snippets.

@flxai
Last active February 10, 2020 17:05
Show Gist options
  • Save flxai/1b50bb06357f0e6d231695ab9c41f262 to your computer and use it in GitHub Desktop.
Save flxai/1b50bb06357f0e6d231695ab9c41f262 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Draws an endless carpet
# carpet [REPETITION] [FLICKER_MODE]
[[ $# -gt 0 ]] && s="$1" || s=4
[[ $# -gt 1 ]] && m="$2" || m=0
while :; do
if [[ -z "$b" ]]; then
p=$(pyceau -m "$m" -r 18+18 -d $(tput cols)x1 -s "$s")
else
p=$(pyceau -m "$m" -r 18+18 -d $(tput cols)x1 -s "$s" -b $b)
fi
b_="$b"
b=$(tail -1 <<< "$p" | awk '{ print $2 }')
c=$(grep -vE '([a-kn-z]|^$)' <<< "$p")
[[ "$b" == "$b_" ]] && continue
grep -qE '^(0+|1+)$' <<< "$b" && b="$b_" || echo "$c"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment