Skip to content

Instantly share code, notes, and snippets.

View bturnip's full-sized avatar

bturnip bturnip

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(".") ]))