forked from purefan/hacker-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
smack_my_bitch_up.rb
executable file
·43 lines (30 loc) · 958 Bytes
/
smack_my_bitch_up.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env ruby
# Skip on weekends
exit if Time.now.saturday? || Time.now.sunday?
log_file_name = File.dirname(__FILE__) + '/logs/smack_my_bitch_up.txt'
# Be sure that logs dir always exists
Dir.mkdir('logs') unless File.exists?(log_file_name)
LOG_FILE = File.open(log_file_name, 'a+')
# Exit early if no sessions with my_username are found
exit if `who`[/my_username/].nil?
require 'dotenv'
require 'twilio-ruby'
Dotenv.load
TWILIO_ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
TWILIO_AUTH_TOKEN = ENV['TWILIO_AUTH_TOKEN']
@twilio = Twilio::REST::Client.new TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN
# Phone numbers
my_number = '+xxx'
her_number = '+xxx'
reasons = [
'Working hard',
'Gotta ship this feature',
'Someone fucked the system again'
]
# Send a text message
@twilio.messages.create(
from: my_number, to: her_number, body: 'Late at work. ' + reasons.sample
)
# Log this
LOG_FILE.puts("Message sent at: #{Time.now}")
LOG_FILE.close