Last active
August 29, 2015 14:10
-
-
Save bast/b090e9055c9a16a8d3e4 to your computer and use it in GitHub Desktop.
Cowsay release countdown.
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
#!/usr/bin/env python | |
# Copyright (c) 2015 Radovan Bast | |
# Licensed under the MIT license - http://opensource.org/licenses/MIT | |
import time | |
import calendar | |
import os | |
release_time = calendar.timegm(time.gmtime()) | |
diff = 1418386332 - release_time | |
num_d = diff/86400 | |
num_h = (diff - num_d*86400)/3600 | |
num_m = (diff - num_d*86400 - num_h*3600)/60 | |
num_s = diff - num_d*86400 - num_h*3600 - num_m*60 | |
s_d = "%i day" % num_d | |
if num_d > 1: | |
s_d += 's' | |
s_h = "%i hour" % num_h | |
if num_h > 1: | |
s_h += 's' | |
s_m = "%i minute" % num_m | |
if num_m > 1: | |
s_m += 's' | |
s_s = "%i second" % num_s | |
if num_s > 1: | |
s_s += 's' | |
message = "%s, %s, %s, and %s until the DIRAC14 release!" % (s_d, s_h, s_m, s_s) | |
command = 'cowsay "%s"' % message | |
os.system(command) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment