Skip to content

Instantly share code, notes, and snippets.

@almokhtarbr
Created September 14, 2019 19:58
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 almokhtarbr/f871f719e23595cb88111052617526de to your computer and use it in GitHub Desktop.
Save almokhtarbr/f871f719e23595cb88111052617526de to your computer and use it in GitHub Desktop.
#!/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