Skip to content

Instantly share code, notes, and snippets.

Theron Luhn luhn

Block or report user

Report or block luhn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am luhn on github.
  • I am luhn ( on keybase.
  • I have a public key whose fingerprint is 8E57 AB5E 6FB9 441F 92C4 C3D8 9234 9742 8E86 184E

To claim this, I am signing this object:

luhn / docker-compose.yml
Last active Jun 11, 2019
Fluentd Keepalive Bug
View docker-compose.yml
version: "3.7"
context: .
dockerfile: src.Dockerfile
import sys
import inspect
def wrap(func):
return func
def attach():
# Interfaces
class IUserIdentity:
userid = None
class IIdentityPolicy:
def __call__(request):
""" Return the claimed identity of the user associated with the given
luhn / data.txt
Last active Apr 28, 2017
InfluxDB issue #8164
View data.txt
mymeasure,context=baz,view=3 duration=0.743992881887 1493397808910022759
mymeasure,context=foo,view=4 duration=0.340297307361 1493397809442500681
mymeasure,context=bar,view=2 duration=0.351295066647 1493397809994147837
mymeasure,context=bar,view=1 duration=0.485869769473 1493397810730819905
mymeasure,context=bar,view=1 duration=0.104839181702 1493397810993959410
luhn /
Created Apr 12, 2017
URL traversal sitemap
Inspect a Pyramid app using URL traversal and construct URLs for all the views.
def get_resources(self, root):
resources = {
type(root): root,
for resource in root.values():
luhn /
Created Mar 21, 2017
SQLAlchemy query counter
from sqlalchemy import engine_from_config, event
from sqlalchemy.orm import sessionmaker
def query_count_hook(
conn, cursor, statement, parameters, context, executemany,
info =
info['query_count'] = info.get('query_count', 0) + 1
luhn /
Last active Jan 15, 2017
Memoize method decorator
import functools
class memoize_method:
A decorator to memoize a method. The cache is stored as a dictionary
inside the object.
This functionality is similar to stdlib's :func:`functools.lru_cache`.
When using lru_cache on a method, the object will be used as part of the
luhn /
Last active Jan 2, 2020
PostgreSQL memory leak

This was performed on Ubuntu 14.04 with a fresh install of PostgreSQL 9.3.14 directly from the official Postgres apt repo. It only works if the query planner chooses the attached plan (with HashAggregate).

Create and populate a new database:

psql -U postgres -c "create database test;"
psql -U postgres test < populate.sql

Open a connection to the database and execute query.sql. The Postgres worker memory usage will rise approximately 50MB and won't be released until the connection is closed.

luhn /
Last active Nov 25, 2019
An AWS Lambda function to delete old AMIs.
Code adapted from and inspired by
import os
import re
from datetime import datetime, timedelta
import boto3
You can’t perform that action at this time.