Skip to content

Instantly share code, notes, and snippets.

Aaron Brady insom

Block or report user

Report or block insom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
insom / httpdir_latest_meta-data_index.html
Created Jul 17, 2014
Example UEC Build with QEMU image file support in Packer
insom /
Created Jun 6, 2014
PyMongo BSON encodes the same object differently if C or Python version is used
(cextensionvenv)% python
{u'foo': [u'bar'], u'bacon': [u'cheeseburger']}
(pythonvenv)% python
{u'foo': u'bar', u'bacon': u'cheeseburger'}

Keybase proof

I hereby claim:

  • I am insom on github.
  • I am insom ( on keybase.
  • I have a public key whose fingerprint is 30D9 81E4 DEB1 FF5D 8CAA D832 8CCE 2412 3B8F 78F8

To claim this, I am signing this object:

insom / gist:0070d6dd9c3d18f3c8db
Created May 25, 2014
Add ASCII-art underlines to H2's
View gist:0070d6dd9c3d18f3c8db
// Happy "I can copy and paste and write enough JavaScript to get the thing that I wanted to do done" Day
// - Aaron
String.prototype.repeat = function(times) {
return (new Array(times + 1)).join(this);
}; // from
function insertAfter(referenceNode, newNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}; // from
insom / gist:8008090
Created Dec 17, 2013
How old are inetd's children? #badpython
View gist:8008090
import os
import stat
from os.path import dirname
from glob import glob
import time
for cmdline in glob('/proc/*/cmdline'):
f = open(cmdline).read()
if f.startswith('/usr/sbin/inetd'):
inetd_pid = int(cmdline.split('/')[2])
insom /
Created Nov 29, 2013
Get a post from a WP blog and render as an ASCII Markdown file
import sys, urllib
from pyquery import PyQuery as pq
from html2text import html2text
from unidecode import unidecode
d = pq(urllib.urlopen(sys.argv[1]).read())
print unidecode(html2text(d(".entry-content").html()))
insom / insom.zsh-theme
Created Oct 16, 2013
My oh-my-zsh theme.
View insom.zsh-theme
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
local current_dir='${PWD/#$HOME/~}'
local git_info='$(git_prompt_info)'
function virtualenv_info_2 {
[ $VIRTUAL_ENV ] && (
echo "%{$terminfo[bold]$fg[red]%}v:%{$fg[yellow]%}`basename $VIRTUAL_ENV`%{$reset_color%}"
insom /
Created Oct 4, 2013
Manually control a Python Turtle with the keyboard.
#!/usr/bin/env python
# Adapted from David Llewellyn-Jones's code
# By Aaron Brady
import turtle as t
import sys
import tty
insom /
Last active Dec 24, 2015
Parse a PHP-format callgrind file and produce a summary of what time was spent in what files.
import re
import sys
states = ('DEFAULT', 'HAVE_FILE')
fl = re.compile('^fl=(.*)')
num = re.compile('^\d+ (\d+)')
state = 0
current_file = ''
inclusive = False
View fix-magento-vulnerability.diff
diff -ru magento-17/app/code/core/Mage/Core/Helper/Cookie.php magento-patched/app/code/core/Mage/Core/Helper/Cookie.php
--- magento-17/app/code/core/Mage/Core/Helper/Cookie.php 2012-07-05 11:49:29.000000000 +0100
+++ magento-patched/app/code/core/Mage/Core/Helper/Cookie.php 2013-09-26 10:52:24.701527319 +0100
@@ -69,7 +69,7 @@
$acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites();
$acceptedSaveCookiesWebsites[Mage::app()->getWebsite()->getId()] = 1;
- return serialize($acceptedSaveCookiesWebsites);
+ return json_encode($acceptedSaveCookiesWebsites);
You can’t perform that action at this time.