Skip to content

Instantly share code, notes, and snippets.

@codebutler
codebutler / JsonHelper.java
Created April 8, 2012 20:20
Convert Android JSONObject/JSONArray to a standard Map/List.
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.*;
public class JsonHelper {
public static Object toJSON(Object object) throws JSONException {
if (object instanceof Map) {
JSONObject json = new JSONObject();
@codebutler
codebutler / inbox-bankruptcy.rb
Created January 27, 2011 04:21
declare gmail inbox bankruptcy
require 'rubygems'
require 'gmail'
require 'gmail_xoauth'
NAME = "Eric Butler"
EMAIL = 'eric@codebutler.com'
TOKEN = 'CHANGEME'
TOKEN_SECRET = 'CHANGEME'
CONSUMER_KEY = 'anonymous'
lnmp_site 'caphillcouncil' do
domains [ 'caphillcouncil.org', 'www.caphillcouncil.org', 'capitolhillcommunitycouncil.org', 'www.capitolhillcommunitycouncil.org' ]
db_name 'caphill'
db_username 'caphill'
db_password 'xxxx'
php_cgi_port 9005
end
#!/usr/bin/python
import urllib
import hashlib
import hmac
import json
URL = 'http://stumble.to/api/update'
API_KEY = 'YOUR_KEY_GOES_HERE'
/*
RubyMarshal.js: De-marshal ruby objects from JavaScript.
Ported by Eric Butler <eric@codebutler.com>
Based on code from the Rubinus project.
Copyright (c) 2007, Evan Phoenix
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
--- babl/babl-cpuaccel.c.orig 2010-06-17 16:16:52.000000000 -0700
+++ babl/babl-cpuaccel.c 2010-06-17 16:16:55.000000000 -0700
@@ -74,7 +74,7 @@
}
-#if defined(ARCH_X86) && defined(USE_MMX) && defined(__GNUC__)
+#if defined(ARCH_X86) && defined(USE_MMX) && defined(__GNUC__) && defined(CHEESY)
#define HAVE_ACCEL 1
//
// C# wrapper around the ImageMagick Wand API
//
// Authors:
// Eric Butler <eric@extremeboredom.net>
//
// (C) 2006 Eric Butler
//
// See http://www.imagemagick.org/script/magick-wand.php
//
//
// UPnP.cs: UPnP Device Discovery Test.
//
// Authors:
// Eric Butler <eric@extremeboredom.net>
//
// (C) 2006 FileFind.net (http://filefind.net)
//
using System;
#!/usr/bin/ruby
# XXX: Don't hardcode these paths!
require '/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/number_helper.rb'
require '/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/core_ext/numeric/bytes.rb'
include ActiveSupport::CoreExtensions::Numeric::Bytes
include ActionView::Helpers::NumberHelper
BLOCKSIZE = 1024
#!/bin/sh
set -e
ip4=$1
echo "$ip4" | grep -q '^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$' || \
{ echo 'Syntax: $0 a.b.c.d'; exit 1; }
prefix=$(printf '%02x%02x:%02x%02x\n' $(echo $ip4 | sed 's/\./ /g'))