### System Utility alias cdt='mkdir /tmp/$(cat /proc/sys/kernel/random/uuid); cd $_' 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' ### zfs (just saved commands) # zfs send pool/path/to/zvol@snapshot| gzip -c >/mnt/some/location/zvol@20230302.gz # gzip -dc /mnt/some/location/zvol@20230302.gz | zfs receive pool/path/to/zvol ### Always ask first when moving files alias cp='cp -i' alias mv='mv -i' alias rm='rm -i' ### fzf alias c='cd $(fd --type d | fzf --reverse)' alias blame='git show $(git ls-files | fzf -e --reverse --bind "enter:become(git blame {1} | fzf -e --ansi --reverse | cut -f 1 -d \" \")")' # nix alias nd="nix develop ." alias ns="nix-shell" alias nupdate="nix-channel --update" # https://github.com/loqusion/typix alias typix="nix flake init --refresh -t github:loqusion/typix" alias twatch="nix run .#watch" alias tbuild="nix run .#build" alias tlsp="nix-shell -p tinymist" alias nlatex="nix-shell -p texlive.combined.scheme-full" ### Abbreviations alias dcr='docker compose down && docker compose up -d && docker compose logs -f' alias dh1='du . -h -d1' alias dhs='du . -hs' alias g='git' alias ls='ls --color --hyperlink' 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:-dev} } # 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 deu+eng --output-type pdf $file ${name}.ocr.pdf } # scale down images and remove exif downimage() { filename=$1 convert -resize 720 $filename $filename exiftool -all= $filename } setgnomebuttons() { gsettings set org.gnome.desktop.wm.preferences button-layout 'icon:minimize,close' } removegnomebuttons() { gsettings set org.gnome.desktop.wm.preferences button-layout '' } ### 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 }