Skip to content

Instantly share code, notes, and snippets.

@ik5
Created June 5, 2019 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ik5/4b02d3560f743bb89c0c15506daafd76 to your computer and use it in GitHub Desktop.
Save ik5/4b02d3560f743bb89c0c15506daafd76 to your computer and use it in GitHub Desktop.
short script to convert 32 bit integer to IPv4
#!/usr/bin/env ruby
require 'ipaddr'
ARGV.each do |int|
puts "#{int} = #{IPAddr.new(int.to_i, Socket::AF_INET).to_s}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment