View delete_all.sql
BEGIN
FOR cur_rec IN (SELECT object_name, object_type
FROM all_objects
WHERE object_type IN ('TABLE', 'VIEW', 'PACKAGE', 'PROCEDURE', 'FUNCTION', 'SEQUENCE') AND
owner = '<schema_name>')
LOOP
BEGIN
IF cur_rec.object_type = 'TABLE' THEN
EXECUTE IMMEDIATE 'DROP ' || cur_rec.object_type || ' "' || cur_rec.object_name || '" CASCADE CONSTRAINTS';
ELSE
View gist:9127537
Search one project:
find . | grep -v Test | perl -nl -e 'if ($_ =~ /\/((\w+)\.java)/) { print length($2) . " $1"; }' | sort -nr | head -20
Search many projects and include project name in list:
find . -name '*.java' | grep -v Test | perl -nl -e 'if ($_ =~ /^\.\/(\w+)\/.*\/((\w+)\.java)$/) { print length($3) . " $2 - $1"; }' | sort -nr | grep -v mice | head -20
View README.md

Bubble charts encode data in the area of circles. Although less perceptually-accurate than bar charts, they can pack hundreds of values into a small space. Implementation based on work by Jeff Heer. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

View Postgres cache hit ratio
SELECT
sum(heap_blks_read) as heap_read,
sum(heap_blks_hit) as heap_hit,
sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) as ratio
FROM
pg_statio_user_tables;
View List postgres indexes and sizes
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 ,
View extension.js
(function() {
if (document.URL.match(/beermenus\.com\/places/)) {
var trs = document.getElementsByTagName("tr");
var minPpoz = null;
for (var i = 0; i < trs.length; i++) {
var tds = trs[i].children;
var name = null;
var serving = null;
var abv = null;
var price = null;
View gist:853024
I created a perl script:
#!/usr/bin/perl -w
my $dir = `pwd`;
chomp $dir;
$dir =~ s/\/trunk$//;
$dir = substr($dir, rindex($dir, "/") + 1);
print "\033]0;$dir\007";
Then set the PROMPT_COMMAND variable in my ~/.bash_profile:
View logTimes.pl
#!/usr/bin/perl -w
my @lines = <STDIN>;
my $totalTime = 0;
my $count = 0;
my @responseTimes = [];
for my $line (@lines) {
View gist:810079
protected <T> List<List<T>> permutate(List<T> list) {
if (list == null) {
return null;
} else if (list.size() == 1) {
return Arrays.asList(list);
} else if (list.size() == 2) {
List<T> revList = new ArrayList<T>();
revList.addAll(list);
Collections.reverse(revList);
return Arrays.asList(list, revList);
View Lost episode transcript crawler
#!/usr/bin/perl -w
use LWP::Simple;
use HTML::LinkExtor;
use Data::Dumper;
use DBI;
my $dbh = DBI->connect("DBI:mysql:db", "user", "password", {RaiseError => 1});
my $url = "http://lostpedia.wikia.com/wiki/Pilot,_Part_1_transcript";