Skip to content

Instantly share code, notes, and snippets.

View wbolster's full-sized avatar
🎹
🦄

wouter bolsterlee wbolster

🎹
🦄
View GitHub Profile
@wbolster
wbolster / keybase.md
Created February 26, 2015 11:02
keybase.md

Keybase proof

I hereby claim:

  • I am wbolster on github.
  • I am wbolster (https://keybase.io/wbolster) on keybase.
  • I have a public key whose fingerprint is 76E0 AFCD 0A48 33D2 5EB9 F423 FFAF 60EF 8CDD 9583

To claim this, I am signing this object:

@wbolster
wbolster / qualname
Last active August 29, 2015 14:18
Python module providing a __qualname__ alternative for Python 2
Moved to https://github.com/wbolster/qualname
@wbolster
wbolster / piano.png
Last active May 13, 2017 20:06
piano keyboard using unicode block drawing characters
piano.png
import collections
class attrify:
def __init__(self, d):
object.__setattr__(self, 'd', d)
def __getattribute__(self, name):
if name == '__dict__':
return object.__getattribute__(self, 'd')
@wbolster
wbolster / happybase_test_put_counter.py
Created June 1, 2012 19:26 — forked from srs81/happybase_test_put_counter.py
Python code to test HappyBase library (HBase), and counter and put speeds
#!/usr/bin/env python
import logging
import random
import time
import happybase
logging.basicConfig()
logger = logging.getLogger()
@wbolster
wbolster / toggle-grayscale
Created December 1, 2014 12:51
AppleScript to toggle grayscale display (for Mac OSX 10.10 Yosemite)
tell application "System Preferences"
activate
set current pane to pane "Accessibility"
end tell
tell application "System Events"
tell process "System Preferences"
click checkbox "Use grayscale" of window 1
end tell
end tell
@wbolster
wbolster / autoinject.py
Created October 4, 2020 19:41
Dirty tricks to automatically inject keyword arguments from the caller's scope
"""
Dirty tricks to automatically inject keyword arguments from the caller's scope.
"""
import functools
import inspect
import sys
def auto_inject_kwargs(f):
@wbolster
wbolster / shuffledots.py
Last active November 22, 2022 09:30
shuffle dots: text manıṗulatıȯn tool to move dots above letters to another ṗosıṫıon
"""
Text manıṗulatıȯn tool to move dots above letters to another ṗosıṫıon.
"""
import operator
import random
import re
import unicodedata
import sys
@wbolster
wbolster / stacked_decorator.py
Last active January 7, 2023 18:06
python joke code abusing the @ operator to ‘extend’ decorator syntax
"""
This is joke^Wenterprise code ab^H^Husing the ‘@’ operator to simulate
applying multiple decorators on a single line of code.
"""
# © 2022 wouter bolsterlee, licensed under SPDX BSD-3-Clause
import functools
# helper class and the magic ‘@stacked’ decorator itself
#!/usr/bin/env python
from __future__ import print_function
try:
# Python 3
from functools import reduce
STRING_TYPE = str
except ImportError:
# Python 2