I couldn’t find a countdown timer for my training for reps, so I wrote a little bash script, that does the job (at least well enough…). You’ll need the text synthesizer espeak and a sound file named sound.mp3 for this.
#!/bin/bash
countdown=5
if [ "$#" -eq 1 ]; then
delay=5
time=$1
elif [ "$#" -eq 2 ]; then
delay=$1
time=$2
else
echo "Usage: $0 [DELAY] TIME"
exit -1
fi
function countdown {
for i in `seq $1 -1 1`; do
espeak $i &
sleep 1
done
}
sleep $(($delay-$countdown))
countdown $countdown
mplayer sound.mp3 &
sleep $(($time-$countdown))
countdown $countdown
mplayer sound.mp3
Posted in
lifting
2016-09-24 15:43 UTC