Skip to content

Instantly share code, notes, and snippets.

mmb /
Created Feb 15, 2014
Using jq to extract lists from a Wunderlist json export
# All unfinished items from a list called "Buy"
cat ~/Downloads/wunderlist-20140214-23-56-27.json | \
jq -r '([.lists[] | {key: .id, value: .title}] | from_entries) as $lists |
.tasks |
map(select(.completed_at == null)) |
map({title, list: $lists[.list_id]}) |
map(select(.list == "Buy")) |
mmb /
Created Apr 16, 2014
weechat otr with irc parsing debugging
# -*- coding: utf-8 -*-
# otr - WeeChat script for Off-the-Record IRC messaging
# DISCLAIMER: To the best of my knowledge this script securely provides OTR
# messaging in WeeChat, but I offer no guarantee. Please report any security
# holes you find.
# Copyright (c) 2012-2014 Matthew M. Boedicker <>
# Nils Görs <>
# Daniel "koolfy" Faucon <>
mmb / bosh2docker.rb
Created Jun 13, 2014
convert a bosh job into a Dockerfile that builds a container with all the job's packages installed
View bosh2docker.rb
require 'yaml'
require 'fileutils'
job = ARGV[0]
job_spec = YAML.load_file(File.join('jobs', job, 'spec'))
packages = job_spec['packages']
work_dir = 'docker'
mmb / plz_verify
Last active Aug 29, 2015
When USB drives are mounted, check them for a script called and run it if found.
View plz_verify
#!/usr/bin/env ruby
# When USB drives are mounted, check them for a script called
# and run it if found.
# symlink all USB volumes you want to check into ~/usb
# ln -s /Volumes/mmb ~/usb/mmb
require 'logger'
require 'set'
mmb / gist:f2ae27e66df8c473a2ce
Created Jul 12, 2014
test wkhtmltopdf header
View gist:f2ae27e66df8c473a2ce
<!DOCTYPE html>
mmb / gist:3cee36e6fd16bf33df0b
Created Jul 31, 2014
Rack::Test::UploadedFile doesn't respond to encoding
View gist:3cee36e6fd16bf33df0b
def create
@src_image =
@src_image.user = current_user
read_image_data @src_image
respond_to do |format|
mmb / rmagick_anim_test.rb
Created Dec 2, 2014
How to tell if an image is animated using rmagick
View rmagick_anim_test.rb
require 'rmagick'
img_list ='')
p img_list.size
img_list ='')
p img_list.size
mmb /
Last active Aug 29, 2015
shell script that ejects the USB drive it's on
set -e
cat > $COPY_PATH << EOF
set -e
mmb / gist:15e62996d2053bba7e21
Last active Aug 29, 2015
watch Cloud Foundry gorouter routing table on bosh-lite
View gist:15e62996d2053bba7e21
watch -d 'curl -s http://router:router@ \
| jq -r "to_entries[] | .key+\" \"+.value[].address+\" \"+.value[].route_service_url" | \
column -t'
View gist:43933
# convert embed code generated by some Flash video players into valid markup
# (use object tag instead of deprecated embed tag)
require 'rexml/document'
require 'rubygems'
require 'builder'