git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
BranchCommit messageAuthorAge
masterchore(release): prepare 1.11.0H. P. 4 days
testingchore(release): prepare for 1.11.1H. P. 4 days
 
TagDownloadAuthorAge
v1.11.1dotfiles-1.11.1.tar.bz2  H. P. 4 days
v1.11.0dotfiles-1.11.0.tar.bz2  H. P. 4 days
v1.10.0dotfiles-1.10.0.tar.bz2  H. P. 5 weeks
v1.9.1dotfiles-1.9.1.tar.bz2  H. P. 3 months
v1.9.0dotfiles-1.9.0.tar.bz2  H. P. 3 months
v1.8.0dotfiles-1.8.0.tar.bz2  H. P. 3 months
v1.7.1dotfiles-1.7.1.tar.bz2  H. P. 3 months
v1.7.0dotfiles-1.7.0.tar.bz2  H. P. 3 months
v1.6.0dotfiles-1.6.0.tar.bz2  H. P. 4 months
v1.2.8dotfiles-1.2.8.tar.bz2  H. P. 11 months
v1.2.7dotfiles-1.2.7.tar.bz2  H. P. 13 months
v1.2.6dotfiles-1.2.6.tar.bz2  H. P. 14 months
v1.2.5dotfiles-1.2.5.tar.bz2  H. P. 14 months
v1.2.4dotfiles-1.2.4.tar.bz2  H. P. 14 months
v1.2.3dotfiles-1.2.3.tar.bz2  H. P. 14 months
v1.2.2dotfiles-1.2.2.tar.bz2  H. P. 14 months
v1.2.1dotfiles-1.2.1.tar.bz2  H. P. 21 months
v1.2.0dotfiles-1.2.0.tar.bz2  H. P. 22 months
v1.1.0dotfiles-1.1.0.tar.bz2  H. P. 2 years
v1.0.0dotfiles-1.0.0.tar.bz2  H. P. 2 years
v0.9.5dotfiles-0.9.5.tar.bz2  H. P. 3 years
v0.9.4dotfiles-0.9.4.tar.bz2  H. P. 4 years
v0.9.3dotfiles-0.9.3.tar.bz2  H. P. 4 years
v0.9.2dotfiles-0.9.2.tar.bz2  H. P. 4 years
v0.9.1dotfiles-0.9.1.tar.bz2  H. P. 4 years
t-style: italic } /* Comment.PreprocFile */ .highlight .c1 { color: #aaaaaa; font-style: italic } /* Comment.Single */ .highlight .cs { color: #0000aa; font-style: italic } /* Comment.Special */ .highlight .gd { color: #aa0000 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #00aa00 } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #0000aa } /* Keyword.Constant */ .highlight .kd { color: #0000aa } /* Keyword.Declaration */ .highlight .kn { color: #0000aa } /* Keyword.Namespace */ .highlight .kp { color: #0000aa } /* Keyword.Pseudo */ .highlight .kr { color: #0000aa } /* Keyword.Reserved */ .highlight .kt { color: #00aaaa } /* Keyword.Type */ .highlight .m { color: #009999 } /* Literal.Number */ .highlight .s { color: #aa5500 } /* Literal.String */ .highlight .na { color: #1e90ff } /* Name.Attribute */ .highlight .nb { color: #00aaaa } /* Name.Builtin */ .highlight .nc { color: #00aa00; text-decoration: underline } /* Name.Class */ .highlight .no { color: #aa0000 } /* Name.Constant */ .highlight .nd { color: #888888 } /* Name.Decorator */ .highlight .ni { color: #880000; font-weight: bold } /* Name.Entity */ .highlight .nf { color: #00aa00 } /* Name.Function */ .highlight .nn { color: #00aaaa; text-decoration: underline } /* Name.Namespace */ .highlight .nt { color: #1e90ff; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #aa0000 } /* Name.Variable */ .highlight .ow { color: #0000aa } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #009999 } /* Literal.Number.Bin */ .highlight .mf { color: #009999 } /* Literal.Number.Float */ .highlight .mh { color: #009999 } /* Literal.Number.Hex */ .highlight .mi { color: #009999 } /* Literal.Number.Integer */ .highlight .mo { color: #009999 } /* Literal.Number.Oct */ .highlight .sa { color: #aa5500 } /* Literal.String.Affix */ .highlight .sb { color: #aa5500 } /* Literal.String.Backtick */ .highlight .sc { color: #aa5500 } /* Literal.String.Char */ .highlight .dl { color: #aa5500 } /* Literal.String.Delimiter */ .highlight .sd { color: #aa5500 } /* Literal.String.Doc */ .highlight .s2 { color: #aa5500 } /* Literal.String.Double */ .highlight .se { color: #aa5500 } /* Literal.String.Escape */ .highlight .sh { color: #aa5500 } /* Literal.String.Heredoc */ .highlight .si { color: #aa5500 } /* Literal.String.Interpol */ .highlight .sx { color: #aa5500 } /* Literal.String.Other */ .highlight .sr { color: #009999 } /* Literal.String.Regex */ .highlight .s1 { color: #aa5500 } /* Literal.String.Single */ .highlight .ss { color: #0000aa } /* Literal.String.Symbol */ .highlight .bp { color: #00aaaa } /* Name.Builtin.Pseudo */ .highlight .fm { color: #00aa00 } /* Name.Function.Magic */ .highlight .vc { color: #aa0000 } /* Name.Variable.Class */ .highlight .vg { color: #aa0000 } /* Name.Variable.Global */ .highlight .vi { color: #aa0000 } /* Name.Variable.Instance */ .highlight .vm { color: #aa0000 } /* Name.Variable.Magic */ .highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
#!/usr/bin/env bash
# vim:syntax=sh

# This file actually has aliases _and_ functions.

if [ "$TERM" != "dumb" ];then
	eval "$(dircolors -b)"
	alias ls="ls --color=auto"
	alias grep="grep --color=auto"
	alias egrep="egrep --color=auto"
fi
alias lst="ls -l --time-style=full-iso"
alias cls=' echo -ne "\033c"'
alias pip-update="sudo pip freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 sudo pip install -U"
alias matrix='cmatrix -sbu6 -C cyan'
alias tbc='tbclock -e -H2 -M7 -S3'
command -v colordiff >/dev/null 2>&1&&alias diff="colordiff"
#command -v colormake >/dev/null 2>&1&&alias make="colormake"
alias perllint="perl -Mstrict -Mdiagnostics -cw"
alias scredit='gimp "${SCRSHDIR}/$(ls -rt1 $SCRSHDIR/|tail -n1)"'
alias scrview='pqiv -i "${SCRSHDIR}/$(ls -rt1 $SCRSHDIR/|tail -n1)"'
alias scrls='ls -l "${SCRSHDIR}/$(ls -rt1 $SCRSHDIR/|tail -n1)"'
alias fuck='sudo $(history -p \!\!)'
alias x509-out='openssl x509 -text -certopt no_version,no_pubkey,no_sigdump,no_aux,no_header -noout -in'
alias isocreate='rm -vf /tmp/image.iso && mkisofs -v -r -J -translation-table -hide-joliet-trans-tbl -iso-level 4 -o /tmp/image.iso'
#alias isoburn='sudo cdrecord -v -speed=10 dev=/dev/sr0 -data'
alias isoburn='sudo cdrecord -v dev=/dev/sr0 -data'
# voice messages e.g. for whatsapp (on libpurple). use "voicemsg OUTPUT.ogg"
alias voicemsg='ffmpeg -f pulse -i default -ac 1 -ar 16000 -c:a libopus -y'
if command -v colordiff > /dev/null;then alias diff="colordiff";fi
# aliases like this are relevant if you use multiple passwordstore stores, e.g.
# your common store is a department-wide one but you still need to store personal credentials
alias ppass='PASSWORD_STORE_DIR=~/.password-store pass'
alias ifs='printf "%q\\n" "$IFS "'
# ----- CHOO CHOO ----- #
if command -v sl >/dev/null;then
	alias sl='sl -e'
	alias LS='LS -e'
fi
# ----- LIBVIRT ----- #
alias vl="virsh list --all --title"
alias vnl="virsh net-list --all"
# shellcheck disable=SC2154
alias vifl='for i in $(virsh list --name --all);do echo $i;virsh domiflist $i;done'
# shellcheck disable=SC2154
alias vifl='for i in $(virsh list --name --all);do echo $i;virsh domiflist $i;done'
alias v='vnl;vl;vifl'
# ----- BYOBU/TMUX ----- #
alias ba='byobu has -t "$BSNAME" >/dev/null 2>&1 &&byobu list-sessions&&sleep 1&&byobu attach-session -t "$BSNAME"||printf "No session called %b!\\n" "$BSNAME"'
alias bl="byobu list-sessions"
alias bo="byobu list-sessions \; list-windows"
alias tc='tmux save-buffer -|xclip -i&&echo "tmux buffer copied"'
# ----- NETWORK ----- #
alias openports='ss --all --numeric --processes --ipv4 --ipv6'
alias myip4='curl -k "https://diagnostic.opendns.com/myip"'
alias myip6='curl -6 "https://icanhazip.com"'
# ----- MEDIA ----- #
alias dvdb='dvdbackup -i /dev/dvd1 -M'
alias dvdburn='brasero'
alias dosbox='export SDL_VIDEO_X11_DGAMOUSE=0;dosbox;unset SDL_VIDEO_X11_DGAMOUSE'
alias mdf2iso="iat"
alias bin2iso="iat"
alias replaygain='mp3gain -s i'
alias jackdrc="/usr/bin/jackd -T -u -dalsa -r48000 -p1024 -n2 -D -Chw:CODEC &>/dev/null &"
alias html2png="cutycapt"
# ----- WM ----- #
alias startgnome="sxs gnome"
alias startkde="sxs kde"
alias starte16="sxs e16"
alias startxmonad="sxs xmonad"
# ----- SSH ----- #
alias saa="source ~/.ssh/sshenv;ssh-add >/dev/null 2>&1;ssh-add -l"
alias sshr='ssh -o StrictHostKeyChecking=no'
alias sshk='ssh -o PasswordAuthentication=yes -o PreferredAuthentications=keyboard-interactive,password -o PubkeyAuthentication=no'
alias sshg="ssh-with-gpg"
function add-sshagent-init {
	for KEY in "${SSHKEYS[@]}";do
		FFPRINT="$(ssh-keygen -Esha256 -lf "$KEY")" || return 1
		if ! ssh-add -l 2>/dev/null | grep "$FFPRINT" >/dev/null; then
			ssh-add -q "$KEY"
		fi
	done
}
alias sshmaster='ssh -O'
# ----- FS ----- #
xstat() {
	for target in "${@}";do
		# shellcheck disable=SC2012
		inode=$(ls -di "${target}"|cut -d ' ' -f 1)
		fs=$(df "${target}"|tail -n 1|awk '{print $1}')
		crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null | grep -oP 'crtime.*--\s*\K.*')
		printf "%s\t%s\n" "${crtime}" "${target}"
	done
}
# ----- PACKAGE MANAGERS ----- #
if [ -x "/usr/bin/pikaur" ];then
	alias pkgclean="pikaur --noconfirm -Sc"
