2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-22 18:37:10 +00:00
hacker-scripts/hangover.rb
Julio Ordonez Viales b9c6dad2c5 Update cron job to be executed on weekdays only
Updated the cron job so that it only executes the scripts on weekdays, that way there is not need to check for this condition inside the scripts, updated the scripts as well
2015-11-26 19:26:15 -06:00

35 lines
691 B
Ruby
Executable File

#!/usr/bin/env ruby
# Exit early if sessions with my username are found
exit if `who -q`.include? ENV['USER']
require 'dotenv'
require 'twilio-ruby'
Dotenv.load
TWILIO_ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID']
TWILIO_AUTH_TOKEN = ENV['TWILIO_AUTH_TOKEN']
@twilio = Twilio::REST::Client.new TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN
# Phone numbers
my_number = '+xxx'
number_of_boss = '+xxx'
excuse = [
'Locked out',
'Pipes broke',
'Food poisoning',
'Not feeling well'
].sample
# Send a text message
@twilio.messages.create(
from: my_number, to: number_of_boss,
body: "Gonna work from home. #{excuse}"
)
# Log this
puts "Message sent at: #{Time.now} | Excuse: #{excuse}"