Skip to content

Instantly share code, notes, and snippets.

@fdr
fdr / experiment.sql
Created August 17, 2011 04:17
plv8 experiments and microbenchmarks
BEGIN;
-- plv8: http://code.google.com/p/plv8js/
CREATE OR REPLACE LANGUAGE plv8;
-- Create a function that grabs a passed key and coerces to bigint.
CREATE OR REPLACE FUNCTION plv8_project_key(key text, json_raw text)
RETURNS bigint AS $$
// This is javascript!
var o = JSON.parse(json_raw);
return o[key];
@fdr
fdr / libpq-be-fragment.h
Created October 8, 2011 18:52
port data structure from febe
typedef struct Port
{
pgsocket sock; /* File descriptor */
bool noblock; /* is the socket in non-blocking mode? */
ProtocolVersion proto; /* FE/BE protocol version */
SockAddr laddr; /* local addr (postmaster) */
SockAddr raddr; /* remote addr (client) */
char *remote_host; /* name (or ip addr) of remote host */
char *remote_hostname;/* name (not ip addr) of remote host, if
* available */
@fdr
fdr / libpq-be-fragment.h
Created October 8, 2011 18:53
port data structure from febe
typedef struct Port
{
pgsocket sock; /* File descriptor */
bool noblock; /* is the socket in non-blocking mode? */
ProtocolVersion proto; /* FE/BE protocol version */
SockAddr laddr; /* local addr (postmaster) */
SockAddr raddr; /* remote addr (client) */
char *remote_host; /* name (or ip addr) of remote host */
char *remote_hostname;/* name (not ip addr) of remote host, if
* available */
@fdr
fdr / wal-e-usage.txt
Created October 19, 2011 21:52
A snapshot of the usage strings in WAL-E
$ wal-e --help
usage: wal-e [-h] [-k AWS_ACCESS_KEY_ID] [--s3-prefix S3_PREFIX]
{backup-fetch,backup-list,backup-push,wal-fetch,wal-push,delete}
...
WAL-E is a program to assist in performing PostgreSQL continuous
archiving on S3: it handles pushing and fetching of WAL segments and
base backups of the PostgreSQL data directory.
optional arguments:
@fdr
fdr / postmasterpid.py
Created July 31, 2012 00:32
python port of postmaster pid file loop
#!/usr/bin/env python
import argparse
import collections
import daemon
import datetime
import errno
import os
import re
import subprocess
import sys
@fdr
fdr / crash.txt
Created August 24, 2012 07:05
dredmor pocket dimension crash
Stdout:
...(truncated)
loading square: 74 55
loading square: 74 56
loading square: 74 57
loading square: 74 58
loading square: 74 59
loading square: 74 60
loading square: 74 61
loading square: 74 62
@fdr
fdr / pybuild.sh
Created November 28, 2012 17:42
Build python 3.3 in heroku
#!/bin/sh
set -uex
root=$(pwd)
cd /tmp
curl -LO http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tar.bz2
tar -jxvf Python-3.3.0.tar.bz2
@fdr
fdr / build.sh
Created December 28, 2012 08:49
Building clang on Heroku
#!/bin/sh
set -ue
curl -qO http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
curl -qO http://llvm.org/releases/3.2/clang-3.2.src.tar.gz
curl -qO http://llvm.org/releases/3.2/compiler-rt-3.2.src.tar.gz
tar -zxf llvm-3.2.src.tar.gz
tar -zxf clang-3.2.src.tar.gz
tar -zxf compiler-rt-3.2.src.tar.gz
@fdr
fdr / build.sh
Created January 9, 2013 01:19
hammer version of flex-bison-builder
#!/bin/bash
set -uex
install_cwd() {
./configure --prefix=/app/vendor
make -sj4
make -sj4 install
}
FLEX_DIRNAME=flex-2.5.37
@fdr
fdr / pr.md
Created May 13, 2013 00:17 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: