Last active
August 29, 2015 14:20
-
-
Save nick-merrill/279d6e539c2b5b6c3eef to your computer and use it in GitHub Desktop.
Highly useful notification script
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
alias big="toilet -f bigmono12 -F gay" | |
color_screen () { | |
# Expects code like 1;30;42m | |
cols=$(tput cols) | |
lines=$(tput lines) | |
str="\033[$1" | |
i=0 | |
while [[ $i -lt $cols ]]; do | |
str=$str" " | |
((i++)) | |
done | |
str="$str\033[0m" | |
i=0 | |
while [[ $i -lt $lines ]]; do | |
echo "$str" | |
((i++)) | |
done | |
} | |
alias black="color_screen '1;30;40m'" | |
alias red="color_screen '1;30;41m'" | |
alias green="color_screen '1;30;42m'" | |
alias yellow="color_screen '1;30;43m'" | |
alias blue="color_screen '1;30;44m'" | |
alias cyan="color_screen '1;30;46m'" | |
alias white="color_screen '1;30;47m'" | |
yo_speak () { | |
while true; do | |
say "$1" | |
sleep 2 | |
done | |
} | |
listo_pollo_speech="leesto poy yo" | |
yo () { | |
# 2 Hz with break in between flashes, | |
# as recommended here: http://www.epilepsy.com/learn/triggers-seizures/photosensitivity-and-seizures | |
time1=0.5 | |
time2=1 | |
num_flash=8 | |
default_msg="listo ;)" | |
default_speech="$listo_pollo_speech" | |
default_cmd="green" | |
msg=${1:-$default_msg} | |
yo_speak "${1:-$default_speech}" & | |
cmd=${2:-$default_cmd} | |
while true; do | |
j=0 | |
while [[ $j -lt $num_flash ]]; do | |
black | |
big "$msg" | |
sleep $time1 | |
eval "$cmd" | |
sleep $time1 | |
((j++)) | |
done | |
big "$msg" | |
sleep $time2 | |
done | |
} | |
status_green () { | |
green | |
say "$listo_pollo_speech" | |
} | |
status_red () { | |
red | |
say "attention required" | |
} | |
alias status="status_green || status_red" | |
alias statusrep="yo || yo 'attention required'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment