Skip to content

Instantly share code, notes, and snippets.

eevee /
Created Mar 20, 2014
sqlalchemy declarative deferred attributes
class DeferredAttribute(object):
"""Minor hackery used with `deferred_attr_factory`."""
# Hopefully, more or less, self-explanatory. The __call__ is triggered at
# class creation time by declared_attr, which passes in the class itself,
# and then we do the "post" setup by listening for mapper_configured.
def __init__(self, generator):
self.generator = generator
self.done = False
def __call__(self, mapped_class):
View gist:6a0382cad057d9d1ca77
diff --git a/_mysql.c._mysql_ConnectionObject_get_character_set_info-refcount-errors.v2.html b/_mysql.c._mysql_ConnectionObject_get_character_set_info-refcount-errors.v2-new.html
index 27cd945..a4bc009 100644
--- a/_mysql.c._mysql_ConnectionObject_get_character_set_info-refcount-errors.v2.html
+++ b/_mysql.c._mysql_ConnectionObject_get_character_set_info-refcount-errors.v2-new.html
@@ -99,8 +99,8 @@ body {
background: #EBEBEB;
height: 100%;
- display: box;
- box-orient: vertical;
eevee / gist:c57e72e7f39a09c6f7d1
Created Jun 15, 2014
fontconfig to make source code pro fall back to monospace, not sans-serif
View gist:c57e72e7f39a09c6f7d1
<!-- define font family for some fonts fontconfig doesn't know about -->
<family>Source Code Pro</family>
<family>Droid Sans Mono</family>
eevee /
Created Jun 17, 2014
2to3 to rewrite testify assertions as plain asserts
from lib2to3.fixer_base import BaseFix
from lib2to3.fixer_util import Name
from lib2to3.main import StdoutRefactoringTool
from lib2to3.pytree import Node
import sys
class FixAssertEqual(BaseFix):
eevee /
Last active Aug 29, 2015
class WeakProperty:
"""Descriptor that automatically holds onto whatever it contains as a weak
reference. Reading this attribute will never raise `AttributeError`; if
the reference is broken or missing, you'll just get `None`.
The actual weak reference is stored in the object's `__dict__` under the
given name, so this acts as sort of a transparent proxy that lets you
forget you're dealing with weakrefs at all.
Of course, if you try to assign a value that can't be weak referenced,
eevee / disable_key_events.user.js
Last active Aug 29, 2015
userscript that blocks really really annoying js quirks. web devs should really do this crap themselves...
View disable_key_events.user.js
// ==UserScript==
// @name disable key events
// @namespace
// @description Prevents JS on the page from receiving keyup, keydown, or keypress. Fixes, e.g., Twitter's disabling of shortcuts until the page has loaded.
// @include*
// @version 1
// @grant none
// @run-at document-start
// ==/UserScript==
eevee / __output__
Created Jul 1, 2014
proof of concept of fancy-ass yaml schema (this code is a travesty)
View __output__
glaceon: !!python/object/apply:collections.OrderedDict
base-happiness: 70
capture-rate: 45
color: blue
hatch-counter: 0
identifier: glaceon
is-dimorphic: false
types: [ice]
View something.txt
this is an egregiously long line, meant only as a test of whether a gist will wrap long lines of plain text when it knows for sure that the language is plain english text
eevee / gist:8da6845886c524bc3e86
Created Jul 27, 2014
logging configuration brought to you by configparser
View gist:8da6845886c524bc3e86
# Begin logging configuration
keys = root, veekun_pokedex, sqlalchemy
keys = console
keys = generic
eevee / gist:78e52d55f171c78def0e
Created Aug 26, 2014
plumbum patch to fix TEE with a stderr redirect
View gist:78e52d55f171c78def0e
diff --git a/plumbum/commands/ b/plumbum/commands/
index 30f8dbf..1a5f8e6 100644
--- a/plumbum/commands/
+++ b/plumbum/commands/
@@ -151,12 +151,26 @@ class TEE(ExecutionModifier):
with cmd.bgrun(retcode=self.retcode, stdin=None, stdout=PIPE, stderr=PIPE) as p:
outbuf = []
errbuf = []
+ buffers = {}
+ tee_to = {}