This commit is contained in:
Vladimir Mayakovski 2015-12-02 08:02:17 +00:00
commit 4c2f76d359
7 changed files with 38 additions and 23 deletions

View File

@ -27,13 +27,16 @@ Pull requests with other implementations (Python, Perl, Shell, etc) are welcome.
You need these environment variables:
```sh
# used in `smack-my-bitch-up`, `fucking-coffee` and `hangover` scripts
USER=<username>
# used in `smack-my-bitch-up` and `hangover` scripts
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
TWILIO_ACCOUNT_SID=<twilio_account_sid>
TWILIO_AUTH_TOKEN=<twilio_auth_token>
# used in `kumar_asshole` script
GMAIL_USERNAME=admin@example.org
GMAIL_PASSWORD=password
GMAIL_USERNAME=<gmail_username>
GMAIL_PASSWORD=<gmail_password>
```
For Ruby scripts you need to install gems:

8
python/README.md Normal file
View File

@ -0,0 +1,8 @@
### Python port of the hacker-scripts code
#### Prerequisites
Apart from setting the environment variables per main README file, install all required libraries (preferably in a virtual environment)
pip install -r requirements.txt

View File

@ -6,8 +6,7 @@ import telnetlib
import time
# exit if no sessions with my username are found
output = subprocess.check_output('who')
if 'my_username' not in output:
if os.environ.get('USER') in subprocess.check_output('who'):
sys.exit()
coffee_machine_ip = '10.10.42.42'
@ -24,4 +23,4 @@ time.sleep(64)
# love the smell!
con.write("sys pour\n")
con.close()
con.close()

View File

@ -7,23 +7,22 @@ from time import strftime
import subprocess
# exit if sessions with my username are found
output = subprocess.check_output('who')
if 'my_username' in output:
if os.environ.get('USER') in subprocess.check_output('who'):
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')
TWILIO_AUTH_TOKEN = os.environ.get('TWILIO_AUTH_TOKEN')
# Phone numbers
my_number = '+xxx'
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)

View File

@ -19,4 +19,5 @@ 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\n"
"Please be careful next time.")

6
python/requirements.txt Normal file
View File

@ -0,0 +1,6 @@
gmail==0.5
httplib2==0.9.2
pytz==2015.7
six==1.10.0
twilio==4.9.2
wheel==0.24.0

View File

@ -8,22 +8,21 @@ import sys
from time import strftime
# exit if no sessions with my username are found
output = subprocess.check_output('who')
if 'my_username' not in output:
if os.environ.get('USER') in subprocess.check_output('who'):
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')
TWILIO_AUTH_TOKEN = os.environ.get('TWILIO_AUTH_TOKEN')
# Phone numbers
my_number = '+xxx'
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)