Skip to content

Instantly share code, notes, and snippets.

@mfa
Forked from anonymous/gist:4267849
Created December 12, 2012 13:52
Show Gist options
  • Save mfa/4267856 to your computer and use it in GitHub Desktop.
Save mfa/4267856 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
#
# frwd to other interested parties at the institute
#
import datetime, time, sys
leave_at = datetime.datetime(2012, 12, 13, 12, 00)
first = True
while True:
delta = leave_at - datetime.datetime.now()
if abs(delta.seconds) < 120:
raise SystemExit, u"Immediately leave for *xmas market Esslingen*, " +\
u"12:14 S-Bahn UNIVERSITÄT, 13th Dec. 2012"
elif delta.seconds > 0:
if first:
sys.stdout.write("Leave for *xmas market Esslingen* in xxh xxm xxs")
first = False
hh = delta.seconds / 3600
mm = (delta.seconds % 3600) / 60
ss = delta.seconds % 60
timestr = "%02dh %02dm %02ds" % (hh, mm, ss)
sys.stdout.write('\b' * len(timestr))
sys.stdout.write(timestr)
sys.stdout.flush()
else:
raise ValueError, "Too late, you missed joining us!"
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment