Skip to content

Instantly share code, notes, and snippets.

@meise
Last active December 17, 2015 09:09
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save meise/5585311 to your computer and use it in GitHub Desktop.
Save meise/5585311 to your computer and use it in GitHub Desktop.
Script to login into dyndns.com automatically every week.
@weekly /usr/local/bin/ruby ~/dyndns_login.rb
#!/usr/bin/env ruby
# encoding: utf-8
require 'mechanize'
NAME = 'foo'
PASSWORD = 'baz'
agent = Mechanize.new
agent.user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0'
login_page = agent.get('https://account.dyn.com/entrance/')
result_login = login_page.form_with(action: '/entrance/') do |form|
form.username = NAME
form.password = PASSWORD
end.click_button
@jhenkins
Copy link

Really useful, thanks a mil!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment