Skip to content

Instantly share code, notes, and snippets.

View georgevreilly's full-sized avatar

George V. Reilly georgevreilly

View GitHub Profile
@georgevreilly
georgevreilly / Sample\ of\ Emacs.txt.gz
Created June 9, 2013 21:51
Stack traces taken for https://github.com/jorgenschaefer/elpy/issues/96, using the "Sample Process" button in OS X's Activity Monitor. Both Emacs.app and the child Python process were running at 100% CPU.
This file has been truncated, but you can view the full file.
H4sICE/3tFEAA1NhbXBsZSBvZiBFbWFjcy50eHQA7P1bbyNZviD2vvenUAF+mEHn
1IgXiVK9DWzvAwPnjH08Ax8DhiFQEtlV3tmZZWVWbfegP/wRUxdGkBS5IhiXdfn9
Hmb3nt2pWBHxv6y1Ikj+l+Xff//825e/Xfz+9PVh9e3bxWQyv5lcrL8+Xcwuvq0e
vn55/Hbxb799//VicvH33z5//u3l/+/i6/ri6Y8vF99/+/vq4n71/d9Wqy8X3zZ/
a/XtL//l7W8+fN38f3xfPX56+/Ob/99v//j7/dfP337++ee//Kcvy8//+Pbbt82f
+/b2r/7Hvy8fvv2HyeXPi4t/9/tvjy8j+vcXqz9XT/+oj+Iv/8vLX/3l4k3l3/4f
P/7d//mX/2X5/dftf+HZf/xPvz8f6GH5/bevX779xx//4ufl77//x//+65fvqy/f
v/3H/8/y4X/+L/9x+6f+8v/+uny8+E+Pj09vx7r8fyaXr/7yPz0+/6Pf1r+tnl6P
8vXpbz//7csfP//4A3/531ZP354PtB3B6//HxXT+8+zi393+fPnv//Lff31cXfzX
f/y+evtv/e831//hen7x7/7z8yD/XP3753N4ej7IxfZ0Py//+PLw6+PF/zFb3Pyf
@georgevreilly
georgevreilly / sessionrecorder.py
Last active June 15, 2023 14:45
WSGI Middleware to record Request and Response data
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
WSGI middleware to record requests and responses.
"""
from __future__ import print_function, unicode_literals
import logging
@georgevreilly
georgevreilly / 01.configure
Created October 1, 2013 20:01
Wireshark 1.10.2 failing to build on OS X 10.7.5
checking build system type... x86_64-apple-darwin11.4.2
checking host system type... x86_64-apple-darwin11.4.2
checking target system type... x86_64-apple-darwin11.4.2
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
@georgevreilly
georgevreilly / cloudflare.js
Last active December 25, 2015 08:19
All pages on http://my.cozi.com/ cause CPU utilization to spike to 100%, thanks to an endless stream of MessageEvents delivered by cloudflare.min.js. When CloudFlare acceleration is disabled, the problem goes away. The problem reproes in Chrome and Firefox on Windows and Mac; likely on other browsers too. I hacked a local copy of cloudflare.js t…
/* This is cloudflare.min.js, beautified, with minor logging changes in the addEventListener callback */
/*! CloudFlareJS-0.1.5 Wed Oct 09 2013 14:04:33
*/
CF_msg_buffer = [];
! function (a, b) {
function c(a) {
if (!(this instanceof c)) return new c(a);
if (!a || !m.isElement(a)) throw new Error("A DOM element reference is required");
return this.element = a, this.tokens = a.classList, this
@georgevreilly
georgevreilly / mysql-python-virtualenv.bat
Created January 15, 2014 21:24
Copy MySQL-Python into a Windows virtualenv.
@REM adapted from http://stackoverflow.com/a/20092578
if ["%VIRTUAL_ENV%"]==[""] echo Must run under a Virtualenv && goto :error
set SRCDIR=c:\Python27\Lib\site-packages
pushd "%VIRTUAL_ENV%\Lib\site-packages"
xcopy /ydfsi %SRCDIR%\MySQLdb MySQLdb
xcopy /ydfsi %SRCDIR%\_mysql* .
xcopy /ydfsi %SRCDIR%\MySQL_python-1.2.3-py2.7.egg-info MySQL_python-1.2.3-py2.7.egg-info
popd
goto :eof
@georgevreilly
georgevreilly / afterexec_queryparams.html
Last active September 18, 2015 19:26
SQLTap sometimes fails to capture query parameters.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="sqltap profile">
<meta name="author" content="inconshreveable">
<title>SQLTap Profiling Report</title>

Keybase proof

I hereby claim:

  • I am georgevreilly on github.
  • I am georgevreilly (https://keybase.io/georgevreilly) on keybase.
  • I have a public key ASBIOJqGGJhV02brqZCUoFOq_byUSWSmJyjrFXJ9YEscVgo

To claim this, I am signing this object:

@georgevreilly
georgevreilly / blob2jsonlines.py
Last active February 15, 2018 19:59
Convert large JSON blob into JSONLines. Handles corrupt records. The blob must be a JSON array, containing flat (non-nested) objects.
#!/usr/bin/env python
from __future__ import unicode_literals, absolute_import, print_function
import argparse
import codecs
from collections import OrderedDict
import json
import os
import re
@georgevreilly
georgevreilly / Makefile
Created October 9, 2021 19:30
`pyenv install 3.10.0` fails with `Makefile:222: *** missing separator`
# Generated automatically from Makefile.pre by makesetup.
# Top-level Makefile for Python
#
# As distributed, this file is called Makefile.pre.in; it is processed
# into the real Makefile by running the script ./configure, which
# replaces things like @spam@ with values appropriate for your system.
# This means that if you edit Makefile, your changes get lost the next
# time you run the configure script. Ideally, you can do:
#
# ./configure
#!/usr/bin/env python3
import random
def lcg(a, c, m):
def _lcg(a, c, m):
x = random.randint(0, m-1)
for _ in range(m):
yield x