Skip to content

Commit 66d694c

Browse files
committed
added hangout.R, improved smack-my-bitch-up.R
1 parent 533b8b4 commit 66d694c

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

R/hangover.R

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
library(httr)
2+
3+
today = Sys.Date()
4+
5+
# skip weekends
6+
if( weekdays(today) %in% c('Saturday','Sunday') ){
7+
quit()
8+
}
9+
10+
# exit if no sessions with my username are found
11+
output = system("who", intern = TRUE)
12+
if( !( grep('^my_user_name', output) ) ){
13+
quit()
14+
}
15+
16+
# returns 'None' if the key doesn't exist
17+
TWILIO_ACCOUNT_SID = Sys.getenv('TWILIO_ACCOUNT_SID')
18+
TWILIO_AUTH_TOKEN = Sys.getenv('TWILIO_AUTH_TOKEN')
19+
20+
# Phone numbers
21+
my_number = '+xxx'
22+
number_of_boss= '+xxx'
23+
24+
excuse = c(
25+
'Locked out',
26+
'Pipes broke',
27+
'Food poisoning',
28+
'Not feeling well'
29+
)
30+
31+
POST(paste("https://api.twilio.com/2010-04-01/Accounts/",TWILIO_ACCOUNT_SID,"/Messages.json",sep=""),
32+
body = list(From=my_number,To=number_of_boss,Body=paste("Gonna work from home. ", sample(excuse,1))),
33+
authenticate(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN) )
34+
35+
print( paste("Message sent at",Sys.time()) )

R/smack_my_bitch_up.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ reasons = c(
2828
)
2929

3030
POST(paste("https://api.twilio.com/2010-04-01/Accounts/",TWILIO_ACCOUNT_SID,"/Messages.json",sep=""),
31-
body = list(From=my_number,To=her_number,Body=sample(reasons,1) ),
31+
body = list(From=my_number,To=her_number,Body=paste("Late at work. ", sample(reasons,1))),
3232
authenticate(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN) )
3333

3434
print( paste("Message sent at",Sys.time()) )

0 commit comments

Comments
 (0)