Skip to content

Instantly share code, notes, and snippets.

View msammarco's full-sized avatar
👨‍🔬

Matt Sammarco msammarco

👨‍🔬
View GitHub Profile

Keybase proof

I hereby claim:

  • I am msammarco on github.
  • I am msammarco (https://keybase.io/msammarco) on keybase.
  • I have a public key ASAJyb9iVCh4fGtjNGuhd_J7OvCEWUlTZaT16wFbiL0O5Qo

To claim this, I am signing this object:

-- Does just diffing between dates
CREATE OR REPLACE FUNCTION DATEDIFF(units VARCHAR(30), date, date)
RETURNS int
LANGUAGE sql
AS
$$
SELECT abs(($2 - $3)::INTEGER) as DateDifference
$$;
@msammarco
msammarco / Docker Cleanup
Created January 5, 2016 20:21
Clean up docker files on mac osx
#!/bin/sh
# Cleanup docker files: untagged containers and images.
#
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}'
@msammarco
msammarco / tmux.cheat
Last active August 29, 2015 13:57 — forked from afair/tmux.cheat
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &