Skip to content

Instantly share code, notes, and snippets.

@mitkot
Created February 3, 2016 04:59
Show Gist options
  • Save mitkot/1c6050f7b1e6e31f8dda to your computer and use it in GitHub Desktop.
Save mitkot/1c6050f7b1e6e31f8dda to your computer and use it in GitHub Desktop.
Get a cidr range
#!/usr/bin/env ruby
require 'ipaddr'
begin
puts IPAddr.new(ARGV[0]).to_range.to_s.gsub(/\.\./,"-")
rescue
puts 'i.e.) $ cidr 192.168.1.0/24'
end
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment