Skip to content

Instantly share code, notes, and snippets.

View gist:69960
# ~/.bashrc
# tab-completion for git subcommands
# (this is for git installed via MacPorts: `sudo port install git-core +svn`)
source /opt/local/share/doc/git-core/contrib/completion/git-completion.bash
# git status with a dirty flag
function __git_status_flag {
git_status="$(git status 2> /dev/null)"
remote_pattern="^# Your branch is (.*) of"
View dnsmasq.conf
# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
# The following two options make you a better netizen, since they
# tell dnsmasq to filter out queries which the public DNS cannot
# answer, and which load the servers (especially the root servers)
# uneccessarily. If you have a dial-on-demand link they also stop
@mojodna
mojodna / xen-tools.conf
Created Apr 3, 2009
customized xen-tools config (sensible defaults)
View xen-tools.conf
##
# /etc/xen-tools/xen-tools.conf
##
#
# This is the global configuration file for the scripts included
# within the xen-tools package.
#
# For more details please see:
#
# http://xen-tools.org/
View netflix.rb
#!/usr/bin/env ruby -rubygems
require 'oauth'
require 'optparse'
options = {}
option_parser = OptionParser.new do |opts|
opts.banner = "Usage: #{$0} [options] <query>"
View gist:113183
// accessing application-specific preferences
SharedPreferences prefs = getPreferences(MODE_PRIVATE);
Log.i("prefs", "Preferences: " + prefs.getAll().toString());
Editor editor = prefs.edit();
editor.putString("test", "value");
editor.commit();
View gist:113834
# Updating Ruby OAuth Consumers to 1.0a
In response to April's [OAuth Security Advisory](http://oauth.net/advisories/2009-1), the OAuth community has penned a [new draft of the specification](http://oauth.googlecode.com/svn/spec/core/1.0a/drafts/3/oauth-core-1_0a.html), titled 1.0a (currently in draft 3). This makes a number of changes to the flow:
1. providing an `oauth_callback` is now part of the Request Token stage (if the client cannot accept callbacks, the value MUST be _oob_)
2. `oauth_callback_confirmed` MUST be present (and _true_) when the SP issues a Request Token to the client
3. an `oauth_verifier` parameter is provided to the callback URL (or displayed if no callback URL was configured) and MUST be included when exchanging the Request Token for an Access Token
Code that once looked like this:
View gist:153110
sqlite> .schema tracks
CREATE TABLE tracks (_id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING, description STRING, category STRING, startid INTEGER, stopid INTEGER, starttime INTEGER, stoptime INTEGER, numpoints INTEGER, totaldistance FLOAT, totaltime INTEGER, movingtime INTEGER, minlat INTEGER, maxlat INTEGER, minlon INTEGER, maxlon INTEGER, avgspeed FLOAT, avgmovingspeed FLOAT, maxspeed FLOAT, minelevation FLOAT, maxelevation FLOAT, elevationgain FLOAT, mingrade FLOAT, maxgrade FLOAT, mapid STRING);
sqlite> .schema trackpoints
CREATE TABLE trackpoints (_id INTEGER PRIMARY KEY AUTOINCREMENT, trackid INTEGER, longitude INTEGER, latitude INTEGER, time INTEGER, elevation FLOAT, accuracy FLOAT, speed FLOAT, bearing FLOAT);
sqlite> .schema waypoints
CREATE TABLE waypoints (_id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING, description STRING, category STRING, icon STRING, trackid INTEGER, type INTEGER, length FLOAT, duration INTEGER, starttime INTEGER, startid INTEGER, stopid INTEGER, longitude INTEGER, latit
View gist:187105
from TileCache.Layer import Layer, Tile
Tile(Layer("foo", spherical_mercator=True, tms_type="google"), 607, 754, 11).bounds()
# y values are inverted
# nik2img.py tilecache/osm.xml mercator.png --srs 900913 -e -8159805.6428374983 5283327.3949249983 -8140237.7635999992 5263759.5156874992 -v -d 256 256
View gist:188182
EM.run {
# ... other EM stuff ...
Thin::Server.start {
run Sinatra.application
}
}
View gist:206113
# Twisted implementation of fire-hydrant Google Earth visualizer
# (http://github.com/mojodna/fire-hydrant)
#
# requires modern twisted, appscript, and Google Earth
# easy_install twisted
# easy_install appscript
from twisted.words.protocols.jabber import client, jid
from twisted.words.xish import domish, xpath
from twisted.internet import reactor
You can’t perform that action at this time.