profile/aliases.sh

111 lines
2.9 KiB
Bash

# enable aliases for commands inside sudo
# TOOD check this is safe
alias sudo='sudo '
alias e='nvim'
alias lsoff='sudo lsof +f -- '
alias la='ls -lha --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
alias ll='ls -lh --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
alias ls='ls --color=auto -h'
alias bulk-rename='vimv'
alias cp='cp -i'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
alias hgrep='history | grep --color=auto'
alias grep='grep --colour=auto'
alias grepef='grep --exclude-from .ignorefiles'
alias rcp='rsync --progress --size-only --verbose -rh'
alias bc='bc -q -l'
alias cdr='ranger --choosedir=/tmp/rangerdir; LASTDIR=`cat /tmp/rangerdir`; cd "$LASTDIR"'
alias thumbs='feh -t -y128 -E128'
alias tgs='tig status'
alias git-port='/home/ray/Scripts/git-change-remote-port.sh'
alias ytdl='youtube-dl --write-info-json --write-description --no-playlist'
alias ytdlb='youtube-dl --write-info-json --write-description --no-playlist -a'
alias ytdl-mp3='youtube-dl -f bestaudio --extract-audio --audio-format mp3 --embed-thumbnail --add-metadata'
alias wttr='curl wttr.in'
alias pve='ssh pve.home'
alias omv='ssh omv.home'
alias isnet='ssh -p666 isnet.uk'
alias b1='ssh -p666 b1.isnet.uk'
alias s1='ssh -p666 s1.isnet.uk'
alias hmb='ssh -p666 hmb.isnet.uk'
alias kvm='ssh -p666 kvm.isnet.uk'
alias alarmpi='ssh 192.168.0.11'
alias hosting='ssh -p2222 xuk@hosting.isnet.uk'
alias hetzner='ssh ray@dokku.isnet.uk'
alias mac='ssh ray@mac -t tmux'
alias dokku='ssh -t dokku@dokku.isnet.uk'
alias pacman='~/.src/archnews/archnews_wrap'
# lf gets confused by TERMINFO env var when running in tmux
# https://github.com/gokcehan/lf/issues/138#issuecomment-464477665
if [ -n "$TERMINFO" ] ; then
alias lf="TERMINFO= lf -last-dir-path=$HOME/.cache/lf-last-dir"
else
alias lf="lf -last-dir-path=$HOME/.cache/lf-last-dir"
fi
cdlf() {
cd "$(cat $HOME/.cache/lf-last-dir)"
}
lfcd() {
lf -last-dir-path="$HOME"/.cache/lf-last-dir
cdlf
}
# functions
# $1 - output directory
# $2 - size
# $3 - filename
smartresize() {
mogrify -path "$3" -filter Triangle -define filter:support=2 -thumbnail "$2" -unsharp 0.25x0.08+8.3+0.045 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB "$1"
}
re() {
git clone ssh://git@git.rayelliott.dev:3222/rayelliott/"$1".git $2
}
mc() {
mkdir "$1" && cd "$1"
}
# TODO testing
ytdl-ct() {
ssh "youtube-dl@192.168.0.118 'screen -m -d ./download.sh $1'"
}
# TODO testing
ytdl-ct-audio() {
ssh "youtube-dl@192.168.0.118 'screen -m -d ./download.sh --config-location ~/.config/youtube-dl/config-audio-only $1'"
}
git-re() {
repo="$1"
dir="$2"
if [ -z "$dir" ] ; then
dir="$repo"
fi
git clone ssh://git@git.rayelliott.dev:3222/rayelliott/"$repo".git "$dir"
}
ch() {
curl "cheat.sh/$@"
}