From 84d6383e7e10df0b7e3e5dfc839fe7c68657d133 Mon Sep 17 00:00:00 2001 From: Hendrik Jäger Date: Fri, 22 Oct 2021 22:42:16 +0200 Subject: autoload functions part 2 --- .zsh_functions/henkspngpostproc | 24 ++++++++++++++++++++++++ .zsh_functions/henkspwgen | 1 + .zsh_functions/movies_biggest | 3 +++ .zsh_functions/movies_forgotten | 3 +++ .zsh_functions/movies_newest | 3 +++ .zsh_functions/movies_oldest | 3 +++ .zsh_functions/movies_smallest | 3 +++ .zsh_functions/mpvshuffledir | 4 ++++ .zsh_functions/new_hs_project | 3 +++ .zsh_functions/pause_stardew | 7 +++++++ .zsh_functions/vifind | 1 + 11 files changed, 55 insertions(+) create mode 100644 .zsh_functions/henkspngpostproc create mode 100644 .zsh_functions/henkspwgen create mode 100644 .zsh_functions/movies_biggest create mode 100644 .zsh_functions/movies_forgotten create mode 100644 .zsh_functions/movies_newest create mode 100644 .zsh_functions/movies_oldest create mode 100644 .zsh_functions/movies_smallest create mode 100644 .zsh_functions/mpvshuffledir create mode 100644 .zsh_functions/new_hs_project create mode 100644 .zsh_functions/pause_stardew create mode 100644 .zsh_functions/vifind (limited to '.zsh_functions') diff --git a/.zsh_functions/henkspngpostproc b/.zsh_functions/henkspngpostproc new file mode 100644 index 0000000..8260b1e --- /dev/null +++ b/.zsh_functions/henkspngpostproc @@ -0,0 +1,24 @@ + local resize_by + local img + resize_by="$1" + shift + echo "Creating Directories …" + mkdir --parents resized/pngnqed/optipnged optimized + for img in $* + do + echo "Resizing image …" + convert -resize $resize_by% "$img" "resized/$img" + echo "Running pngnq …" + pngnq -s1 -f -d "resized/pngnqed" -e .png "resized/$img" + echo "Running optipng …" + optipng -force -out "resized/pngnqed/optipnged/$img" "resized/pngnqed/$img" + echo "Moving final image to directory 'optimized' …" + cp --verbose --interactive --target-directory=optimized/ "resized/pngnqed/optipnged/$img" + echo "Removing temporary images …" + #rm --verbose --interactive \ + rm --verbose \ + "resized/$img" \ + "resized/pngnqed/$img" \ + "resized/pngnqed/optipnged/$img" + done + rmdir --parents resized/pngnqed/optipnged diff --git a/.zsh_functions/henkspwgen b/.zsh_functions/henkspwgen new file mode 100644 index 0000000..584a706 --- /dev/null +++ b/.zsh_functions/henkspwgen @@ -0,0 +1 @@ + echo $( (tr -cd '[:alnum:]' | head -c $1) < /dev/urandom) diff --git a/.zsh_functions/movies_biggest b/.zsh_functions/movies_biggest new file mode 100644 index 0000000..9170c0f --- /dev/null +++ b/.zsh_functions/movies_biggest @@ -0,0 +1,3 @@ + mpv ${=MPVOPTS} \ + (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(OL) \ + $@ diff --git a/.zsh_functions/movies_forgotten b/.zsh_functions/movies_forgotten new file mode 100644 index 0000000..10703fa --- /dev/null +++ b/.zsh_functions/movies_forgotten @@ -0,0 +1,3 @@ + mpv ${=MPVOPTS} \ + (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(Oa) \ + $@ diff --git a/.zsh_functions/movies_newest b/.zsh_functions/movies_newest new file mode 100644 index 0000000..482fba8 --- /dev/null +++ b/.zsh_functions/movies_newest @@ -0,0 +1,3 @@ + mpv ${=MPVOPTS} \ + (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(om) \ + $@ diff --git a/.zsh_functions/movies_oldest b/.zsh_functions/movies_oldest new file mode 100644 index 0000000..d912b00 --- /dev/null +++ b/.zsh_functions/movies_oldest @@ -0,0 +1,3 @@ + mpv ${=MPVOPTS} \ + (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(Om) \ + $@ diff --git a/.zsh_functions/movies_smallest b/.zsh_functions/movies_smallest new file mode 100644 index 0000000..711e1da --- /dev/null +++ b/.zsh_functions/movies_smallest @@ -0,0 +1,3 @@ + mpv ${=MPVOPTS} \ + (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx)(oL) \ + $@ diff --git a/.zsh_functions/mpvshuffledir b/.zsh_functions/mpvshuffledir new file mode 100644 index 0000000..927c15b --- /dev/null +++ b/.zsh_functions/mpvshuffledir @@ -0,0 +1,4 @@ + mpv ${=MPVOPTS} \ + --shuffle \ + (#i)${1:-.}/**/*.(mpeg|webm|avi|flv|mkv|mpg|wmv|wva|mp4|wva|m4v|ogm|mp4|mov|divx) \ + $@ diff --git a/.zsh_functions/new_hs_project b/.zsh_functions/new_hs_project new file mode 100644 index 0000000..43086c3 --- /dev/null +++ b/.zsh_functions/new_hs_project @@ -0,0 +1,3 @@ + stack new $1 simple + cd $1 + git init diff --git a/.zsh_functions/pause_stardew b/.zsh_functions/pause_stardew new file mode 100644 index 0000000..3604dd0 --- /dev/null +++ b/.zsh_functions/pause_stardew @@ -0,0 +1,7 @@ + while read bar + do + xdotool \ + search --class 'StardewValley' \ + windowactivate --sync \ + type --delay 100 t/pause + done diff --git a/.zsh_functions/vifind b/.zsh_functions/vifind new file mode 100644 index 0000000..5bf6e9a --- /dev/null +++ b/.zsh_functions/vifind @@ -0,0 +1 @@ + vi $(find $@) -- cgit v1.2.3