ZSHFiles/custom/functions.zsh

48 lines
1.5 KiB
Bash

function gitsubrepo {
find * -maxdepth 1 -mindepth 1 -type d -name ".git" -exec sh -c '(DIR={}; DIR=${DIR%%.git} && cd $DIR && echo $DIR && git status -s)' \;
}
function osutab {
xinput set-prop 'UGTABLET 6 inch PenTablet Pen (0)' --type=float 153 3.5 0 -0.5 0 2.9 0 0 0 1
}
function tonullpointer {
if [ -z ${1} ]; then
RANDFN=${RANDOM}
> /tmp/${RANDFN}
curl -F"file=@/tmp/${RANDFN}" http://0x0.st
rm /tmp/${RANDFN}
else
curl -F"file=@${1}" http://0x0.st
fi
}
function ffmpeg-gif {
ffmpeg -hwaccel vdpau -ss $2 -to $3 -i $1 -r 60 -pix_fmt bgr8 -vf "mpdecimate,normalize,scale=480:-1:flags=spline,split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -loop 0 $4
}
function ffmpeg-vid {
ffmpeg -hwaccel vdpau -ss $2 -to $3 -i $1 -r 60 -vf "normalize,scale=480:-1:flags=spline,mpdecimate" $4
}
function ffmpeg-compress {
ffmpeg -hwaccel vdpau -i $1 -vf "normalize,scale=480:-1:flags=spline,mpdecimate" $2
}
function getnhentai {
for i in {1..$1}; do
curl -sSLO --fail https://i.nhentai.net/galleries/${2}/${i}.png || \
curl -sSLO --fail https://i.nhentai.net/galleries/${2}/${i}.jpg;
done
for i in {1..9}.*; do
mv $i 0$i;
done
}
function man {
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
command man "$@"
}
function interval {
typeset -g CTIME=$(date +%s)
[[ $(( $CTIME - ${LASTCTIME:=0} )) -gt 60 ]] && typeset -g LASTCTIME=$CTIME || return
}