elif [ -x "/usr/bin/pacman" ];then
	alias pkgclean="/usr/bin/sudo /usr/bin/pacman --noconfirm -Sc"
elif [ -x "/usr/bin/apt" ];then
	alias pkgclean="/usr/bin/sudo /usr/bin/apt clean"
elif [ -x "/usr/bin/dnf" ];then
	alias pkgclean="/usr/bin/sudo /usr/bin/dnf clean packages"
elif [ -x "/usr/bin/zypper" ];then
	alias pkgclean="/usr/bin/sudo /usr/bin/zypper clean"
fi
# ----- GRAFANA ----- #
if command -v grafana-cli >/dev/null;then
	alias gfpi='sudo grafana-cli plugins install'
	alias gfpl='sudo grafana-cli plugins list'
	alias gfplr='sudo grafana-cli plugins list-remote'
	alias gfrs="sudo systemctl restart grafana-server.service;systemctl is-active grafana-server.service;sudo ss -pantl|grep :3000"
fi
alias gfs="systemctl is-active grafana-server.service&&sudo ss -pantl|grep :3000"
# ----- ZE PASSWORDS ----- #
if [ -r "/etc/os-release" ];then
	osid="$(grep ^ID /etc/os-release|awk -F= '{print $2}'|tail -n1)"
	case "$osid" in
		fedora|centos|rhel*)
			alias mkpsk="makepasswd -c '1234567890abcdef' -l 64"
			alias mkpw="makepasswd -c 'qwertzuiopasdfghjkyxcvbnmQWERTZUPASDFGHJKLYXCVBNM23456789#!_' -l 24"
		;;
		*suse*)
			alias mkpsk="mimimi :("
			alias mkpw="mimimi :("
		;;
		*)
			alias mkpsk="makepasswd --string='1234567890abcdef' --chars='64'"
			alias mkpw="makepasswd --string='qwertzuiopasdfghjkyxcvbnmQWERTZUPASDFGHJKLYXCVBNM23456789#!_' --chars='24'"
		;;
	esac
	unset osid
