Last active
August 29, 2015 14:21
-
-
Save urara/c0bfbf71a85d56603bc6 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
require 'webrick' | |
h,s,o={},WEBrick::HTTPServer.new(:Port=>3333),[*?a..?z] | |
s.mount_proc('/'){|q,b|t,r=h[q.unparsed_uri[1..-1]],((0..4).map{o[rand(26)]}.*'') | |
q.request_method=='GET'?b.set_redirect(WEBrick::HTTPStatus::Found,t):(h[r]=q.body)&&b.body="http://localhost:3333/#{r}"} | |
s.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment