Skip to content

Instantly share code, notes, and snippets.

@wildjcrt
Created August 6, 2013 16:18
Show Gist options
  • Save wildjcrt/6166024 to your computer and use it in GitHub Desktop.
Save wildjcrt/6166024 to your computer and use it in GitHub Desktop.
自動檢查 registrano 報名資訊,讓我在 10 小時前成功加入台灣零時政府第壹次公地放領黑客松的小程式。
# encoding: utf-8
# $ ruby check_bot.rb
require 'open-uri'
@url = 'https://registrano.com/events/handlino-new-opening/registrations/new'
def check?
open(@url) do |f|
f.each_line do |line|
if line.include? '抱歉,目前本活動已額滿。'
puts '抱歉,目前本活動已額滿。'
return false
end
end
end
end
while(1) do
system("open #{@url}") if check?
sleep 60
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment