Skip to content

Instantly share code, notes, and snippets.

View daanzu's full-sized avatar

David Zurow daanzu

View GitHub Profile
@daanzu
daanzu / Python win32api virtual keystroke example
Last active December 1, 2015 04:03 — forked from chriskiehl/Vitual keystroke example
Python win32api simple Vitual keystroke example
#Giant dictonary to hold key name and VK value
VK_CODE = {'backspace':0x08,
'tab':0x09,
'clear':0x0C,
'enter':0x0D,
'shift':0x10,
'ctrl':0x11,
'alt':0x12,
'pause':0x13,
'caps_lock':0x14,
@daanzu
daanzu / throttle.py
Last active December 21, 2015 03:08 — forked from ChrisTM/throttle.py
Python decorator for throttling and ramping function calls.
from datetime import datetime, timedelta
from functools import wraps
class throttle(object):
"""
Decorator that prevents a function from being called more than once every
time period.
To create a function that cannot be called more than once a minute:
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'