From 09b10775ba8a5bb10c461befa7460c13e247d677 Mon Sep 17 00:00:00 2001 From: Samir Madhavan Date: Fri, 27 Nov 2015 16:18:22 +0530 Subject: [PATCH 1/5] Created starting point for kumar_asshole --- R/kumar_asshole.R | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 R/kumar_asshole.R diff --git a/R/kumar_asshole.R b/R/kumar_asshole.R new file mode 100644 index 0000000..e69de29 From 40711e41de2ff7d2220200bff52327204d19b307 Mon Sep 17 00:00:00 2001 From: Samir Madhavan Date: Sat, 28 Nov 2015 11:55:01 +0530 Subject: [PATCH 2/5] Going to do smack my bitch up instead of kumar asshole for now --- R/{kumar_asshole.R => smack_my_bitch_up.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename R/{kumar_asshole.R => smack_my_bitch_up.py} (100%) diff --git a/R/kumar_asshole.R b/R/smack_my_bitch_up.py similarity index 100% rename from R/kumar_asshole.R rename to R/smack_my_bitch_up.py From 83e67f3fb966fe3f89aef653436d53eb1fb07fe9 Mon Sep 17 00:00:00 2001 From: Samir Madhavan Date: Sat, 28 Nov 2015 11:57:56 +0530 Subject: [PATCH 3/5] Corrected the name --- R/smack_my_bitch_up.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 R/smack_my_bitch_up.py diff --git a/R/smack_my_bitch_up.py b/R/smack_my_bitch_up.py deleted file mode 100644 index e69de29..0000000 From 5082dc945fa4c46018dc6d43c031bf99dd611558 Mon Sep 17 00:00:00 2001 From: Samir Madhavan Date: Sat, 28 Nov 2015 12:56:16 +0530 Subject: [PATCH 4/5] Need to add the twilio part of the code --- R/smack_my_bitch_up.R | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 R/smack_my_bitch_up.R diff --git a/R/smack_my_bitch_up.R b/R/smack_my_bitch_up.R new file mode 100644 index 0000000..b16d7e2 --- /dev/null +++ b/R/smack_my_bitch_up.R @@ -0,0 +1,29 @@ + + +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' +) + From d9ac2b7ca2ef9484154bca0c50bf3cb6c8a8ae1f Mon Sep 17 00:00:00 2001 From: Samir Madhavan Date: Sat, 28 Nov 2015 14:12:07 +0530 Subject: [PATCH 5/5] R version of smack my bitch is ready --- R/smack_my_bitch_up.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/smack_my_bitch_up.R b/R/smack_my_bitch_up.R index b16d7e2..823fce3 100644 --- a/R/smack_my_bitch_up.R +++ b/R/smack_my_bitch_up.R @@ -1,4 +1,4 @@ - +library(httr) today = Sys.Date() @@ -27,3 +27,8 @@ reasons = c( '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=sample(reasons,1) ), + authenticate(TWILIO_ACCOUNT_SID,TWILIO_AUTH_TOKEN) ) + +print( paste("Message sent at",Sys.time()) )