Skip to content

Instantly share code, notes, and snippets.

@pixyj
Created February 23, 2018 13:23
Show Gist options
  • Save pixyj/8c5e810ea6d752802269218b26fbf6e7 to your computer and use it in GitHub Desktop.
Save pixyj/8c5e810ea6d752802269218b26fbf6e7 to your computer and use it in GitHub Desktop.
Simple command line timer for macOS
import argparse
import os
import time
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Timer')
parser.add_argument('-s','--seconds', help='Seconds from now', required=True)
args = vars(parser.parse_args())
seconds = int(args['seconds'])
for i in range(seconds):
time.sleep(1)
if i % 15 == 0:
print(seconds - i)
seconds_word = 'seconds' if seconds != 1 else 'second'
os.system("say {} {} up ".format(seconds, seconds_word))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment