Command (shell) | Does this |
---|---|
psql |
Starts psql connected to your own user's database |
psql -d <database> |
Starts psql connected to the given <database> |
cat some.sql | psql -d <database> |
Runs the SQL script in some.sql on <database> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hub & GHI (assumes you have homebrew installed) | |
brew install hub # https://github.com/github/hub | |
brew install ghi # https://github.com/stephencelis/ghi | |
# You will need env vars like this: EDITOR=vim, GIT_EDITOR=vim | |
# Aliases | |
alias gch='git checkout' | |
alias prune-local-branches='git branch | grep -v master | xargs git branch -d' | |
alias push-branch='git push origin $(git rev-parse --abbrev-ref HEAD)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
set -o pipefail | |
case "$1" in | |
--list|-l) | |
list_only=1 | |
;; | |
--dry-run|-n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
from subprocess import check_call | |
from lxml import etree | |
if len(sys.argv) != 2: | |
print >> sys.stderr, "Usage: %s [EMX-FILE]" % (sys.argv[0]) | |
sys.exit(1) |
- I like it as a default database when I don’t know what database I want to use
- I like schemas and I hate schemaless databases
- it’s useful to be able to enforce your schema before the data
gets written to disk
- rather than in your ORM!
- CHECK constraints: ensure balance >= 0
- this is why people don’t like schemas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Output: | |
# TSV | |
# hits_date.tsv | |
# date, count, status, host, path | |
dates = [ | |
"2013-10-19", | |
"2013-10-20", |