Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

CREATE TABLE city
(name varchar (35),
country varchar (35),
pop real,
capital boolean,
shape char(15),
primary key (name))
;
# postgres / docker
# first install docker on your mac, and start it. you should see the whale widget in task bar
# pull the docker postgres image (for more info see, https://hub.docker.com/_/postgres/ )
docker pull postgres
# run your new sql container
docker run --name tricker-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
# see the active docker containers
#!/usr/local/bin/python
import argparse
import sys
import time
from selenium import webdriver
parser = argparse.ArgumentParser(description='email ire reducer')
parser.add_argument('-u','--username', help='your user.name', required=True)
@tricker
tricker / gist:8010393
Created December 17, 2013 18:44
Raspberry Pi Image capture and upload shell script
#!/bin/bash
NOW=$(date +"%m/%d/%Y %H:%M")
THIS_PATH="/home/pi/src"
CITY="NYC"
raspistill -o $THIS_PATH/$CITY-cam-in.jpg -q 50 -w 1000 -h 700
convert $THIS_PATH/$CITY-cam-in.jpg -background black -fill white label:"$CITY Raspberry Pi Cam - $NOW" \
+swap -gravity Center -append $THIS_PATH/$CITY-cam.jpg
@tricker
tricker / .gitconfig
Last active December 13, 2015 18:29
[color]
ui = auto
[user]
name = Me
email = Me@mailinator.com
[alias]
br = branch
ci = commit
co = checkout
st = status
[color]
ui = auto
[user]
name = Todd
email = todd@zzz.com
[alias]
br = branch
ci = commit
co = checkout
st = status
@tricker
tricker / gist:2586007
Created May 3, 2012 14:32
string database changelog lines
s/^.+DATABASECHANGELOG.+$//;
@tricker
tricker / ddl-helper
Created April 30, 2012 21:49
Yet another file parser
#!/usr/bin/perl
open INFILE, "input.sql" or die $!;
open OUTFILE, ">output.sql" or die $!;
while (<INFILE>) {
if (/^(?:(?!\s+\);).)*$/s) {
s/;/\//;
}
print OUTFILE;
@tricker
tricker / gist:2414640
Created April 18, 2012 16:15
Simple csv file parser, takes infile, adds a time where appropriate, writes to outfile. All should reside in the same directory.
#!/usr/bin/perl
open INFILE, "fin2_tran.csv" or die $!;
open OUTFILE, ">fin2_out.csv" or die $!;
while (<INFILE>) {
s/,(\d{4}-\d{2}-\d{2})(,[^,]+$)/,"$1 11:00:00"$2/;
print OUTFILE;
}
# export data to file
mysqldump -uroot -ppassword hornet > hornet-dump.sql
# Drop database schema
mysqladmin -uroot -ppassword –f drop hornet
# create empty database schema
mysqladmin –uroot –ppassword create hornet
# push dump file into new database schema