public
Last active

  • Download Gist
ccc_flag.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.