Created
April 4, 2011 06:08
-
-
Save pokutuna/901198 to your computer and use it in GitHub Desktop.
gyazo through proxy
This file contains hidden or 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
*** script 2011-04-04 14:33:41.000000000 +0900 | |
--- script.proxy 2011-04-04 14:55:51.000000000 +0900 | |
*************** | |
*** 60,83 **** | |
'User-Agent' => UA | |
} | |
! Net::HTTP.start(HOST,80){|http| | |
res = http.post(CGI,data,header) | |
! url = res.response.to_ary[1] | |
! system "echo -n #{url} | pbcopy" | |
! system "open #{url}" | |
! # save id | |
! newid = res.response['X-Gyazo-Id'] | |
! if newid and newid != "" then | |
! if !File.exist?(File.dirname(idfile)) then | |
! Dir.mkdir(File.dirname(idfile)) | |
! end | |
! if File.exist?(idfile) then | |
! File.rename(idfile, idfile+Time.new.strftime("_%Y%m%d%H%M%S.bak")) | |
! end | |
! File.open(idfile,"w").print(newid) | |
! if File.exist?(old_idfile) then | |
! File.delete(old_idfile) | |
! end | |
end | |
! } | |
--- 60,91 ---- | |
'User-Agent' => UA | |
} | |
! begin | |
! http = Net::HTTP.new(HOST,80) | |
! http.open_timeout = 2 | |
res = http.post(CGI,data,header) | |
! rescue | |
! http = Net::HTTP.new(HOST,80,proxy_addr = 'proxy.hoge.jp', proxy_port = 8080) | |
! http.open_timeout = 2 | |
! res = http.post(CGI,data,header) | |
! end | |
! | |
! url = res.response.to_ary[1] | |
! system "echo -n #{url} | pbcopy" | |
! system "open #{url}" | |
! # save id | |
! newid = res.response['X-Gyazo-Id'] | |
! if newid and newid != "" then | |
! if !File.exist?(File.dirname(idfile)) then | |
! Dir.mkdir(File.dirname(idfile)) | |
end | |
! if File.exist?(idfile) then | |
! File.rename(idfile, idfile+Time.new.strftime("_%Y%m%d%H%M%S.bak")) | |
! end | |
! File.open(idfile,"w").print(newid) | |
! if File.exist?(old_idfile) then | |
! File.delete(old_idfile) | |
! end | |
! end | |
! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line38. proxy.hoge.jpを修正してつかう