Skip to content

Instantly share code, notes, and snippets.

@jerefrer
Created October 18, 2013 10:13
Show Gist options
  • Save jerefrer/7039436 to your computer and use it in GitHub Desktop.
Save jerefrer/7039436 to your computer and use it in GitHub Desktop.
Ruby script to fix webrick issues when running it inside a VM and trying to access it from outside.
#!/usr/bin/env ruby
require 'fileutils'
webricks = Dir.glob(File.join("/home/#{ENV['USER']}/.rvm/rubies/**/webrick/config.rb"))
webricks.each do |webrick|
FileUtils.cp webrick, "#{webrick}.bak"
output = File.read(webrick).gsub('DoNotReverseLookup => nil', 'DoNotReverseLookup => true')
File.open(webrick, "w") {|file| file.puts output}
end
`sudo /etc/init.d/avahi-daemon stop`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment