Separate files

This commit is contained in:
Alex 2020-04-06 23:30:24 +02:00
parent 851f370783
commit e0870220d8
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
8 changed files with 94 additions and 91 deletions

2
.zshenv Normal file
View File

@ -0,0 +1,2 @@
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
export EDITOR=vim

View File

@ -1,3 +1,7 @@
source "${ZDOTDIR}/custom/aliases.zsh"
source "${ZDOTDIR}/custom/dirstack.zsh"
source "${ZDOTDIR}/custom/docker.zsh"
source "${ZDOTDIR}/custom/functions.zsh"
source "${ZDOTDIR}/custom/gpg.zsh"
source "${ZDOTDIR}/custom/prependsudo.zsh"
source "${ZDOTDIR}/custom/others.zsh"
source "${ZDOTDIR}/custom/segments.zsh"

5
custom/aliases.zsh Normal file
View File

@ -0,0 +1,5 @@
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'

5
custom/docker.zsh Normal file
View File

@ -0,0 +1,5 @@
export DOCKER_HOST=ssh://nbg-0
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
}

47
custom/functions.zsh Normal file
View File

@ -0,0 +1,47 @@
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
}

7
custom/gpg.zsh Normal file
View File

@ -0,0 +1,7 @@
# 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

View File

@ -1,90 +0,0 @@
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'

23
custom/segments.zsh Normal file
View File

@ -0,0 +1,23 @@
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 _mpris_LASTRESP=${_mpris_RESP:=0}
typeset -g _mpris_RESP="$(qdbus org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata 2>/dev/null)"
if [[ $_mpris_RESP != $_mpris_LASTRESP ]]; then
typeset -g _mpris_RFMT="$(print ${_mpris_RESP} | grep -oP '(?<=^xesam:title: ).+')"
local ARTIST="$(print ${_mpris_RESP} | grep -oP '(?<=^xesam:artist: ).+')"
[ ! -z ${ARTIST} ] && _mpris_RFMT="${ARTIST} - ${_mpris_RFMT}"
fi
p10k segment -b purple -i '' -t "${_mpris_RFMT}" -c "${_mpris_RFMT}"
}
function prompt_new_mail() {
interval && typeset -g _new_mail_MAILS=$(find ~/Mail/*/Inbox/new -type f | wc -l)
p10k segment -b yellow -i '' -t "${_new_mail_MAILS}" -c "${_new_mail_MAILS/#%0}"
}
function prompt_pacman_upgrade() {
interval && typeset -g _upgrade_PACKAGES=$(pacman -Qu | wc -l)
p10k segment -b cyan -i '' -t "${_upgrade_PACKAGES}" -c "${_upgrade_PACKAGES/#%0}"
}
typeset -g POWERLEVEL9K_PACMAN_UPGRADE_SHOW_ON_COMMAND='pacman'