From be45e954a33b61f6ddbafac2a816e4c47b0e9113 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 27 Mar 2018 18:27:52 +0100 Subject: [PATCH] Add image compression functions and qmv alias --- config/oh-my-zsh/aliases.zsh | 3 +++ config/oh-my-zsh/functions.zsh | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/config/oh-my-zsh/aliases.zsh b/config/oh-my-zsh/aliases.zsh index b1abe020..8703e292 100644 --- a/config/oh-my-zsh/aliases.zsh +++ b/config/oh-my-zsh/aliases.zsh @@ -11,6 +11,9 @@ alias ls='ls -F --color=auto' # Make tree add indicators and color alias tree='tree -F -C' +# Make qmv open on 1 column mode +alias qmv='qmv -f do' + alias msfconsole="msfconsole --quiet -x \"db_connect msf@msf\"" #Start cups diff --git a/config/oh-my-zsh/functions.zsh b/config/oh-my-zsh/functions.zsh index 209b0137..e2150356 100644 --- a/config/oh-my-zsh/functions.zsh +++ b/config/oh-my-zsh/functions.zsh @@ -188,3 +188,29 @@ searchphp() { searchhtml() { grep -r -i -n --color="always" --include=\*.{html,htm} "$1" . } + +png() { + pngcrush -brute "$1"{,.} && du -b "$1"{,.} +} +gif() { + gifsicle -O "$1" -o "$1." && du -b "$1"{,.} +} +jpeg() { + jpegtran "$1" > "$1." && du -b "$1"{,.} +} +# Just for easy access in history +mpng() { + mv "$1"{.,} +} +mgif() { + newsize=$(wc -c <"$1.") + oldsize=$(wc -c <"$1") + if [ $oldsize -gt $newsize ] ; then + mv "$1"{.,} + else + rm "$1." + fi +} +mjpeg() { + mv "$1"{.,} +}