Skip to content

Instantly share code, notes, and snippets.

@sriedel
sriedel / gist:1682210
Created January 26, 2012 10:49
Generate nicknames phonetically
class NicknameGenerator
# Grabbed phoneme and template list from http://www.flipcode.com/archives/misc/NameData.xml
# Based on an idea presented on http://www.flipcode.com/archives/Generating_Names_Phonetically.shtml
# by Jim Adams (jadams@copernus.com), 2000
# (sr 2012-01-26)
PHONEME_LIST = { # consonants
:affricate => %w{ch dg j},
:alveolar => %w{d l n r s t z},
:bilabial => %w{b m p},
:bilabial_stop => %w{b p},
@sriedel
sriedel / remove_fk_constraints.sql
Created January 13, 2011 07:38
Remove FK constraints from postgres database
select 'ALTER TABLE ' || t.table_name || ' DROP CONSTRAINT ' || t.constraint_name || ';'
from information_schema.table_constraints t
where t.constraint_type = 'FOREIGN KEY';
#!/usr/bin/python
### Example usage: $0 {symbolic-host1} {s-h2} ... {s-host12}
from be_setup import *
from wrap_systest_cluster_membership import *
import sys, time
symbolic_hosts = sys.argv[1:]
@sriedel
sriedel / post-checkout
Created October 20, 2010 05:59
Post Commit hook to auto-update submodules
#!/bin/bash
pushd . # save current place in filesystem
until [ -d .git ] || $(pwd) = "/" ; do # look for project root
cd ..
done
if [ -d .git ] ; then # if we found it...
git submodule update
fi
SELECT idx.relname as table,
idx.indexrelname as index,
pg_relation_size( idx.indexrelname::text ) as bytes,
cls.relpages as pages,
cls.reltuples as tuples,
idx.idx_scan as scanned,
idx.idx_tup_read as read,
idx.idx_tup_fetch as fetched
FROM pg_stat_user_indexes idx,
pg_class cls ,