Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Matt Sammarco msammarco

🚀
View GitHub Profile
@msammarco
msammarco / smartresize.fish
Last active Feb 28, 2020
Fish Shell Image Resizing
View smartresize.fish
### 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
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.