Skip to content

Instantly share code, notes, and snippets.

@hughdbrown
hughdbrown / count_living_per_year_perf.py
Last active April 20, 2023 12:51 — forked from dorianturba/count_living_per_year_perf.py
Count how many people are alive per year, based on their birthyear and deathyear, aims for performances.
#!/usr/bin/env python3
import collections
import itertools
import random
import sys
import timeit
pop = [
(b := random.randint(1900, 2000), random.randint(b + 1, b + 100))
from scapy.all import *
AMAZON_TABLE = {
'74:75:48:5f:99:30': 'Huggies,
'10:ae:60:00:4d:f3': 'Elements',
}
def is_arp(arp):
return (arp.op, arp.prc) == (1, '0.0.0.0')
@hughdbrown
hughdbrown / pgsnap.py
Last active August 29, 2015 14:13 — forked from alq666/pgsnap.py
#!/usr/bin/env python
import os
import sys
import time
import subprocess
import urllib2
import boto