Created
May 4, 2018 14:44
-
-
Save whusterj/588f50e8e47aef8a25e3b7ed4e0bea70 to your computer and use it in GitHub Desktop.
Track 'WTF' moments over time. Optionally include a message.
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 | |
""" | |
wtf.py | |
Just write a timestamp to a text file, so later we can calculate the | |
number of 'WTFs' per minute. | |
Inspired by: http://www.osnews.com/story/19266/WTFs_m | |
Use it like this: | |
./wtf.py | |
""" | |
from datetime import datetime | |
if __name__ == "__main__": | |
from sys import argv | |
with open('wtfs.txt', 'a+') as f: | |
assert len(argv) <= 2, 'Too many arguments. Is your message in quotes?' | |
now = datetime.now() | |
f.write(now.isoformat()) | |
try: | |
msg = argv[1] | |
f.write(' ' + msg) | |
except IndexError: | |
pass | |
f.write('\r\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment