Skip to content

Instantly share code, notes, and snippets.

Matt Sammarco msammarco

Block or report user

Report or block msammarco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:5ebf5d34da90622ae63cc05a4e7db965

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:

View gist:4d3ec6b60459c7cdc2b57458194340f4
-- 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 Jan 5, 2016
Clean up docker files on mac osx
View Docker Cleanup
#!/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'}'
View 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 &
You can’t perform that action at this time.