Skip to content

Instantly share code, notes, and snippets.

@jayzeng
jayzeng / clone.md
Last active December 28, 2016 23:35
clone table w/ primary key
create table mytable_clone (like mytable including defaults including constraints including indexes);

Slow queries:

SELECT (SELECT datname FROM pg_database WHERE dbid = oid), query, calls,  (total_time / 1000 / 60) as total_minutes, (total_time/calls) as average_time FROM pg_stat_statements ORDER BY total_time DESC limit 5;

Missing indexes

SELECT relname, seq_scan, seq_tup_read, idx_scan, seq_tup_read / seq_scan as ratio from pg_stat_user_tables where seq_scan > 0 order by seq_tup_read desc limit 10;
//ImageView angryHuskyImageView = (ImageView)findViewById(R.id.imageView);
//angryHuskyImageView.setTag("http://d24w6bsrhbeh9d.cloudfront.net/photo/a2zQDvw_700b.jpg");
Your YC username:
Company name:
Company url, if any:
Phone number(s):
Please enter the url of a 1 minute unlisted (not private) YouTube video introducing the founders. (Instructions.)
YC usernames of all founders, including you, e1ven, separated by spaces. (That's usernames, not given names: "bksmith," not "Bob Smith." If there are 3 founders, there should be 3 tokens in this answer.)
YC usernames of all founders, including you, e1ven, who will live in the Bay Area January through March if we fund you. (Again, that's usernames, not given names.)
What is your company going to make?
If this application is a response to a YC RFS, which one?
For each founder, please list: YC username; name; age; year of graduation, school, degree and subject for each degree; email address; personal url, github url, facebook id, twitter id; employer and title (if any) at last job before this startup. Put unfinished degrees in parens. List the main contact first. Separate founders with blank lines. Put an asterisk before t
@jayzeng
jayzeng / twilio.xml
Created August 11, 2013 03:39
twilio
<?xml version="1.0" encoding="UTF-8"?><Response><Say>Welcome to twilio!</Say></Response>
@jayzeng
jayzeng / download_bench.py
Created August 1, 2013 00:58
various ways to download a file, compare their time
import urllib2
import httplib
import os
import time
from urllib2 import Request, urlopen, URLError
def save_file(file):
output_filename = file.split("/")[-1]
if os.path.exists(output_filename):
@jayzeng
jayzeng / find.py
Created July 31, 2013 23:07
find files per pattern
import os
import fnmatch
def gen_find(filepath, loc):
for path, diralist, filelist in os.walk(loc):
for name in fnmatch.filter(filelist, filepath):
yield os.path.join(path, name)
pyfiles = gen_find('*.py', '.')
@jayzeng
jayzeng / get_sample.py
Created July 30, 2013 20:47
down load sample
import os
import logging
import argparse
from boto.s3.connection import S3Connection
def create_dir(type):
if not os.path.exists(type):
os.mkdir(type)
def get_aws_credentials():
@jayzeng
jayzeng / psql
Last active December 19, 2015 16:58
psql cheat sheet
\l list databases
\d list tables
\d table describe table
@jayzeng
jayzeng / list_repo.py
Created July 9, 2013 19:23
list repo
#!/usr/bin/env python
from github3 import login
def list_branches(token, target_repo):
github_login = login(token=token)
repos = github_login.iter_repos()
for r in repos:
if r.name == target_repo: