2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-23 10:57:13 +00:00

added hangout.R, improved smack-my-bitch-up.R

This commit is contained in:
matthew-z 2016-01-22 05:11:13 +09:00
parent 533b8b489a
commit 66d694ce87
2 changed files with 36 additions and 1 deletions

35
R/hangover.R Normal file
View File

@ -0,0 +1,35 @@
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'
number_of_boss= '+xxx'
excuse = c(
'Locked out',
'Pipes broke',
'Food poisoning',
'Not feeling well'
)
POST(paste("https://api.twilio.com/2010-04-01/Accounts/",TWILIO_ACCOUNT_SID,"/Messages.json",sep=""),
body = list(From=my_number,To=number_of_boss,Body=paste("Gonna work from home. ", sample(excuse,1))),
authenticate(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN) )
print( paste("Message sent at",Sys.time()) )

View File

@ -28,7 +28,7 @@ reasons = c(
) )
POST(paste("https://api.twilio.com/2010-04-01/Accounts/",TWILIO_ACCOUNT_SID,"/Messages.json",sep=""), 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=sample(reasons,1) ), body = list(From=my_number,To=her_number,Body=paste("Late at work. ", sample(reasons,1))),
authenticate(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN) ) authenticate(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN) )
print( paste("Message sent at",Sys.time()) ) print( paste("Message sent at",Sys.time()) )