Skip to content

Instantly share code, notes, and snippets.

@marcusvmsa
Created February 21, 2011 13:19
Show Gist options
  • Select an option

  • Save marcusvmsa/837043 to your computer and use it in GitHub Desktop.

Select an option

Save marcusvmsa/837043 to your computer and use it in GitHub Desktop.
Get local IP with Ruby
require "socket"
local_ip = UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment