Skip to content

Instantly share code, notes, and snippets.

View quiver's full-sized avatar

George Yoshida quiver

View GitHub Profile
create table users(
userid integer not null,
username char(8),
firstname varchar(30),
lastname varchar(30),
city varchar(30),
state char(2),
email varchar(100),
phone char(14),
likesports boolean,
copy users from '/tmp/s3/allusers_pipe.txt' with null as '' delimiter '|';
copy venue from '/tmp/s3/venue_pipe.txt' delimiter '|';
copy category from '/tmp/s3/category_pipe.txt' with null as '' delimiter '|';
copy date from '/tmp/s3/date2008_pipe.txt' with null as '' delimiter '|';
copy event from '/tmp/s3/allevents_pipe.txt' with null as '' delimiter '|';
copy listing from '/tmp/s3/listings_pipe.txt' with null as '' delimiter '|';
copy sales from '/tmp/s3/sales_tab.txt' with null as '' delimiter '\t';
@quiver
quiver / copy.sql
Created April 19, 2014 09:45
redshift_cstore_fdw
copy users from '/tmp/s3/allusers_pipe.txt' with null as '' delimiter '|';
copy venue from '/tmp/s3/venue_pipe.txt' delimiter '|';
copy category from '/tmp/s3/category_pipe.txt' with null as '' delimiter '|';
copy date from '/tmp/s3/date2008_pipe.txt' with null as '' delimiter '|';
copy event from '/tmp/s3/allevents_pipe.txt' with null as '' delimiter '|';
copy listing from '/tmp/s3/listings_pipe.txt' with null as '' delimiter '|';
copy sales from '/tmp/s3/sales_tab.txt' with null as '' delimiter '\t';
@quiver
quiver / .screenrc
Created July 5, 2014 02:33
screen conf
escape ^Z^\
vbell off
# don't show startup messages
startup_message off
# detach on hangup - if my dial-up session fails, screen will simply
# detach and let me re re-attach later.
autodetach on
@quiver
quiver / waiters-2.json
Created June 1, 2015 01:44
aws cli machinelearning waiter
{
"version": 2,
"waiters": {
"DataSourceAvailable": {
"delay": 30,
"operation": "GetDataSource",
"maxAttempts": 60,
"acceptors": [
{
"expected": "COMPLETED",
@quiver
quiver / create-stack.dot
Created August 17, 2015 15:30
AWS cloudformation StackStatus
/*
* http://www.graphviz.org/
* $ dot -Tpng test.dot -o test.png
* rollback can be disabled
*/
digraph create_stack {
CreateStack_API [shape=box];
DeleteStack_API[shape=box];
CREATE_COMPLETE [style=filled,color=blue]; // OK
CREATE_FAILED [style=filled,color=red]; // NG
@quiver
quiver / stack_issue08.diff
Created September 7, 2011 09:58
Py-StackExchange issue#8
diff --git a/stackexchange/__init__.py b/stackexchange/__init__.py
index c257838..32e3fb7 100644
--- a/stackexchange/__init__.py
+++ b/stackexchange/__init__.py
@@ -542,7 +542,7 @@ through here."""
try:
if isinstance(ob, datetime.datetime):
return str(time.mktime(ob.timetuple()))
- elif isinstance(ob, str):
+ elif isinstance(ob, basestring):
@quiver
quiver / client.py
Created September 16, 2012 10:54
Python port of half duplex FIFO program : http://developers.sun.com/solaris/articles/named_pipes.html
# Python port of half duplex FIFO program : http://developers.sun.com/solaris/articles/named_pipes.html
import sys
import config
def main():
if len(sys.argv) < 2:
print 'Usage : %s <string to be sent to the server>' % sys.argv[0]
sys.exit(0)
wr = open(config.HALF_DUPLEX, 'wb')
@quiver
quiver / client.py
Created September 22, 2012 09:12
Michael Kerrisk : "The Linux Programming Interface" CH.44 : sequence number server(Python Implementation)
# Michael Kerrisk : "The Linux Programming Interface" CH.44 : sequence number server(Python Implementation)
# fifo_seqnum_client
import atexit
import os
import struct
import sys
import config
@quiver
quiver / counting_bloom_filter.py
Created September 29, 2012 02:29
counting bloom filter
# http://en.wikipedia.org/wiki/Bloom_filter#Counting_filters
# http://www.michaelnielsen.org/ddi/why-bloom-filters-work-the-way-they-do/
import hashlib
class BloomFilter(object):
def __init__(self, m, k):
self.m = m
self.k = k
self.array = [0 for i in range(m)]