You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
function min-jpg {
|
|
|
|
tmpfile="$(mktemp)"
|
|
|
|
ogfile="$1"
|
|
|
|
jpegtran -optimize -perfect -outfile "$tmpfile" "$ogfile"
|
|
|
|
mv "$tmpfile" $ogfile
|
|
|
|
}
|
|
|
|
|
|
|
|
function min-png {
|
|
|
|
tmpfile="$(mktemp)"
|
|
|
|
ogfile="$1"
|
|
|
|
pngcrush -rem alla -reduce -brute "$ogfile" "$tmpfile"
|
|
|
|
mv "$tmpfile" "$ogfile"
|
|
|
|
}
|
|
|
|
|
|
|
|
function get-create-date {
|
|
|
|
date -r "$1" +"%F"
|
|
|
|
}
|
|
|
|
|
|
|
|
function add-date-prefix {
|
|
|
|
DIR=$(dirname "$1")
|
|
|
|
FILE=$(basename "$1")
|
|
|
|
DATE=$(date -r "$1" +"%F")
|
|
|
|
mv "$1" "$DIR/$DATE_$FILE"
|
|
|
|
}
|
|
|
|
|
|
|
|
function get-bitrate {
|
|
|
|
exiftool -AudioBitrate "$1" | awk '{print $4}'
|
|
|
|
}
|
|
|
|
|
|
|
|
function deepgrep {
|
|
|
|
find . \
|
|
|
|
-type d -name node_modules -prune -o \
|
|
|
|
-type d -name .git -prune -o \
|
|
|
|
-type f \
|
|
|
|
-not -name "*.swp" \
|
|
|
|
-not -name "*.pyc" \
|
|
|
|
-exec grep --with-filename --color "$@" {} \;
|
|
|
|
}
|