Last active
August 29, 2015 14:26
-
-
Save brodul/54121c2a30136e2e1b57 to your computer and use it in GitHub Desktop.
100 pushup challange shell 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
### | |
# 100 pushup challange shell script | |
# | |
# Dependencies: | |
# - alsa | |
# - alsa-tools | |
# - espeak | |
# | |
### | |
set -e | |
_alarm() { | |
( \speaker-test --frequency $1 --test sine )& | |
pid=$! | |
\sleep 0.${2}s | |
\kill -9 $pid | |
} | |
_usage() { | |
echo "Go to http://www.hundredpushups.com/" | |
echo | |
echo "Find a week, then enter sets for a specific day." | |
echo | |
echo "For example:" | |
echo "sh pushup.sh 10 12 7 7 9" | |
} | |
if [ $# -ne 5 ]; then | |
_usage | |
exit 1 | |
fi | |
espeak "Welcome to the 100 pushup challenge" | |
espeak -s 120 "Sets: ${1}, ${2}, ${3}, ${4}, at least ${5}." | |
espeak "Get ready" | |
sleep 2 | |
espeak -s 120 "Set one: ${1}" | |
_alarm 400 9; _alarm 500 9; _alarm 600 9 | |
sleep 70 | |
espeak -s 120 "Set two: ${2}" | |
_alarm 600 9 | |
sleep 80 | |
espeak -s 120 "Set three: ${3}" | |
_alarm 600 9 | |
sleep 90 | |
espeak -s 120 "Set four: ${4}" | |
_alarm 600 9 | |
sleep 90 | |
espeak -s 120 "Set five: at least ${5}" | |
_alarm 600 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment