diff --git a/python/config.py b/python/config.py new file mode 100644 index 00000000..fb1949cf --- /dev/null +++ b/python/config.py @@ -0,0 +1,17 @@ +SYSTEM_USERNAME = 'your system username' + +GMAIL_USERNAME = 'username' +GMAIL_PASSWORD = 'pass' + +TWILIO_ACCOUNT_SID = 'YOUR TWILIO ACCOUNT SID' +TWILIO_AUTH_TOKEN = 'YOUR TWILIO ACCOUNT TOKEN' + +PHONEBOOK = { + 'ME': 'YOUR PHONE NUM', + 'WIFE': 'WIFE\'S PHONE NUM', + 'BOSS': 'BOSS\' PHONE NUM', +} + +EMAIL_CONTACTS = { + 'KUMAR': 'KUMAR\'S EMAIL', +} diff --git a/python/fucking_coffee.py b/python/fucking_coffee.py index c19572f3..f9290440 100755 --- a/python/fucking_coffee.py +++ b/python/fucking_coffee.py @@ -5,6 +5,8 @@ import telnetlib import time +import config + # exit if no sessions with my username are found output = subprocess.check_output('who') if 'my_username' not in output: @@ -24,4 +26,4 @@ # love the smell! con.write("sys pour\n") -con.close() +con.close() diff --git a/python/hangover.py b/python/hangover.py index b1903cd9..1112965d 100755 --- a/python/hangover.py +++ b/python/hangover.py @@ -6,31 +6,25 @@ from time import strftime import subprocess +import config + # exit if sessions with my username are found output = subprocess.check_output('who') -if 'my_username' in output: +if config.SYSTEM_USERNAME in output: sys.exit() -# returns 'None' if the key doesn't exist -TWILIO_ACCOUNT_SID = os.environ.get('TWILIO_ACCOUNT_SID') -TWILIO_AUTH_TOKEN = os.environ.get('TWILIO_AUTH_TOKEN') - -# Phone numbers -my_number = '+xxx' -number_of_boss = '+xxx' - excuses = [ - 'Locked out', - 'Pipes broke', - 'Food poisoning', - 'Not feeling well' + 'Locked out', + 'Pipes broke', + 'Food poisoning', + 'Not feeling well' ] -client = TwilioRestClient(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN) +client = TwilioRestClient(config.TWILIO_ACCOUNT_SID, config.TWILIO_AUTH_TOKEN) client.messages.create( - to=number_of_boss, - from_=my_number, + to=config.PHONEBOOK['BOSS'], + from_=config.PHONEBOOK['ME'], body="Gonna work from home. " + random.choice(excuses) ) diff --git a/python/kumar_asshole.py b/python/kumar_asshole.py index 6e95d7df..05a2bf94 100755 --- a/python/kumar_asshole.py +++ b/python/kumar_asshole.py @@ -4,19 +4,22 @@ import sys import re -GMAIL_USERNAME = ENV['GMAIL_USERNAME'] -GMAIL_PASSWORD = ENV['GMAIL_PASSWORD'] +import config -g = gmail.login(GMAIL_USERNAME, GMAIL_PASSWORD) +g = gmail.login(config.GMAIL_USERNAME, config.GMAIL_PASSWORD) if not g.logged_in: sys.exit() -msgs = g.inbox().mail(sender="kumar.a@example.com", unread=True, prefetch=True) +msgs = g.inbox().mail( + sender=config.EMAIL_CONTACTS['KUMAR'], + unread=True, + prefetch=True +) pattern = re.compile("\bsorry\b | \bhelp\b | \bwrong\b ", flags=re.I) for msg in msgs: if pattern.match(msg.body): msg.label("Database fixes") - msg.reply("No problem. I've fixed it. \n\n Please be careful next time.") + msg.reply("No problem. I've fixed it.\n\nPlease be careful next time.") diff --git a/python/smack_my_bitch_up.py b/python/smack_my_bitch_up.py index 17bd3216..e369faab 100755 --- a/python/smack_my_bitch_up.py +++ b/python/smack_my_bitch_up.py @@ -7,30 +7,24 @@ import sys from time import strftime +import config + # exit if no sessions with my username are found output = subprocess.check_output('who') -if 'my_username' not in output: +if config.SYSTEM_USERNAME not in output: sys.exit() -# returns 'None' if the key doesn't exist -TWILIO_ACCOUNT_SID = os.environ.get('TWILIO_ACCOUNT_SID') -TWILIO_AUTH_TOKEN = os.environ.get('TWILIO_AUTH_TOKEN') - -# Phone numbers -my_number = '+xxx' -her_number = '+xxx' - reasons = [ - 'Working hard', - 'Gotta ship this feature', - 'Someone fucked the system again' + 'Working hard', + 'Gotta ship this feature', + 'Someone fucked the system again', ] -client = TwilioRestClient(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN) +client = TwilioRestClient(config.TWILIO_ACCOUNT_SID, config.TWILIO_AUTH_TOKEN) client.messages.create( - to=her_number, - from_=my_number, + to=config.EMAIL_CONTACTS['WIFE'], + from_=config.EMAIL_CONTACTS['ME'], body="Late at work. " + random.choice(reasons) )