1
0
This commit is contained in:
2024-02-05 23:28:28 +01:00
parent 16253c1cbe
commit b9508955be
22 changed files with 488 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
cpv() {
rsync -pogbr -hhh --backup-dir=/tmp/rsync -e /dev/null --progress "$@"
}
compdef _files cpv

View File

@@ -0,0 +1,9 @@
# vim:et sts=2 sw=2 ft=zsh
#
# Display ip of the docker container passed as arg
#
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${1}
compdef _files dip

View File

@@ -0,0 +1,10 @@
# vim:et sts=2 sw=2 ft=zsh
#
# Get .gitignore from distant api
#
function gi() {
curl -sLw "\n" https://www.toptal.com/developers/gitignore/api/"$@" ;
}
compdef _files gi

View File

@@ -0,0 +1,23 @@
# vim:et sts=2 sw=2 ft=zsh
#
# Display public ip information
#
URL="ipinfo.io?token=$(pass _api_keys/ipinfo_perso-0)"
case "${1}" in
(-a)
curl --silent -L ${URL} > /dev/null | jq ;;
(-c)
curl --silent -L ${URL} > /dev/null | jq '.city';;
(-C)
curl --silent -L ${URL} > /dev/null | jq '.country';;
(-i)
curl --silent -L ${URL} > /dev/null | jq '.ip';;
(-r)
curl --silent -L ${URL} > /dev/null | jq '.region';;
(*)
curl --silent -L ${URL} > /dev/null | jq ;;
esac
compdef _files gip

View File

@@ -0,0 +1,6 @@
shrinkpdf() {
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$(basename -s .pdf ${1})_shrink.pdf" "${1}"
}
compdef _files shrinkpdf

View File

@@ -0,0 +1,12 @@
update_auth_sock() {
local socket_path="$(tmux show-environment | sed -n 's/^SSH_AUTH_SOCK=//p')"
if ! [[ "$socket_path" ]]; then
echo 'no socket path' >&2
return 1
else
export SSH_AUTH_SOCK="$socket_path"
fi
}
compdef _files update_auth_sock