Skip to content

Instantly share code, notes, and snippets.

@infertux
Created June 3, 2012 21:47
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 infertux/2865140 to your computer and use it in GitHub Desktop.
Save infertux/2865140 to your computer and use it in GitHub Desktop.
Cheap pomodoro timer
#!/bin/bash
# Cheap pomodoro timer
# https://en.wikipedia.org/wiki/Pomodoro_Technique
set -eu
trap bye INT TERM
bye() {
echo -e "\nThe tomato has been squashed."
}
say() {
command -v espeak >/dev/null && espeak -a 200 "$@"
}
output() {
echo "[$(date +%R)] $@"
}
echo "Hey you! I'm a tomato, listen to me!"
i=0
while true; do
echo
output "Decide on the task to be done then work on the task until the timer rings (25 minutes)."
say "Work"
i=$((i + 1))
sleep 1500
if [ $((i % 4)) -eq 0 ]; then
output "Take a long break (20 minutes)."
say "Long break"
sleep 1200
else
output "Take a short break (5 minutes)."
say "Short break"
sleep 300
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment