Skip to content

Instantly share code, notes, and snippets.


Matt Westcott gasman

View GitHub Profile
gasman / Vagrantfile
Last active Aug 29, 2015
Wagtail developer setup in Vagrant
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby : do |config|
# Base box to build off, and download URL for when it doesn't exist on the user's system already = "wagtail-base-v0.1"
config.vm.box_url = ""
# You can also build from a vanilla precise32 box, although it'll take longer
gasman / pnginator.rb
Created Apr 30, 2012
pnginator: pack Javascript into a self-extracting PNG
View pnginator.rb
#!/usr/bin/env ruby -w
# pnginator.rb: pack a .js file into a PNG image with an HTML payload;
# when saved with an .html extension and opened in a browser, the HTML extracts and executes
# the javascript.
# Usage: ruby pnginator.rb input.js output.png.html
# By Gasman <>
# from an original idea by Daeken:
import re
from hashlib import md5
def gfm(text):
# Extract pre blocks.
extractions = {}
def pre_extraction_callback(matchobj):
digest = md5('utf-8')).hexdigest()
extractions[digest] =
return "{gfm-extraction-%s}" % digest
View twitter_oauth_setup.rb
#!/usr/bin/env ruby
# Command line util for acquiring a one-off Twitter OAuth access token
# Based on
require 'rubygems'
require 'oauth'
puts <<EOS
Set up your application at (as a 'Client' app),