fi
# ----- GPG -----#
alias gpg='gpg --expert'
gpg-expmaster() {
	FRETVAL=0
	HELPTXT="Exports all secrets to master file\nUSAGE:\t${FUNCNAME[0]} outputfile key-id"
	[ -z "$1" ]&&echo -e "$HELPTXT"&&FRETVAL=$((FRETVAL+1))||\
	[ -z "$2" ]&&echo -e "$HELPTXT"&&FRETVAL=$((FRETVAL+1))||\
	gpg2 --armour --output "$1" --export-secret-key "$2"||FRETVAL=$((FRETVAL+1))
	return "$FRETVAL"
}
gpg-exppaper() {
	FRETVAL=0
	HELPTXT="Exports all secrets to paper\nUSAGE:\t${FUNCNAME[0]} key-id"
	[ -z "$1" ]&&echo -e "$HELPTXT"&&FRETVAL=$((FRETVAL+1))||\
	gpg2 --export-secret-key "$1"|paperkey|lpr||FRETVAL=$((FRETVAL+1))
	return "$FRETVAL"
}
gpg-removekey() {
	FRETVAL=0
	HELPTXT="Removes a key ID from keystore\nUSAGE:\t${FUNCNAME[0]} key-id"
	[ -z "$1" ]&&echo -e "$HELPTXT"&&FRETVAL=$((FRETVAL+1))||\
	gpg-connect-agent "DELETE_KEY $1" /bye||FRETVAL=$((FRETVAL+1))
	return "$FRETVAL"
}
# ----- CERTIFICATES ----- #
alias certmgr='certutil -d sql:${HOME:?}/.pki/nssdb'
alias certlist="certmgr -L"
alias certshow="certmgr -L -n"
# ----- APPLICATION CONTROL ----- #
alias browser-set='xdg-settings set default-web-browser'
alias browser-get='xdg-settings get default-web-browser'
# ----- CONTAINERS ----- #
if command -v podman >/dev/null;then
	alias pcl="podman container list"
	alias pclj="podman container list --format json"
	alias pnl="podman network ls"
	alias ppl="podman pod list"
	alias pplj="podman pod list --format json"
	alias pvl="podman volume list"
	alias pvlj="podman volume list --format json"
	alias pci="podman container inspect"
	alias pni="podman network inspect"
	alias ppi="podman pod inspect"
	alias pvi="podman volume inspect"
	alias pcr="podman container rm"
	alias pnr="podman network rm"
	alias ppr="podman pod rm"
	alias pvr="podman volume rm"
	alias pcs="podman container start"
	alias pnc="podman network connect"
	alias pps="podman pod start"
	# d=destroy, kvm's term for "stop vigorously" :-)
	alias pcd="podman container stop"
	alias pnd="podman network disconnect"
	alias ppd="podman pod stop"
fi
for cmmd in batcat bat; do
	if command -v "$cmmd" > /dev/null; then
		# shellcheck disable=SC2139
		alias cat="${cmmd} --tabs 4 --wrap never --paging never --style 'plain,rule'"
		# shellcheck disable=SC2139
		alias less="${cmmd} --tabs 4 --wrap never --paging always --style 'plain,rule'"
		alias plain-cat='/usr/bin/cat'
		alias plc='/usr/bin/cat'
		alias plain-less='/usr/bin/less'
		alias pll='/usr/bin/less'
		export MANPAGER="sh -c 'col -bx | ${cmmd} -l man -p'"
		export MANROFFOPT="-c"
		break
	fi
done
# Flake8. Nice linter, but...
# They kneeled to USER STUPIDITY when it comes to configuration. Wut?
# https://flake8.pycqa.org/en/latest/release-notes/4.0.0.html#backwards-incompatible-changes
# --> https://github.com/pycqa/flake8/pull/1404
# Users were confused, so ~/.config/flake8 is not supported anymore. lelkek.
alias flake8='flake8 --config ${HOME}/.config/flake8'