Skip to content

Instantly share code, notes, and snippets.

@c7h
c7h / gist:5003772
Created February 21, 2013 10:30
split string - fixed format
n = 8 #format
[line[i:i+n] for i in range(0, len(line), n)]
@c7h
c7h / gist:4730089
Created February 7, 2013 10:22
primitive debugging class as Singleton
'''
Created on Feb 6, 2013
@author: Christoph Gerneth
'''
import time
import inspect
class SingletonType(type):
@c7h
c7h / gist:4722329
Last active December 12, 2015 05:28
primitive built-in debugging w. execution time measurement.
import time
import inspect
start_time = time.time()
debuglevel = 2 #e.g: 0=no 1=error 2=info ...
def printdebug(level, message):
if debuglevel >= level:
curr_time = time.time() - start_time
caller = inspect.stack()[1][3]