forked from NARKOZ/hacker-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmack_my_bitch_up.R
34 lines (26 loc) · 891 Bytes
/
smack_my_bitch_up.R
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
library(httr)
today = Sys.Date()
# skip weekends
if( weekdays(today) %in% c('Saturday','Sunday') ){
quit()
}
# exit if no sessions with my username are found
output = system("who", intern = TRUE)
if( !( grep('^my_user_name', output) ) ){
quit()
}
# returns 'None' if the key doesn't exist
TWILIO_ACCOUNT_SID = Sys.getenv('TWILIO_ACCOUNT_SID')
TWILIO_AUTH_TOKEN = Sys.getenv('TWILIO_AUTH_TOKEN')
# Phone numbers
my_number = '+xxx'
her_number = '+xxx'
reasons = c(
'Working hard',
'Gotta ship this feature',
'Someone fucked the system again'
)
POST(paste("https://api.twilio.com/2010-04-01/Accounts/",TWILIO_ACCOUNT_SID,"/Messages.json",sep=""),
body = list(From=my_number,To=her_number,Body=paste("Late at work. ", sample(reasons,1))),
authenticate(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN) )
print( paste("Message sent at",Sys.time()) )