2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-29 05:37:45 +00:00
hacker-scripts/fucking_coffee.rb
2015-11-25 21:46:26 +08:00

24 lines
526 B
Ruby
Executable File

#!/usr/bin/env ruby
# Skip on weekends
exit if Time.now.saturday? || Time.now.sunday?
# 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