Skip to content

Instantly share code, notes, and snippets.

Max Goodhart chromakode

Block or report user

Report or block chromakode

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

Keybase proof

I hereby claim:

  • I am chromakode on github.
  • I am chromakode ( on keybase.
  • I have a public key ASCluTVDeOcCBkDGS7RVqebTOEGGFu4_jLnJdglEDhJ08wo

To claim this, I am signing this object:

View gist:4cbcc6da0418c0235b4a
var importExpr = /^(\s*)(import\s+[^=+*"'\r\n;\/]+|from\s+[^=+"'\r\n;\/]+)(;|\/|$)/gm;
function replaceImport(raw, p1, p2, p3) {
if (!/\/\//.test(p1)) {
return p1 + 'jsio(\'' + p2 + '\')' + p3;
return raw;
var requireExpr = /^(.*)require\(['"]([^=+*"'\r\n;]+)['"]\)(;|\/|$)/gm;
chromakode / gist:e6baee16d87cad494921
Created Jul 8, 2014
salt-ssh pillar data workaround
View gist:e6baee16d87cad494921
# salt-ssh doesn't support sending pillar data, so we have to embed it in the state files...
- contents: |
{{ pillar['openvpn']['server_key'] | indent(8) }}
- user: root
- group: root
- mode: 600
chromakode /
Created May 1, 2012
Start reddit in a chroot
# Max's groovy chroot script
# Install Ubuntu Natty via debootstrap and then run Neil's install script.
# Then adjust the bind mounts to suit your personal locations for the reddit code.
if mount | grep -q reddit
chromakode / saved.js
Created Jun 22, 2011
Fetch saved links from reddit. Paste into a web browser's JavaScript console to run. Make sure you enable popups.
View saved.js
(function(cb, after, saved) {
var next = arguments.callee
console.log("Requesting after", after)
$.getJSON('', {after:after}, function(data) {
saved = (saved || []).concat(
if ( {
console.log('Fetched:', saved.length)
next(cb,, saved)
} else {
mgood@capstone11 ~/D/c/b/boots.mgood> boots -H capstonedd -l python
Boots (v0.2.0)
capstonedd:3306 (server v2009.11.1220)
> from boots.api import constructors
> @constructors.register('reverse')
+ def reverse():
+ from boots.api.nodes.node import SyncNode
+ from boots.api.api import Rows
+ def reverse_data(data):
+ return Rows((("".join(reversed(field)) if isinstance(field,basestring) else field
import time
from urllib2 import urlopen, quote
import json
def fetch_comments(after=None):
url = ""
if after:
url += "?after={0}".format(quote(after))
#print "... Fetching {0} ...".format(url)
View gist:327671
# <snip>
for line in f:
m = LOG_RE.match(line)
if m:
when = time.mktime(time.strptime("when"), "%d-%m-%Y %H:%M:%S"))
# Bwahahahaha.
_time = time.time
time.time = lambda: when
View gist:320330
def _iter_driver_output(self):
while self.driver_stack:
curdriver = self.driver
# Iterate over the current driver until it changes.
for output in curdriver.get_input():
yield output
# If the driver has changed, stop iterating over the old one.
if self.driver is not curdriver:
You can’t perform that action at this time.