Skip to content

Instantly share code, notes, and snippets.

@HHRy
Created April 4, 2012 13:41
Show Gist options
  • Save HHRy/2301114 to your computer and use it in GitHub Desktop.
Save HHRy/2301114 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'webrick'
include WEBrick
dir = Dir::pwd
port = 12000 + (dir.hash % 1000)
puts "URL: http://#{Socket.gethostname}:#{port}"
s = HTTPServer.new(
:Port => port,
:DocumentRoot => dir
)
trap("INT"){ s.shutdown }
s.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment