Created
June 6, 2017 16:13
-
-
Save mertozsaydi/aadba70282664bc54faf389f5de77fe4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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