Skip to content

Instantly share code, notes, and snippets.

@mmb
mmb / gist:151066
Created July 21, 2009 02:32
show recent anonymous edits to a Wikipedia article from interesting domains
#!/usr/bin/ruby
# show recent anonymous edits to a Wikipedia article from interesting domains
require 'hpricot'
require 'open-uri'
require 'socket'
require 'yaml'
article = 'Henry_Paulson'
@mmb
mmb / off
Created July 27, 2009 02:17
turn dd-wrt web gui on only when you need it
#!/bin/sh
# turn dd-wrt web gui on only when you need it
ROUTER=192.168.0.1
USER=root
[ "$1" = "on" ] && COMMAND="httpd -h /www -S"
[ "$1" = "off" ] && COMMAND="kill \`cat /tmp/var/run/httpsd.pid\`"
@mmb
mmb / .bashrc
Created August 17, 2009 02:57 — forked from justintv/.bashrc
export PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$(git branch 2>/dev/null | sed -n 's/^\* \(.*\)/ git:\1/p')\$ "
@mmb
mmb / gist:180083
Created September 3, 2009 02:27
Google Latitude plugin for rbot
#++
#
# :title: Google Latitude plugin for rbot
#
# Author:: Matthew M. Boedicker <matthewm@boedicker.org>
#
# Copyright:: (C) 2009 Matthew M. Boedicker
#
# License:: GPL v3
#
@mmb
mmb / next_tab.js
Created September 11, 2009 04:22
mozrepl function to select the next tab with title matching a regex
// mozrepl function to select the next tab with title matching a regex
function next_tab(title_re) {
var tabContainer = window.getBrowser().tabContainer;
var tabs = tabContainer.childNodes;
var numTabs = tabs.length;
var startIndex = tabContainer.selectedIndex;
var testIndex;
for (i = 0; i < numTabs - 1; i++) {
@mmb
mmb / facebook_news.rb
Created October 4, 2009 23:35
fetch a user's facebook news feed
#!/usr/bin/ruby
# fetch a user's facebook news feed
require 'rubygems'
require 'httparty'
require 'digest/md5'
require 'pp'
@mmb
mmb / lifemagick.rb
Created October 25, 2009 03:48
add methods to rmagick to generate Conway's life iterations
require 'rubygems'
require 'RMagick'
# add methods to rmagick to generate Conway's life iterations
module Magick
class Image
def occupied?(x, y); pixel_color(x, y).to_color == 'black' end
@mmb
mmb / upslog.rb
Created December 2, 2009 00:49
parse and log diagnostic information from an APC UPS
#!/usr/bin/ruby
# parse and log diagnostic information from an APC UPS
require 'pp'
require 'time'
time_fields = %w{
APC
DATE
@mmb
mmb / pianobar_event.rb
Created April 17, 2010 04:05
pianobar event script to make rbot send currently playing song to an IRC channel
#!/usr/bin/ruby
# pianobar event script to make rbot send currently playing song to an IRC
# channel
# Copyright (c) 2010
# Matthew M. Boedicker <matthewm@boedicker.org>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@mmb
mmb / pianobar_recent_json.rb
Created April 29, 2010 01:49
pianobar event script to maintain a JSON file of the last 10 songs played
#!/usr/bin/ruby
# pianobar event script to maintain a JSON file of the last 10 songs played
# Copyright (c) 2010
# Matthew M. Boedicker <matthewm@boedicker.org>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights