Skip to content

Instantly share code, notes, and snippets.

novocaine /
Last active May 29, 2020 14:50
Shell script to build and install Quake 3 Arena Demo using ioquake on OS X x86_64
set -ex
mkdir q3a
cd q3a
# checkout and build for x86_64
git clone
cd ioq3
View gist:65136d564d1e611933590a28cfc670fc
### Keybase proof
I hereby claim:
* I am novocaine on github.
* I am jwsalter ( on keybase.
* I have a public key ASDbvIbtNix_X1trzmyBl2loflAqd9dEKSuUOyG5_uxSgQo
To claim this, I am signing this object:
novocaine / gist:381835576664894019a8
Created June 29, 2015 10:33
lib2to3 fixer for changing division operator into div()
View gist:381835576664894019a8
"""Fixer that replaces / with div() function"""
from ..fixer_base import BaseFix
from ..fixer_util import Call, Name, Node, Comma
class FixDivision(BaseFix):
PATTERN = "term< any+ '/' any+ >"
def transform(self, node, results):
novocaine / find_text_opens
Last active August 29, 2015 14:22
Using redbaron to find all open()s in text mode so we can review them for python 3
View find_text_opens
from redbaron import RedBaron
import os
import sys
import io
def is_bad_open(node):
# must be function invocation (not method invocation)
if node.parent.type != 'atomtrailers':
return False
novocaine / find_cmp_sorts
Created June 2, 2015 12:30
Using redbaron to find sort and sorted using cmp so we can convert them to key for python 3
View find_cmp_sorts
from redbaron import RedBaron
import os
import sys
import io
def is_bad_sort(node):
# must be .method invocation
if node.parent.type != 'atomtrailers':
return False
View gist:cee3f476a6f9c7535c34
test_BitSTring (tests.test_asn1.ASN1TestCase) ... ok
test_Integer (tests.test_asn1.ASN1TestCase) ... ok
test_Object (tests.test_asn1.ASN1TestCase) ... ok
test_String (tests.test_asn1.ASN1TestCase) ... DEBUG:__init__:data = None
DEBUG:__init__:data = None
novocaine / gist:09d5c00e67fd0aa13cfc
Last active August 29, 2015 14:14
fix libxml2 2.9.2 python 3 on windows
View gist:09d5c00e67fd0aa13cfc
diff -ur libxml2-2.9.2.old/python/ libxml2-2.9.2/python/
--- libxml2-2.9.2.old/python/ 2014-10-16 09:35:22.000000000 +0100
+++ libxml2-2.9.2/python/ 2015-01-22 12:23:18.804795900 +0000
@@ -123,7 +123,7 @@
if missing("libxslt-py.c") or missing(""):
- if missing("") or missing("libxslt-api.xml"):
+ if missing("") or missing("libxslt-python-api.xml"):
print("libxslt stub generator not found, libxslt not built")
novocaine / gist:ae657bdbf0f25b81e52b
Last active August 29, 2015 14:14
patch libxslt 1.1.28 bindings to python 3 and fix on windows
View gist:ae657bdbf0f25b81e52b
diff -ur libxslt-1.1.28.old/libxslt/xsltlocale.h libxslt-1.1.28/libxslt/xsltlocale.h
--- libxslt-1.1.28.old/libxslt/xsltlocale.h 2012-09-04 16:26:24.000000000 +0100
+++ libxslt-1.1.28/libxslt/xsltlocale.h 2015-01-22 15:57:16.524757800 +0000
@@ -12,6 +12,7 @@
#define __XML_XSLTLOCALE_H__
#include <libxml/xmlstring.h>
+#include "xsltexports.h"
novocaine / gist:5191558
Created March 18, 2013 22:44
decode content disposition header using utf8 for ios, which by default interprets the header as ASCII
View gist:5191558
- (NSString*)getFilenameFromContentDisposition:(NSString*)contentDisposition {
// filename is optionally quoted.
// note that if the disposition indicates the asterisk
// notation - filename*= - this indicates an explicit encoding;
// in that case we will drop through to just using the responses
// suggestedFilename (don't want to deal with the complexity,
// hopefully the system has reasonably behaviour when the
// encoding is actually unambiguous)
NSString* suggestedFilename = nil;
novocaine / TouchTimerWorkaround.js
Created December 6, 2012 05:00 — forked from jpattishall/TouchTimerWorkaround.js
setTimeout workaround for iPad and iOS6
View TouchTimerWorkaround.js
Workaround for iOS 6 setTimeout bug using requestAnimationFrame to simulate timers during Touch/Gesture-based events
Author: Jack Pattishall (
This code is free to use anywhere (MIT, etc.)
Usage: Pass TRUE as the final argument for setTimeout or setInterval.
setTimeout(func, 1000) // uses native code
setTimeout(func, 1000, true) // uses workaround