Skip to content

Instantly share code, notes, and snippets.

@granolocks
Created December 16, 2016 22:35
Show Gist options
  • Select an option

  • Save granolocks/ecf6c0efec7230f598566f4e9a9d830b to your computer and use it in GitHub Desktop.

Select an option

Save granolocks/ecf6c0efec7230f598566f4e9a9d830b to your computer and use it in GitHub Desktop.
require 'ipaddr'
require 'pry'
subt = '10.0.0.0/8'
sub_size = IPAddr.new(subt).to_range.count
t = Time.now.to_f
IPAddr.new(subt).to_range.include?('10.1.1.1')
t2 = Time.now.to_f
tdiff = t2 - t
big = 79_228_162_514_264_337_593_543_950_336
puts ((big/sub_size * tdiff) /60 /60/24/365).inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment