Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am thomvh on github.
  • I am thvmh (https://keybase.io/thvmh) on keybase.
  • I have a public key ASBGnhRpFWBQU9ELhxCUcLgLBO78nfg7OQQQ4sjsi96FsAo

To claim this, I am signing this object:

#!/usr/bin/env bash
cdr2mask ()
{
# Number of args to shift, 255..255, first non-255 byte, zeroes
set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
[[ $1 -gt 1 ]] && shift ${1} || shift
echo "${1-0}.${2-0}.${3-0}.${4-0}"
}