Skip to content

Instantly share code, notes, and snippets.

@mmb
mmb / weechat_otr.py
Created Apr 16, 2014
weechat otr with irc parsing debugging
View weechat_otr.py
# -*- 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 <matthewm@boedicker.org>
# Nils Görs <weechatter@arcor.de>
# Daniel "koolfy" Faucon <koolfy@koolfy.be>
@mmb
mmb / wunderlist_unfinished.sh
Created Feb 15, 2014
Using jq to extract lists from a Wunderlist json export
View wunderlist_unfinished.sh
# 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")) |
.[].title'
@mmb
mmb / gist:4230951
Created Dec 7, 2012
Find all urls in stdout and open them in a browser.
View gist:4230951
cat some_stdout | ruby -ruri -e "puts URI.extract(ARGF.read, 'http').join(' ')" | xargs open
View gist:3944324
find . -name *.gem -printf "%f\n" | sort | uniq | sed 's/\([0-9a-z_-]*\)-\([0-9.]*\)\.gem$/gem "\1", "= \2"/g'
@mmb
mmb / gist:3803338
Created Sep 29, 2012
Deploying Hubot IRC on Cloud Foundry
View gist:3803338
Deploying Hubot IRC on Cloud Foundry
git clone git://github.com/github/hubot.git
cd hubot
npm install
mkdir ~/hubot_deploy
@mmb
mmb / 1.9.2-p180
Created Sep 20, 2012
patched ruby 1.9.2-p180 rbenv package for recent Ubuntu
View 1.9.2-p180
require_gcc
build_package_patch_sslv2() {
wget -q -O - https://raw.github.com/gist/3758689/6363d446805334c1815c18094f5892f0b37cbd30/remove_sslv2.patch | patch -p0
}
install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz"
install_package "ruby-1.9.2-p180" "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz" patch_sslv2 standard
install_package "rubygems-1.8.23" "http://production.cf.rubygems.org/rubygems/rubygems-1.8.23.tgz" ruby
@mmb
mmb / remove_sslv2.patch
Created Sep 20, 2012
patch to remove SSLv2 from ruby 1.9.2-p180
View remove_sslv2.patch
--- ext/openssl/ossl_ssl.c.back 2012-09-20 14:48:47.000000000 -0700
+++ ext/openssl/ossl_ssl.c 2012-09-20 14:48:53.000000000 -0700
@@ -107,9 +107,9 @@
OSSL_SSL_METHOD_ENTRY(TLSv1),
OSSL_SSL_METHOD_ENTRY(TLSv1_server),
OSSL_SSL_METHOD_ENTRY(TLSv1_client),
- OSSL_SSL_METHOD_ENTRY(SSLv2),
- OSSL_SSL_METHOD_ENTRY(SSLv2_server),
- OSSL_SSL_METHOD_ENTRY(SSLv2_client),
+ // OSSL_SSL_METHOD_ENTRY(SSLv2),
@mmb
mmb / gist:3704738
Created Sep 12, 2012
Scripting VM virtual consoles from the host.
View gist:3704738
# Writing to Linux virtual consoles to simulate user input:
s = "ls\n"
open('/dev/tty1','w') do |f|
s.each_char do { |c| f.ioctl(0x5412, c) }
end
# From the shell:
echo 7 | ruby -e "open('/dev/tty1', 'w') { |o| \$stdin.each_char { |c| o.ioctl(0x5412, c) } }"
@mmb
mmb / emacs_scratch_paste
Created Aug 9, 2012
paste contents of clipboard to emacs scratch buffer
View emacs_scratch_paste
# paste contents of clipboard to emacs scratch buffer
tell application "Emacs"
activate
tell application "System Events"
keystroke "x" using {control down}
keystroke "b*scratch*"
keystroke return
keystroke ">" using {option down}
keystroke return
@mmb
mmb / leaving_work_notify.lua
Created Jul 2, 2012
SL4A Lua script to send SMS from Llama
View leaving_work_notify.lua
-- SL4A Lua script to send SMS from Llama
-- Llama action is "Run App Shortcut" / Scripts
require "android"
android.smsSend("3155551212", "I have left work")