101 lines
2.6 KiB
Bash
101 lines
2.6 KiB
Bash
#!/bin/bash
|
|
|
|
# aliases common to bash and zsh
|
|
|
|
# shellcheck source=../../secrets
|
|
source /home/*/SetupCockpit/secrets
|
|
alias lime2connect='ssh $SSH_REPO'
|
|
alias git-summary='~/github_misc/git-summary/git-summary'
|
|
|
|
# TALISMAN
|
|
export TALISMAN_HOME="$HOME/.talisman/bin"
|
|
alias talisman=$TALISMAN_HOME/talisman_linux_amd64
|
|
export TALISMAN_INTERACTIVE=true
|
|
|
|
# color support for ls and grep
|
|
if [ -x /usr/bin/dircolors ]; then
|
|
if [ -r ~/.dircolors ]; then
|
|
eval "$(dircolors -b ~/.dircolors)"
|
|
else
|
|
eval "$(dircolors -b)"
|
|
fi
|
|
alias ls='ls --color=auto'
|
|
alias grep='grep --color=auto'
|
|
alias fgrep='fgrep --color=auto'
|
|
alias egrep='egrep --color=auto'
|
|
fi
|
|
|
|
alias rm='rm -I --preserve-root'
|
|
|
|
# Add an "alert" alias for long running commands. Use like so:
|
|
# sleep 10; alert
|
|
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
|
|
|
alias weather='curl wttr.in'
|
|
|
|
alias ll='ls -lh'
|
|
alias lla='ls -lArth'
|
|
alias la='ls -A'
|
|
alias l='ls -CF'
|
|
|
|
alias envactivate='source .env/bin/activate'
|
|
alias visudo='export EDITOR=$EDITOR && sudo -E visudo'
|
|
|
|
# For common errors
|
|
alias :q=' exit'
|
|
alias :x=' exit'
|
|
alias cd..='cd ..'
|
|
|
|
pw() {
|
|
export PASSWORD_STORE_CLIP_TIME=8
|
|
pass -c2 "$1"; sleep 5; pass -c3 "$1"; sleep 5; pass -c "$1"
|
|
}
|
|
|
|
clitip() {
|
|
curl -s https://raw.githubusercontent.com/jlevy/the-art-of-command-line/master/README.md |
|
|
sed '/cowsay[.]png/d' |
|
|
pandoc -f markdown -t html |
|
|
xmlstarlet fo --html --dropdtd |
|
|
xmlstarlet sel -t -v "(html/body/ul/li[count(p)>0])[$RANDOM mod last()+1]" |
|
|
xmlstarlet unesc | fmt -80 | iconv -t US
|
|
}
|
|
|
|
GIT_REPOS=(~/.password-store ~/SetupCockpit ~/Keepass ~/Lessons/* ~/PersonalScripts ~/RootMe ~/SRC/*)
|
|
|
|
cockpit() { # enable pass-like commands (ex: cockpit git push)
|
|
local start_dir="$PWD"
|
|
cd ~/SetupCockpit && "$@"
|
|
cd "$start_dir" && echo 'done'
|
|
}
|
|
|
|
hello() {
|
|
local start_dir="$PWD"
|
|
sudo protonvpn c -f
|
|
echo
|
|
# Don't update if its a kernel update that will require reboot
|
|
if checkupdates >/dev/null 2>&1; then
|
|
case "$(checkupdates | grep linux && echo)" in
|
|
*linux*)
|
|
echo "Not performing update"
|
|
;;
|
|
*)
|
|
sudo pacman -Syu
|
|
esac
|
|
fi
|
|
|
|
for repo in "${GIT_REPOS[@]}"; do
|
|
echo "Pulling from $repo..."
|
|
cd "$repo" && git pull
|
|
done
|
|
cd "$start_dir" || exit 1
|
|
}
|
|
|
|
bye() {
|
|
cd || exit 1
|
|
git-summary -d
|
|
}
|
|
|
|
calc() {
|
|
# Use python to make simple calculations, like 'calc 24/8'
|
|
python -c "print($*)"
|
|
}
|