Skip to content

Instantly share code, notes, and snippets.

@toastdriven
toastdriven / .tmux.conf
Created October 8, 2009 20:12
.tmux.conf
set -g prefix C-a
unbind C-b
bind C-a send-prefix
set bell-action none
set-option -g status-left ""
set-option -g status-right "#S"
set -g status-bg black
set -g status-fg white
set utf8-default on
@toastdriven
toastdriven / haystack.sh
Created October 9, 2009 05:30
haystack.sh
#!/bin/sh
# First, open up GitX
cd ~/Code/Python/django-haystack; gitx
tmux start-server
tmux new-session -d -s Haystack -n git
tmux new-window -tHaystack:1 -n test
tmux new-window -tHaystack:2 -n solr
tmux new-window -tHaystack:3 -n docs
tmux new-window -tHaystack:4 -n runserver
@jacobian
jacobian / gist:336445
Created March 18, 2010 15:06
Installing GeoDjango deps on Ubuntu 9.10
### Install some packages. Ignore the errors.
aptitude install binutils libgdal1-1.5.0 postgresql-8.3-postgis postgresql-server-dev-8.3 python-psycopg2 python-setuptools
### Make connecting to postgres easier
echo "local all all trust" > /etc/postgresql/8.3/main/pg_hba.conf
invoke-rc.d postgresql-8.3 reload
### Become the Postgres user to create a spatial template database:
votes CF
"back in black" => { 201005211200 => '1', 201005201159 => '1', 201005201157 => '1', 201005011900 => '1', 201004190600 => '1' },
"black album" => { 201005021800 => '1', 201005010600 => '1' },
"black star" => { 201005011000 => '1' }
cached_counts CF
"back in black" => { 'cached_count' => 2, 'counted_until' => 201005011931 },
"black album" => { 'cached_count' => 1, 'counted_until' => 201005010600 }
@jeromeetienne
jeromeetienne / twitter to irc from maushu
Created June 10, 2010 14:48
twitter to irc from maushu
#!/usr/local/bin/node
var sys = require('sys'),
http = require('http'),
querystring = require('querystring'),
base64 = require('./lib/base64'),
Buffer = require('buffer').Buffer,
Irc = require('./vendor/IRC/lib/irc');
var twitter_auth = { user: "<YOUR_TWITTER_USERNAME>", pass: "<YOUR_TWITTER_PASSWORD>"};
/*
dashbot.js
==========
Because the last thing you need during the competition is a heartless automaton
breathing down your neck...
Installation:
-------------
I needed to find info on a sequence that was causing problems with one of our apps, and couldn't find any info online. Here's what I ended up doing.
\d <sequence> wasn't telling me anything except that it did exist. I couldn't find out what was using it in order to determine if it was safe to eliminate.
select oid from pg_class where relname='<sequence>'; # retrieves the internal ID in PostgreSQL
select refobjid from pg_depend where objid = <found_oid>; # retrieve depenencies for the sequence in question.
select relname from pg_class where oid in (<ref_oid1>, # ... if others); # get the names that are linking to it
\d <found_tables> for each item found above - see if there's any mention of the index blowing up.
OR, after figuring this out, I kept working. Here's one query to rule them all:
/*
twirc.js
========
Automating Twitter messages to IRC. BSD license.
Installation:
-------------
* brew install node

NodeKO Tips on Joyent

Tip 1) Use process.env.PORT

Listen to process.env.PORT and fallback to port 8001 will make your life easier. By default process.env.PORT is set to port 80.

var http = require('http');

http.createServer(function (req, res) {

res.writeHead(200, {'Content-Type': 'text/plain'});

var sys = require('sys');
//
// Here's how prototypical inheritance works.
//
var Klass = function(val) {
this.value = val;
};