Skip to content

Instantly share code, notes, and snippets.

@mertozsaydi
Created June 6, 2017 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mertozsaydi/aadba70282664bc54faf389f5de77fe4 to your computer and use it in GitHub Desktop.
Save mertozsaydi/aadba70282664bc54faf389f5de77fe4 to your computer and use it in GitHub Desktop.
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment