Skip to content

Instantly share code, notes, and snippets.

View schlamar's full-sized avatar

Marc Schlaich schlamar

View GitHub Profile
import functools
import os
import socket
import time
import pyuv
def on_connection(message, handle, loop):
@schlamar
schlamar / conf.ini
Last active August 29, 2015 14:00
Click: override default options with config file(s)
[test]
count = 2
class Func(object):
_on_start = list()
_on_exit = list()
@classmethod
def register_on_start(cls, callback):
cls._on_start.append(callback)

Keybase proof

I hereby claim:

  • I am schlamar on github.
  • I am schlamar (https://keybase.io/schlamar) on keybase.
  • I have a public key whose fingerprint is CC55 6FAF D135 81EF 89F6 C671 E5AA 0181 2304 FE32

To claim this, I am signing this object:

0:000:x86> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
FAULTING_IP:
python27!PyEval_EvalFrameEx+273 [c:\build27\cpython\python\ceval.c @ 1057]
Dr. Memory version 1.8.0 build 8 built on Sep 9 2014 16:27:02
Dr. Memory results for pid 20340: "run-tests.exe"
Application cmdline: ""c:\Users\schlaich\Desktop\libuv\Debug\run-tests.exe" fs_stat_missing_path fs_stat_missing_path"
Recorded 108 suppression(s) from default C:\Users\schlaich\Desktop\Apps\DrMemory\bin\suppress-default.txt
===========================================================================
FINAL SUMMARY:
DUPLICATE ERROR COUNTS:
@schlamar
schlamar / gist:2652543
Created May 10, 2012 11:34
Find the root document of a given LaTeX file
import glob
import os
import re
MAIN_PATTERN = re.compile(r'\\begin{document}')
def is_main(tex_file):
with open(tex_file) as fobj:
for line in fobj:
@schlamar
schlamar / rc4.py
Created June 20, 2012 07:56
RC4 encryption
from hashlib import sha1
from itertools import islice, imap
from operator import xor, eq
DROP_N = 1536
# drop 1536 bytes is adviced in RFC 4345
# http://tools.ietf.org/html/rfc4345
@schlamar
schlamar / win32i18n.py
Last active October 13, 2015 03:08
I18N with Python on win32
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This is the modified module `libi18n.locale` from
https://www.mail-archive.com/python-list@python.org/msg188668.html.
It is fixed to distinguish internationalization and
localization. Reference: http://tinyurl.com/gnulocale
@schlamar
schlamar / gist:4345304
Created December 20, 2012 13:21
Safe pickle implementations
In [1]: %paste
import hmac
import hashlib
import cPickle
import cStringIO
key = '\xa7\x9ePS\xf5\x84\xce\xc8\xad\xcdfEb\x94\x10K\x9b\x12\xed'
dig_size = hashlib.sha1().digest_size