Skip to content

Instantly share code, notes, and snippets.

View vadimg's full-sized avatar

Vadim Graboys vadimg

View GitHub Profile
vadimg /
Created June 9, 2012 22:16
python timeout decorator
import threading
import functools
import logging
def timeout(duration, default=None):
def decorator(func):
class InterruptableThread(threading.Thread):
def __init__(self, args, kwargs):
self.args = args
vadimg / gist:3344325
Created August 13, 2012 21:49
nginx access log GET request extractor
#!/usr/bin/env python
import sys
import re
def iterpings(filename):
for line in open(filename):
m ='] GET (.*?) ', line)
if m is not None: