Skip to content

Instantly share code, notes, and snippets.

View dest81's full-sized avatar

Ihor Marhitych dest81

  • RIPE NCC
  • Almere, Netherlands
View GitHub Profile
@Akendo
Akendo / netmask_to_cidr.py
Created May 24, 2017 11:23
Converting a netmask to CIDR with vanilla python
def netmask_to_cidr(m_netmask):
return(sum([ bin(int(bits)).count("1") for bits in m_netmask.split(".") ]))