Skip to content

Instantly share code, notes, and snippets.

View msammarco's full-sized avatar
👨‍🔬

Matt Sammarco msammarco

👨‍🔬
View GitHub Profile
@msammarco
msammarco / smartresize.fish
Last active February 28, 2020 16:16
Fish Shell Image Resizing
### smartresize inputfile.jpeg
# Credit goes to https://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/
# Resize one image in place either jpg or png
function smartresize
mogrify -path . -filter Triangle -define filter:support=2 -unsharp 0.25x0.08+8.3+0.045 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB $argv
end
### smartresize_to_webp_dir image_type_extension
# Resize all extension type to webp images in directory to 80% quality
# eg. smartresize_to_webp_dir jpg

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 &