Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# Output:
# TSV
# hits_date.tsv
# date, count, status, host, path
dates = [
"2013-10-19",
"2013-10-20",
@philandstuff
philandstuff / russ-garrett.org
Created March 7, 2014 15:53
russ garrett talking about postgres

russ garrett on postgres

  • I like it as a default database when I don’t know what database I want to use

schemas

  • 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

schema changes often aren’t great

  • this is why people don’t like schemas
@rgarner
rgarner / psql-cheat-sheet.md
Last active August 29, 2015 14:02
Developer's new-to-PSQL cheat sheet

PSQL cheat sheet

Starting it (examples)

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>
@mhl
mhl / download-emusic.py
Created May 4, 2015 14:45
An old script for downloading albums from EMusic, no idea if it still works
#!/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)
@ashb
ashb / git-crypt-delete
Last active January 14, 2019 17:29
git-crypt-delete
#!/bin/bash -e
set -o pipefail
case "$1" in
--list|-l)
list_only=1
;;
--dry-run|-n)
@digitalronin
digitalronin / gist:ca4835b0900c27697d96318221611d2e
Last active December 2, 2019 14:42
My git setup for faster pull-requests
# 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)'