Skip to content

Instantly share code, notes, and snippets.

Mike Dalessio flavorjones

Block or report user

Report or block flavorjones

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
flavorjones / Makefile
Last active Jan 18, 2019
View Makefile
CFLAGS=$(shell pkg-config libxml-2.0 --cflags)
LDFLAGS=$(shell pkg-config libxml-2.0 --libs)
foo: foo.o
$(CC) -o foo foo.o $(LDFLAGS)
foo.o: foo.c
$(CC) $(CFLAGS) -c -o foo.o foo.c
flavorjones / _output.txt
Created Jun 7, 2016
benchmark nokogiri vs rexml
View _output.txt
# parsing a document 6731 bytes long
Warming up --------------------------------------
nokogiri 488.000 i/100ms
rexml 21.000 i/100ms
Calculating -------------------------------------
nokogiri 6.150k (±23.4%) i/s - 28.792k in 5.067345s
rexml 208.195 (± 5.3%) i/s - 1.050k in 5.056578s
nokogiri: 6150.3 i/s
flavorjones / gist:cc1b82365d1d29f6fb3f
Created Jan 13, 2015
Here's what happens when I try to remove libxml2 from my system ...
View gist:cc1b82365d1d29f6fb3f
$ sudo apt-get remove libxml2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
adobe-flashplugin apturl avahi-daemon avahi-utils banshee baobab bind9-host
bluez-gstreamer brasero brasero-cdrkit caribou cinnamon cinnamon-bluetooth
cinnamon-control-center cinnamon-screensaver cinnamon-session
cinnamon-settings-daemon cmake colord default-jre dnsutils dropbox emacs24
flavorjones / gist:3450791
Created Aug 24, 2012
lua script for redirecting mysql access via mysqlproxy
View gist:3450791
local tok = require("proxy.tokenizer")
function read_query(packet)
if (string.byte(packet) == proxy.COM_QUERY) then
local replacement_tokens = {}
local tokens = tok.tokenize(packet:sub(2))
local modified_p = false
flavorjones / pomodoro.rb
Created Aug 24, 2011
Toggle "Pomodoro Mode" under Gnome (using keyboard typing break)
View pomodoro.rb
#! /usr/bin/env ruby
# Script to turn "pomodoro mode" on/off in Gnome.
# Gnome has a little-known feature to put a timer around "typing
# breaks". This script makes it easy to turn on and off from the
# command line (or gnome-do, or what-have-you).
current_value = %x{gconftool --get /desktop/gnome/typing_break/enabled}.chomp
flavorjones / 539-join-across-tables.patch
Created May 13, 2011
Patch containing failing test for rails/rails issue 539.
View 539-join-across-tables.patch
From 641e1e0bebdea1cf5ad4e156afe0ecb6a91241c4 Mon Sep 17 00:00:00 2001
From: Mike Dalessio <>
Date: Fri, 13 May 2011 08:53:49 -0400
Subject: [PATCH] Test for table join across databases (connections).
.../test/cases/associations/join_model_test.rb | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb
View benchmark.txt
# ---------- ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux] ----------
# ---
# warnings: []
# ruby:
# engine: mri
# version: 1.8.7
# platform: x86_64-linux
# libxml:
View benchmark.txt
user system total real
json 3.260000 0.030000 3.290000 ( 3.320897)
xml (noko-dom) 21.080000 0.040000 21.120000 ( 21.412431)
xml (via Nokogiri DOM parsing) came in at only 6.4x slower than JSON.
codes at
View session-ruby
define session-ruby
source ~/.gdb/session-ruby
flavorjones / small_table_caching.rb
Created Feb 18, 2011
Cache small data sets by wrapping the table with an ActiveHash model.
View small_table_caching.rb
# Tired of Rails constructing SQL queries to keep loading the same
# small set of records over and over again?
# Well, cache those records in memory using ActiveHash!
# *
require 'active_record'
require 'active_hash'
You can’t perform that action at this time.