Created
September 14, 2019 19:58
-
-
Save almokhtarbr/f871f719e23595cb88111052617526de 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 | |
# Skip on weekends | |
exit if Time.now.saturday? || Time.now.sunday? | |
# Exit early if no sessions with my_username are found | |
exit if `who`[/my_username/].nil? | |
require 'net/telnet' | |
coffee_machine_ip = '10.10.42.42' | |
password = '1234' | |
password_prompt = 'Password: ' | |
con = Net::Telnet.new('Host' => coffee_machine_ip) | |
con.cmd('String' => password, 'Match' => /#{password_prompt}/) | |
con.cmd('sys brew') | |
sleep 64 | |
con.cmd('sys pour') | |
con.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment