### fzf(1) export FZF_DEFAULT_OPTS='--layout=reverse' # use vim fzf if no global fzf is found [[ -d ~/.vim/plugged/fzf ]] && [[ -x $(which fzf 2> /dev/null) ]] || export PATH=$PATH:$HOME/.vim/plugged/fzf/bin # interactive git grep alias gg=': | fzf --ansi --disabled --query "${*:-}" \ --bind "start:reload:git grep {q}" \ --bind "change:reload:sleep 0.1; git grep {q} || true" \ --bind "enter:become(hx {1} +{2})" \ --delimiter :' alias rgi=': | fzf --ansi --disabled --query "${*:-}" \ --bind "start:reload:rga {q}" \ --bind "change:reload:sleep 0.1; rga {q} || true" \ --bind "enter:become(xdg-open {1})" \ --delimiter :' ### System Utility alias cdt='mkdir /tmp/$(cat /proc/sys/kernel/random/uuid); cd $_' alias cpu='watch -n.1 "grep \"^[c]pu MHz\" /proc/cpuinfo"' alias fixagent='eval $(tmux show-env -s | grep "^SSH_")' alias truecolor='curl -s https://raw.githubusercontent.com/JohnMorales/dotfiles/master/colors/24-bit-color.sh | bash' alias whatsmyip='curl https://ipinfo.io/ip; echo' ### Always ask first when moving files alias cp='cp -i' alias mv='mv -i' alias rm='rm -i' ### Abbreviations alias dcr='dc down && dc up -d && dc logs -f' alias dh1='du . -h -d1' alias dhs='du . -hs' alias diff_dir='diff -qr' alias g='git' alias l='eza --icons' alias nd="nix develop ." alias nssh='SSH_AUTH_SOCK= ssh' alias o='xdg-open' # to change a mime use: `xdg-mime default APPLICATION HANDLE` t(){ tmux new-session -A -s ${1:-🚀} } ### nmcli(1) alias con='nmcli con' alias conup='nmcli con up id' alias condown='nmcli con down id' alias conscan='nmcli dev wifi' alias conedit='nm-connection-editor' # password hash (sed needed when using in docker-compose) pwhash() { name=$1 if [ -z $name ]; then echo "Please enter a username." return fi echo $(htpasswd -nB ${name}) | sed -e s/\\$/\\$\\$/g } # ocr ocr() { file=$1 if [ -z $file ]; then echo "Please input a file." return fi name=${file%%.*} ocrmypdf -l ger+eng --output-type pdf $file ${name}.ocr.pdf } # private laptop acpi magic conservation() { location='/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode' if [ -z $1 ]; then cat $location elif [ $1 = '0' ] || [ $1 = '1' ]; then echo $1 | sudo tee $location else echo 'Invalid option' fi } power() { location='/sys/firmware/acpi/platform_profile' if [ -z $1 ]; then echo "Current:" $(cat $location) echo "Can be one of:" $(cat /sys/firmware/acpi/platform_profile_choices) elif [ $1 = 'low-power' ] || [ $1 = 'balanced' ] || [ $1 = 'performance' ]; then echo $1 | sudo tee $location else echo 'Invalid option' fi }