Skip to content

Instantly share code, notes, and snippets.

View fennecinspace's full-sized avatar
🐧

Mohamed Benkedadra fennecinspace

🐧
View GitHub Profile
@fennecinspace
fennecinspace / timeout.py
Created December 31, 2018 00:30
Timeout Thread
import threading
class TimedThread(threading.Thread):
def __init__(self, fct, *args , timeout = 30, timeout_exception = True, **kwargs):
super().__init__(target = fct, args = args, kwargs = kwargs)
self.fct = fct
self.result = None
self.timeout = timeout
self.timeout_exception = timeout_exception
@fennecinspace
fennecinspace / .bashrc.virtualenvwrapper
Created May 30, 2018 01:31
Load virtualenvwrapper on demand to speed up your shell
#### in .bashrc.virtualenvwrapper
# Dynamically load virtualenvwrapper functions to reduce shell startup
# time.
#
# Copyright 2012 Aron Griffis <aron@arongriffis.com>
# Released under the GNU GPL v3
#######################################################################
# Python virtualenvwrapper loads really slowly, so load it on demand.