Skip to content

Instantly share code, notes, and snippets.

View urigoren's full-sized avatar

Uri Goren urigoren

View GitHub Profile
@HugoPresents
HugoPresents / signal.py
Created November 13, 2013 13:28
limit execution time of a function call in Python
from __future__ import with_statement
import signal, time
from contextlib import contextmanager
def long_function_call():
while True:
if time.time() % 1 == 0:
print '*'
class TimeoutException(Exception): pass