Skip to content

Instantly share code, notes, and snippets.

Created January 6, 2012 04:20
Show Gist options
  • Save anonymous/1568959 to your computer and use it in GitHub Desktop.
Save anonymous/1568959 to your computer and use it in GitHub Desktop.
require 'ipaddr'
ip = IPAddr.new "140.211.166.66"
p 66.to_s(16) #=> "42"
p ip.hton #=> "\x8C\xD3\xA6B"
# Expected "\x8C\xD3\xA6\x42"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment