Created
August 13, 2009 21:24
-
-
Save alx/167462 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/ruby | |
require 'net/http' | |
http = Net::HTTP.new('ddc.har2009.info', 8080) | |
path = '/DDCAnimationServer/index.ftl' | |
index = 150 | |
class Flag | |
attr_accessor :reset, :flash, :flag | |
def initialize | |
@reset = " | |
C ALL #000000 | |
" | |
@wait = " | |
W 50000 | |
" | |
@flash = " | |
W 200 | |
C 1 #EFFFF9 | |
C 2 #EFFFF9 | |
C 3 #EFFFF9 | |
W 200 | |
C 1 #000000 | |
C 2 #000000 | |
C 3 #000000 | |
" | |
end | |
def wait | |
" | |
W #{rand(50000)} | |
" | |
end | |
def sequence | |
@reset + | |
@flag + | |
wait + | |
@switch + | |
@switch + | |
@switch + | |
@switch + | |
@switch + | |
@switch + | |
@switch + | |
@flash + | |
@flash + | |
@flash + | |
@switch + | |
wait | |
end | |
end | |
class FrenchFlag < Flag | |
def initialize | |
@flag = " | |
C 1 #002F67 | |
W 2000 | |
C 2 #EFFFF9 | |
W 2000 | |
C 3 #FF0000 | |
" | |
@switch = " | |
C ALL #000000 | |
W 200 | |
C 1 #002F67 | |
C 2 #EFFFF9 | |
C 3 #FF0000 | |
" | |
super | |
end | |
end | |
# --------- | |
# French Flag: | |
# | |
# * Reset | |
# * Display french for 50 seconds | |
# * Display 7 french-flag-flash | |
# * Display french for 50 seconds | |
# | |
french_flag = FrenchFlag.new | |
while(true) do | |
name = URI.escape("French Village - Second Night") | |
data = "uploadname=#{name}&uploadanim=#{french_flag.sequence}&uploadhash=0" | |
headers = { | |
'Referer' => 'http://ddc.har2009.info:8080/DDCAnimationServer/index.ftl#uploadresult', | |
'Content-Type' => 'application/x-www-form-urlencoded' | |
} | |
resp, data = http.post(path, data, headers) | |
p "Lvl. #{index} At Random: #{resp.code}" | |
index += 1 | |
sleep 10 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment