Skip to content

Instantly share code, notes, and snippets.

@dwalters-zz
dwalters-zz / extract-image.rb
Created June 19, 2012 23:07
Extract kernal and root filesystem images from the Linksys EA3500 firmware.
#!/usr/bin/env ruby
#
# Requires Ruby 1.9, and extracts the uImage header, kernel, and jffs root image from a stock
# firmware.
Encoding.default_external = "binary"
FW_FILENAME = "FW_EA3500_1.0.30.126544.SSA"
data = File.read(FW_FILENAME)
@dwalters-zz
dwalters-zz / linksys-config.rb
Created June 14, 2012 16:42
Script to encrypt/decrypt config backups of a Linksys EA3500 V1 router (on stock firmware.)
#!/usr/bin/env ruby
#
# Script to decrypt (and reencrypt) Linksys EA3500 v1.0 configuration file backups, e.g.,
# Linksys_EA3500V1_v1.0.30.126544.cfg . The result of decryption is a plain text nvram dump that
# can be edited, re-encrypted, and uploaded back into the router.
#
# Depends on Ruby 1.9 and an openssl command line binary.
require 'optparse'
require 'tempfile'
@dwalters-zz
dwalters-zz / freeimage.rb
Created November 29, 2011 02:23
freeimage formula for 3.15.1
require 'formula'
class Freeimage < Formula
url 'http://downloads.sourceforge.net/project/freeimage/Source%20Distribution/3.15.1/FreeImage3151.zip'
version '3.15.1'
md5 '450d2ff278690b0d1d7d7d58fad083cc'
homepage 'http://sf.net/projects/freeimage'
def install
inreplace "Makefile.gnu" do |s|
@dwalters-zz
dwalters-zz / encfs.plist
Created June 12, 2011 18:13
launchd plist for starting encfs at login
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>encfs</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
@dwalters-zz
dwalters-zz / Magnacity.user.js
Created April 17, 2011 16:57
Magnacity (Magnet links for torrentz.com) - Adds direct download links to the result pages of torrentz.com. It uses the so-called magnet URI scheme to provide a more user-friendly, faster way to access your favorite torrents.
// ==UserScript==
// @name Magnacity (Magnet links for torrentz.com)
// @namespace http://userscripts.org/users/vulcano
// @description Adds direct download links to the result pages of torrentz.com. It uses the so-called magnet URI scheme to provide a more user-friendly, faster way to access your favorite torrents.
// @include http://torrentz.eu/*
// @include http://www.torrentz.eu/*
// @license Creative Commons Attribution-Share Alike http://creativecommons.org/licenses/by-sa/3.0/
// @copyright (c) 2009-2011 Dr. Vulcano
// @version 1.0.5
// ==/UserScript==
#!/usr/bin/env ruby
#
# Scans a bzip2 file for all block headers and outputs their bit offset within the file.
# As blocks are independent, the resulting offsets can be decompressed via random access.
#
# Author: Dan Walters
BZ2_BLOCK_MAGIC = 0x314159265359 # BCD pi
BZ2_EOS_MAGIC = 0x177245385090 # BCD sqrt(pi)
#!/bin/sh
# Patches the Chromium application installation with command line arguments to enable extensions.
set -o errexit
app=${1:-/Applications/Chromium.app}
cat >$app/Contents/MacOS/Chromium.wrapper <<EOF
#!/bin/sh
exec $app/Contents/MacOS/Chromium --enable-extensions --enable-user-scripts --enable-sync "\$@"
EOF
chmod 755 $app/Contents/MacOS/Chromium.wrapper
defaults write $app/Contents/Info CFBundleExecutable Chromium.wrapper
; <couchdb-lucene>
[couchdb]
os_process_timeout=60000 ; increase the timeout from 5 seconds.
[external]
fti=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java -Dcouchdb.lucene.dir=/opt/local/var/lib/couchdb/lucene -Dcouchdb.log.dir=/opt/local/var/log/couchdb -jar /Users/dwalters/Projects/couchdb-lucene/target/couchdb-lucene-0.3-SNAPSHOT-jar-with-dependencies.jar -search
[update_notification]
indexer=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java -Dcouchdb.lucene.dir=/opt/local/var/lib/couchdb/lucene -Dcouchdb.log.dir=/opt/local/var/log/couchdb -jar /Users/dwalters/Projects/couchdb-lucene/target/couchdb-lucene-0.3-SNAPSHOT-jar-with-dependencies.jar -index
--- Site/1.8/rubygems/commands/cleanup_command.rb.dist 2008-12-23 11:44:35.000000000 -0600
+++ Site/1.8/rubygems/commands/cleanup_command.rb 2008-12-23 11:42:43.000000000 -0600
@@ -71,6 +71,7 @@
options[:args] = [spec.name]
options[:version] = "= #{spec.version}"
options[:executables] = false
+ options[:install_dir] = File.dirname(File.dirname(spec.loaded_from)) if spec.loaded_from
uninstaller = Gem::Uninstaller.new spec.name, options