Skip to content

Instantly share code, notes, and snippets.

View Torxed's full-sized avatar

Anton Hvornum Torxed

View GitHub Profile
@Torxed
Torxed / cidr_to_netmask.py
Created January 7, 2022 15:39
Converts a CIDR notation to netmask
def cidr_to_netmask(cidr :int, bitlen=32) -> str:
netmask = ''
while cidr > 8:
netmask += '255.'
cidr -= 8
netmask += str(2 ** cidr - 1) # math.log(128, 2)
return netmask + ('.0' * (3 - netmask.count('.') if bitlen == 32 else 7 - netmask.count('.')))
@Torxed
Torxed / postgresql_perf_test.md
Last active February 2, 2024 21:47
PostgreSQL index Vs partitioning Vs inheritance

All tests were performed in a docker container, using the image postgres:15.4. All tests used the same test data, but with scrambled hash values.

Only deviation from postgresql default startup parameters were:

-c work_mem=2048MB
-c maintenance_work_mem=2048MB
-c max_wal_size=8GB