91 lines
3.5 KiB
Bash
91 lines
3.5 KiB
Bash
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
|
export EDITOR=vim
|
|
export DOCKER_HOST=ssh://nbg-0
|
|
|
|
# GPG SSH
|
|
unset SSH_AGENT_PID
|
|
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
|
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
|
fi
|
|
export GPG_TTY=$(tty)
|
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
|
|
|
function build-n-push {
|
|
docker build ${1} --tag=localhost:5000/${2} --force-rm --compress && docker push localhost:5000/${2} # --squash can eat disk space quickly due to diffs not being taken in calculation
|
|
}
|
|
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
|
|
}
|
|
alias recordscreen='ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :0 -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -crf 0 -vf "deflate,mpdecimate"'
|
|
alias ytdldown='youtube-dl --no-part --newline -ixcw --audio-format best --add-metadata --embed-thumbnail -o "/home/caskd/Media/Music/%(album)s/%(track)s.%(ext)s"'
|
|
alias ls='ls --color=auto'
|
|
alias grep='grep --color=auto'
|
|
alias diff='diff --color=auto'
|
|
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
|
|
}
|
|
function prompt_docker_host() {
|
|
p10k segment -b blue -i '' -t "${DOCKER_HOST#*://}" -c "${DOCKER_HOST}"
|
|
}
|
|
typeset -g POWERLEVEL9K_DOCKER_HOST_SHOW_ON_COMMAND='docker'
|
|
function prompt_dbus_mpris() {
|
|
typeset -g LASTRESP=${RESP:=0}
|
|
typeset -g RESP="$(qdbus org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata 2>/dev/null)"
|
|
if [[ $RESP != $LASTRESP ]]; then
|
|
RFMT="$(print ${RESP} | grep -oP '(?<=^xesam:title: ).+')"
|
|
ARTIST="$(print ${RESP} | grep -oP '(?<=^xesam:artist: ).+')"
|
|
[ ! -z ${ARTIST} ] && RFMT="${ARTIST} - ${RFMT}"
|
|
fi
|
|
p10k segment -b purple -i '' -t "${RFMT}" -c "${RFMT}"
|
|
}
|
|
function prompt_new_mail() {
|
|
interval && local MAILS=$(find ~/Mail/*/Inbox/new -type f | wc -l)
|
|
p10k segment -b yellow -i '' -t "${MAILS}" -c "${MAILS/#%0}"
|
|
}
|
|
function prompt_pacman_upgrade() {
|
|
interval && local PACKAGES=$(pacman -Qu | wc -l)
|
|
p10k segment -b cyan -i '' -t "${PACKAGES}" -c "${PACKAGES/#%0}"
|
|
}
|
|
typeset -g POWERLEVEL9K_PACMAN_UPGRADE_SHOW_ON_COMMAND='pacman'
|