Skip to content

Instantly share code, notes, and snippets.

View Midnighter's full-sized avatar

Moritz E. Beber Midnighter

View GitHub Profile
@Midnighter
Midnighter / watch_this.py
Last active August 7, 2020 19:20 — forked from mikeckennedy/watch_this.py
Add C# += / -= event subscriptions to Python using the Events package
import functools
from events import Events # Note you must pip install events
class set_event:
"""Define a class-based setter method decorator."""
def __init__(self, func, event):
super().__init__()
@Midnighter
Midnighter / postmkvirtualenv
Last active January 25, 2017 07:26 — forked from jlesquembre/postmkvirtualenv
link PyQt components into new virtualenv after creation (`postmkvirtualenv`)
#!/usr/bin/env bash
# This hook is run after a new virtualenv is activated.
#set -e # abort after any errors
#set -u # exit after accessing an undefined variable
libs=(PyQt4 sip.so sipconfig.py)
python_version=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))")
var=( $(which -a ${python_version}) )