diff --git a/perl5/fucking-coffee.pl b/perl5/fucking-coffee.pl new file mode 100644 index 0000000..a5d9726 --- /dev/null +++ b/perl5/fucking-coffee.pl @@ -0,0 +1,33 @@ +#!/usr/bin/env perl +use 5.10.0; +use strict; +use warnings; + +use DateTime; +use Net::Telnet (); + +# Skip on weekends +my $day_of_week = DateTime->now->day_of_week(); +exit if $day_of_week == 6 || $day_of_week == 7; + + +# Exit early if no sessions with my username are found +exit unless `who | grep $ENV{USER}`; + + +#my $coffee_machine_ip = '10.10.42.42'; +my $coffee_machine_ip = 'localhost'; +my $password = '1234'; +my $delay = 24; + + +my $con = Net::Telnet->new( + -host => $coffee_machine_ip, -timeout => 30 +); +$con->waitfor('/password: $/i'); +$con->print($password); +$con->cmd('sys brew'); +sleep $delay; +$con->cmd('sys pour'); +$con->close; + diff --git a/perl5/hangover.pl b/perl5/hangover.pl new file mode 100644 index 0000000..2b0a2b9 --- /dev/null +++ b/perl5/hangover.pl @@ -0,0 +1,46 @@ +#!/usr/bin/env perl +use 5.10.0; +use strict; +use warnings; + +use DateTime; +use SMS::Send::Twilio; + +# Skip on weekends +my $day_of_week = DateTime->now->day_of_week(); +exit if $day_of_week == 6 || $day_of_week == 7; + + +# Exit early if no sessions with my username are found +exit unless `who | grep $ENV{USER}`; + +# Phone numbers +my $MY_NUMBER = '+xxx'; +my $NUMBER_OF_BOSS = '+xxx'; + +my $EXCUSES = [ + 'Locked out', + 'Pipes broke', + 'Food poisoning', + 'Not feeling well', +]; + +my $rand = int(rand(scalar(@$EXCUSES))); + +my $random_excuse = $EXCUSES->[$rand]; +my $message = "Gonna work from home. ${random_excuse}"; + +# Send a text message +my $twilio = SMS::Send->new('Twilio', + _accountsid => $ENV{TWILIO_ACCOUNT_SID}, + _authtoken => $ENV{TWILIO_AUTH_TOKEN}, + _from => $MY_NUMBER, +); + +my $sent = $sender->send_sms( + text => $message, to => $NUMBER_OF_BOSS +); + +# Log errors +die "Failed to send SMS" if not $sent; + diff --git a/perl5/kumar-asshole.pl b/perl5/kumar-asshole.pl new file mode 100644 index 0000000..38dd381 --- /dev/null +++ b/perl5/kumar-asshole.pl @@ -0,0 +1,6 @@ +#!/usr/bin/env perl +use 5.10.0; +use strict; +use warnings; + + diff --git a/perl5/smack-my-bitch-up.pl b/perl5/smack-my-bitch-up.pl new file mode 100644 index 0000000..00f6f29 --- /dev/null +++ b/perl5/smack-my-bitch-up.pl @@ -0,0 +1,45 @@ +#!/usr/bin/env perl +use 5.10.0; +use strict; +use warnings; + +use DateTime; +use SMS::Send::Twilio; + +# Skip on weekends +my $day_of_week = DateTime->now->day_of_week(); +exit if $day_of_week == 6 || $day_of_week == 7; + + +# Exit early if no sessions with my username are found +exit unless `who | grep $ENV{USER}`; + +# Phone numbers +my $MY_NUMBER = '+xxx'; +my $HER_NUMBER = '+xxx'; + +my $REASONS = [ + 'Working hard', + 'Gotta ship this feature', + 'Someone fucked the system again', +]; + +my $rand = int(rand(scalar(@$REASONS))); + +my $random_reason = $REASONS->[$rand]; +my $message = "Late at work. ${random_reason}"; + +# Send a text message +my $twilio = SMS::Send->new('Twilio', + _accountsid => $ENV{TWILIO_ACCOUNT_SID}, + _authtoken => $ENV{TWILIO_AUTH_TOKEN}, + _from => $MY_NUMBER, +); + +my $sent = $sender->send_sms( + text => $message, to => $HER_NUMBER +); + +# Log errors +die "Failed to send SMS" if not $sent; +