Skip to content

Instantly share code, notes, and snippets.

Chris Zetter zetter

Block or report user

Report or block zetter

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
zetter / tracepoint_log_process.rb
Created Mar 6, 2019
Code to process a log that I created using TracePoint
View tracepoint_log_process.rb
require 'json'
require 'csv'
class Line
attr_reader :thread_no, :line_no, :path, :klass, :method_id, :event, :code, :line
def initialize(row)
@thread_no, @line_no, @path, @klass, @method_id, @event, @code = row
zetter / output.tsv
Last active Aug 17, 2018
Find words in Omegawiki that are the reverse of the same word in another language
View output.tsv
word_1 word_2 word_1_language word_2_language
ramer remar French Castilian
afaka akafa French Castilian
NATO OTAN English French
nier rein Afrikaans French
NATO OTAN German French
NATO OTAN Italian French
erum mure Ainu (Latin) Interlingua
NATO OTAN English Castilian
agua auga Castilian Mirandese
zetter / wait_for_pending_requests.rb
Created Mar 22, 2018
Re-writing method without timeout
View wait_for_pending_requests.rb
def wait_for_pending_requests
start =
while pending_requests?
if ( - start) > 60
raise "Requests did not finish in 60 seconds"
zetter / parse_icons_from_icomoon.rb
Created Dec 9, 2013
Parse the icon file from icomoon and print out a ruby hash of character names to characters.
View parse_icons_from_icomoon.rb
# Usage:
# run the file with the dev.svg from icomoon (not the plain svg)
# ruby parse_icons_from_icomoon.rb /path/to/
require 'nokogiri'
file = ARGV[0]
svg =
document = Nokogiri::XML(svg)
View subtyping.txt
There was a programmer from Skegness,
Who had a language that was a bit of a mess,
They implemented subtyping, and no longer was there griping,
All while keeping safety, preservation and progress
zetter / Slow queries
Created Feb 8, 2011
Find the slowest queries lines in a rails development log
View Slow queries
slow = []
File.readlines(file).each do |line|
if line =~ /Load\ \(([\d\.]*)ms\)/
time = $1.to_f
if time >= 500.0
slow << [time, line]
zetter / enrolment_cuke_spec.rb
Last active Jun 13, 2016
Enrolment cucumber-like rspec feature spec
View enrolment_cuke_spec.rb
feature 'Enrolment' do
scenario 'Enrolling in a course' do
def given_there_is_a_course
@course = FactoryGirl.create(:course)
zetter / phantomjs
Last active Jan 3, 2016
Filter out userSpaceScaleFactor warning on phantomjs on Mavericks
View phantomjs
/usr/local/bin/phantomjs_original $@ 2> >(grep -v userSpaceScaleFactor 1>&2)
zetter / transaction_download.applescript
Last active Dec 27, 2015
Halifax Online Banking Transaction Downloader Applescript
View transaction_download.applescript
Halifax Online Banking Transaction Downloader Applescript
To use:
+ Set the path to an existing directory where you want to save the
+ Open Safari with a single window and tab and login to Halifax Online.
+ Load up the first page of the transactions for the account you want to save.
+ Run this script.
zetter /
Created Oct 31, 2013
List the remote branches that with a last commit that you authored.
# list remote branches with committer name and email
function git_remote_branches_with_author {
for branch in `git branch -r | grep -v /HEAD`; do
echo -en "$branch ";
echo -e `git show -s --pretty=format:"%an %ae" $branch`;
# show filtered remote branches
function find_git_remote_branches {
You can’t perform that action at this time.