Instantly share code, notes, and snippets.

View agg.sql
CREATE AGGREGATE array_accum (anyarray)
(
sfunc = array_cat,
stype = anyarray,
initcond = '{}'
);
View zim-wiki-mac-osx-app.md
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
View vimrc
"copy from http://publius-ovidius.livejournal.com/242806.html
set nocompatible
set bs=2
set expandtab
set ts=4
set shiftwidth=4
set textwidth=78
set nowrap
set ruler
set autowrite
View System Design.md

#System Design Interview Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
View MyExampleCalls.pm
# Copyrights 2007-2012 by Mark Overmeer.
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.00.
# This pm file demonstrates how a client-side and server-side definition
# of a message can be created, in case there is no WSDL for the SOAP
# interface. This same module is used in both client.pl and server.pl.
package MyExampleCalls;
View soap-calculator-client.pl
#!/usr/bin/env perl
use warnings;
use strict;
use XML::Compile::WSDL11;
use XML::Compile::SOAP11;
use XML::Compile::Transport::SOAPHTTP;
use HTTP::Tiny;
View 58_logger.pl
package Logger;
use Moose;
has 'fout', is => 'ro', lazy_build => 1;
has 'filename', is => 'ro';
sub _build_fout {
my $self = shift;
my $fh;
View 76.pl
package Course;
use Moose;
has 'students' => (
is => 'ro',
isa => 'ArrayRef[Student]',
default => sub { [] },
);
sub add_student {