Skip to content

Instantly share code, notes, and snippets.

@0atman
Created February 28, 2013 10:54
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 0atman/5055897 to your computer and use it in GitHub Desktop.
Save 0atman/5055897 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""
Copyright (c) 2009 Blackgate Research.
This work is made available under the terms of the Creative Commons Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/."
"""
import time
import os
import sys
# Default values are 10 mins work, 2 mins play.
# Feel free to change to whatever works for you.
work = 600
play = 120
# Command to run each work/play play/work transition
notify_cmd = 'aplay /usr/share/sounds/speech-dispatcher/test.wav -q'
# Text to display
notify_text = (lambda: sys.argv[1] if len(sys.argv) > 1 else "WORK")()
# Main loop
while 1:
os.system("clear")
os.popen('notify-send "%s"' % notify_text)
for i in range(0, work):
print "%s" % notify_text
print work - i
time.sleep(1)
os.system("clear")
os.popen(notify_cmd)
os.popen("notify-send PLAY")
for i in range(0, play):
print "PLAY"
print play - i
time.sleep(1)
os.system("clear")
os.popen(notify_cmd)
@0atman
Copy link
Author

0atman commented Feb 28, 2013

Originally found this method at http://www.43folders.com/2005/10/11/procrastination-hack-1025, it has become popularised as the "Pomodoro Technique".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment