From 4cd93b09b3a179515630114078739564a35af38d Mon Sep 17 00:00:00 2001 From: katherine Date: Sun, 19 Feb 2017 03:47:19 -0700 Subject: move remaining funcs from .zshrc everything should be modular now also, cleaned up make-gif to properly parse arguments and check things --- .config/init/funcreqs/b2h | 2 + .config/init/funcreqs/make-gif | 2 + .config/init/funcreqs/mpd-filetypes | 2 + .config/init/funcreqs/spam | 2 + .config/init/funcreqs/ssh-scrot | 2 + .config/init/funcs/b2h | 14 ++++++ .config/init/funcs/make-gif | 97 ++++++++++++++++++++++++++++++++++++ .config/init/funcs/mpd-filetypes | 99 +++++++++++++++++++++++++++++++++++++ .config/init/funcs/spam | 25 ++++++++++ .config/init/funcs/ssh-scrot | 45 +++++++++++++++++ 10 files changed, 290 insertions(+) create mode 100644 .config/init/funcreqs/b2h create mode 100644 .config/init/funcreqs/make-gif create mode 100644 .config/init/funcreqs/mpd-filetypes create mode 100644 .config/init/funcreqs/spam create mode 100644 .config/init/funcreqs/ssh-scrot create mode 100755 .config/init/funcs/b2h create mode 100755 .config/init/funcs/make-gif create mode 100755 .config/init/funcs/mpd-filetypes create mode 100755 .config/init/funcs/spam create mode 100755 .config/init/funcs/ssh-scrot (limited to '.config') diff --git a/.config/init/funcreqs/b2h b/.config/init/funcreqs/b2h new file mode 100644 index 0000000..b3cc909 --- /dev/null +++ b/.config/init/funcreqs/b2h @@ -0,0 +1,2 @@ +func_init_prereqs=(ffmpeg) +func_init_checks=() diff --git a/.config/init/funcreqs/make-gif b/.config/init/funcreqs/make-gif new file mode 100644 index 0000000..e5d0a9e --- /dev/null +++ b/.config/init/funcreqs/make-gif @@ -0,0 +1,2 @@ +func_init_prereqs=(grep bc) +func_init_checks=() diff --git a/.config/init/funcreqs/mpd-filetypes b/.config/init/funcreqs/mpd-filetypes new file mode 100644 index 0000000..4ddbbd7 --- /dev/null +++ b/.config/init/funcreqs/mpd-filetypes @@ -0,0 +1,2 @@ +func_init_prereqs=(mpd) +func_init_checks=("stat $HOME/music") diff --git a/.config/init/funcreqs/spam b/.config/init/funcreqs/spam new file mode 100644 index 0000000..8365431 --- /dev/null +++ b/.config/init/funcreqs/spam @@ -0,0 +1,2 @@ +func_init_prereqs=() +func_init_checks=() diff --git a/.config/init/funcreqs/ssh-scrot b/.config/init/funcreqs/ssh-scrot new file mode 100644 index 0000000..ba9e7fb --- /dev/null +++ b/.config/init/funcreqs/ssh-scrot @@ -0,0 +1,2 @@ +func_init_prereqs=(ssh scrot convert) +func_init_checks=() diff --git a/.config/init/funcs/b2h b/.config/init/funcs/b2h new file mode 100755 index 0000000..3a8d15a --- /dev/null +++ b/.config/init/funcs/b2h @@ -0,0 +1,14 @@ +#!/usr/bin/env zsh +# convert bits to human-readable value + +local suffixes=( 'B' 'K' 'M' 'G' 'T' 'P' 'E' 'Z' 'Y' ) +local sindex=1 +local val=$1 +[[ -z $(echo $1 | grep "^[0-9]*$") ]] && read val + +while [[ $(echo $val / 1024 | bc) -ne 0 ]]; do + val=$(echo "scale=2; $val / 1024" | bc) + let sindex=sindex+1 +done + +echo "${val}${suffixes[$sindex]}" diff --git a/.config/init/funcs/make-gif b/.config/init/funcs/make-gif new file mode 100755 index 0000000..7b3145c --- /dev/null +++ b/.config/init/funcs/make-gif @@ -0,0 +1,97 @@ +#!/usr/bin/env zsh +# export a clip from a video as a gif + +local callstr="$0" + +usage() { + [[ "$1" != "" ]] && echo -e "\e[1;31merror:\e[0m $1\n" + echo "Usage: $callstr [OPTIONS...] " + echo "" + echo "description option default val" + echo "start time -s