2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-22 18:37:10 +00:00
hacker-scripts/fucking_coffee.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

21 lines
459 B
Ruby
Executable File

#!/usr/bin/env ruby
# Exit early if no sessions with my username are found
exit unless `who -q`.include? ENV['USER']
require 'net/telnet'
coffee_machine_ip = '10.10.42.42'
password = '1234'
password_prompt = 'Password: '
delay_before_brew = 17
delay = 24
sleep delay_before_brew
con = Net::Telnet.new('Host' => coffee_machine_ip)
con.cmd('String' => password, 'Match' => /#{password_prompt}/)
con.cmd('sys brew')
sleep delay
con.cmd('sys pour')
con.close