Skip to content

Instantly share code, notes, and snippets.

@berngp
Created April 2, 2013 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save berngp/5293814 to your computer and use it in GitHub Desktop.
Save berngp/5293814 to your computer and use it in GitHub Desktop.
IPv4 to Numeric Value
"192.168.1.1".split('.').reverse.map(_.toLong).zipWithIndex.map(t => (t._1 << (t._2 * 8L))).reduce(_ | _)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment