2022-08-19 13:32:06 +00:00
|
|
|
#!/bin/sh
|
2023-09-17 17:03:36 +00:00
|
|
|
ALIASES_BLACK='\033[0;30m' # Black
|
|
|
|
ALIASES_RED='\033[0;31m' # Red
|
|
|
|
ALIASES_GREEN='\033[0;32m' # Green
|
|
|
|
ALIASES_YELLOW='\033[0;33m' # Yellow (or Brown)
|
|
|
|
ALIASES_BLUE='\033[0;34m' # Blue
|
|
|
|
ALIASES_MAGENTA='\033[0;35m' # Magenta
|
|
|
|
ALIASES_CYAN='\033[0;36m' # Cyan
|
|
|
|
ALIASES_LIGHT_GRAY='\033[0;37m' # Light Gray (or White)
|
|
|
|
|
|
|
|
ALIASES_DARK_GRAY='\033[1;30m' # Dark Gray
|
|
|
|
ALIASES_LIGHT_RED='\033[1;31m' # Light Red
|
|
|
|
ALIASES_LIGHT_GREEN='\033[1;32m' # Light Green
|
|
|
|
ALIASES_LIGHT_YELLOW='\033[1;33m' # Light Yellow
|
|
|
|
ALIASES_LIGHT_BLUE='\033[1;34m' # Light Blue
|
|
|
|
ALIASES_LIGHT_MAGENTA='\033[1;35m' # Light Magenta
|
|
|
|
ALIASES_LIGHT_CYAN='\033[1;36m' # Light Cyan
|
|
|
|
ALIASES_WHITE='\033[1;37m' # White
|
2023-09-17 16:23:57 +00:00
|
|
|
ALIASES_NC='\033[0m' # No Color
|
2022-08-19 13:32:06 +00:00
|
|
|
|
|
|
|
echo "Aliases added:"
|
2023-09-17 17:03:36 +00:00
|
|
|
echo -e "${ALIASES_WHITE} cs venv"
|
2024-02-17 11:21:18 +00:00
|
|
|
echo " n ns pc cdlf lfcd g gg gitknow disk-usage sx debug.log"
|
2022-08-19 13:32:06 +00:00
|
|
|
echo " mc newsh smartresize"
|
2024-05-22 22:02:50 +00:00
|
|
|
echo " lv red alice alephrc zirconia ultra pest kermit japsay pi4"
|
2023-09-17 17:03:36 +00:00
|
|
|
echo -e "${ALIASES_NC}"
|
2023-09-17 16:23:57 +00:00
|
|
|
echo ""
|
2022-08-19 13:32:06 +00:00
|
|
|
|
2022-11-21 16:34:02 +00:00
|
|
|
alias backup='sudo borgmatic create --verbosity 1 --files'
|
2023-09-22 12:48:01 +00:00
|
|
|
alias disk-usage='sudo du -h -d 2 .[^.]* * | sort -h'
|
2022-11-21 16:34:02 +00:00
|
|
|
|
2022-03-04 17:40:57 +00:00
|
|
|
alias anki='anki --no-sandbox'
|
2022-08-19 13:28:08 +00:00
|
|
|
alias cs='lxc list -c ns4s,user.comment:comment'
|
2023-01-04 16:37:02 +00:00
|
|
|
alias pc='pcmanfm . & disown'
|
2022-03-04 17:40:57 +00:00
|
|
|
|
2022-05-02 15:49:32 +00:00
|
|
|
alias media-window='bspc node -z top 0 +530'
|
|
|
|
|
2019-05-26 19:45:22 +00:00
|
|
|
# enable aliases for commands inside sudo
|
|
|
|
# TOOD check this is safe
|
|
|
|
alias sudo='sudo '
|
|
|
|
|
2023-02-08 13:51:38 +00:00
|
|
|
alias venv='source ./venv/bin/activate'
|
|
|
|
|
2023-04-20 09:37:41 +00:00
|
|
|
alias e='nvim'
|
|
|
|
alias er='nvim README.md'
|
2023-08-22 08:32:33 +00:00
|
|
|
alias et='nvim TODO.md'
|
2023-08-22 09:48:33 +00:00
|
|
|
alias en='nvim NOTES.md'
|
2024-07-18 09:55:17 +00:00
|
|
|
alias ens='nvim NEXT_STEPS.md'
|
2024-05-06 21:36:14 +00:00
|
|
|
alias ea='nvim .autonote.md'
|
2023-04-20 09:37:41 +00:00
|
|
|
alias ee='nvim .'
|
2024-02-17 11:20:32 +00:00
|
|
|
|
|
|
|
alias debug.log='clear && echo "" > debug.log && tail -f debug.log'
|
|
|
|
alias sx='/usr/bin/sxhkd -c /home/ray/.config/sxhkd/sxhkdrc /home/ray/.config/sxhkd/sxhkdrc.bspwm /home/ray/.config/sxhkd/sxhkdrc.bspwm.machineone &'
|
2022-11-23 14:25:17 +00:00
|
|
|
|
2022-07-28 17:36:09 +00:00
|
|
|
alias g='git status'
|
2022-03-25 12:30:33 +00:00
|
|
|
alias gg='git add . && git commit -m "update" && git push'
|
2023-09-22 12:48:01 +00:00
|
|
|
alias gitknow='cd ~/knowledge-base && git add . && git status && git commit -m update && git push ; cd -'
|
2022-03-04 17:40:57 +00:00
|
|
|
|
2022-03-22 12:08:40 +00:00
|
|
|
alias ls='ls --color=auto -h --group-directories-first --time-style=+"%d.%m.%Y %H:%M" -F'
|
2019-06-02 11:03:05 +00:00
|
|
|
|
2022-09-14 15:01:26 +00:00
|
|
|
alias cp='cp -irv'
|
|
|
|
alias mkdir='mkdir -vp'
|
|
|
|
alias mv='mv -iv'
|
2022-09-15 13:03:41 +00:00
|
|
|
alias rm='rm -dv'
|
2022-09-14 15:01:26 +00:00
|
|
|
|
2022-05-15 13:42:34 +00:00
|
|
|
alias wget='wget --hsts-file="$XDG_DATA_HOME/wget-hsts"'
|
2019-02-20 14:19:32 +00:00
|
|
|
|
2022-03-22 12:09:05 +00:00
|
|
|
alias grep='grep --colour=auto'
|
2019-02-20 14:19:32 +00:00
|
|
|
alias egrep='egrep --colour=auto'
|
|
|
|
alias fgrep='fgrep --colour=auto'
|
|
|
|
alias hgrep='history | grep --color=auto'
|
|
|
|
|
2020-03-25 13:05:19 +00:00
|
|
|
alias bc='bc -q -l'
|
|
|
|
|
2019-02-20 14:19:32 +00:00
|
|
|
alias ytdl='youtube-dl --write-info-json --write-description --no-playlist'
|
|
|
|
alias ytdlb='youtube-dl --write-info-json --write-description --no-playlist -a'
|
2019-03-04 22:35:04 +00:00
|
|
|
alias ytdl-mp3='youtube-dl -f bestaudio --extract-audio --audio-format mp3 --embed-thumbnail --add-metadata'
|
2019-02-20 14:19:32 +00:00
|
|
|
|
2024-01-13 13:59:22 +00:00
|
|
|
alias lv='ssh nhg5vomib8ue@92.205.144.38'
|
2024-05-17 11:25:46 +00:00
|
|
|
alias pi4='ssh pi@192.168.0.11'
|
2023-03-12 19:36:02 +00:00
|
|
|
alias red='ssh ray@red.isnet.uk'
|
|
|
|
alias alice='ssh ray@alice.isnet.uk'
|
2024-06-12 21:56:38 +00:00
|
|
|
alias aleph='ssh rayray@aleph.rayelliott.dev'
|
2024-03-09 11:45:23 +00:00
|
|
|
alias alephrc='ssh runcloud@aleph.rayelliott.dev'
|
2024-07-06 22:20:41 +00:00
|
|
|
alias obsidianrc='ssh ray@obsidian.isnet.one'
|
2024-06-12 21:56:38 +00:00
|
|
|
alias zirconia='ssh ray@zirconia.rayelliott.dev'
|
|
|
|
alias zirconiarc='ssh runcloud@zirconia.rayelliott.dev'
|
2022-03-25 12:27:43 +00:00
|
|
|
alias ultra='ssh gabbaell@mimas.usbx.me'
|
2024-06-02 13:35:09 +00:00
|
|
|
alias pest='ssh ray@pestilence.isnet.one'
|
|
|
|
alias japsay="ssh ray@japsay.isnet.one -p 4721"
|
2024-06-05 22:29:00 +00:00
|
|
|
alias kermit="ssh ray@kermit.isnet.one -p 23421"
|
2019-04-20 21:55:14 +00:00
|
|
|
|
2020-02-23 18:02:03 +00:00
|
|
|
# lf gets confused by TERMINFO env var when running in tmux
|
|
|
|
# https://github.com/gokcehan/lf/issues/138#issuecomment-464477665
|
|
|
|
if [ -n "$TERMINFO" ] ; then
|
2023-03-04 09:41:34 +00:00
|
|
|
alias lf="TERMINFO= lf -last-dir-path=~/.cache/lf-last-dir"
|
2020-06-30 15:57:45 +00:00
|
|
|
else
|
2023-03-04 09:41:34 +00:00
|
|
|
alias lf="lf -last-dir-path=~/.cache/lf-last-dir"
|
2020-02-23 18:02:03 +00:00
|
|
|
fi
|
|
|
|
|
2020-06-30 15:57:45 +00:00
|
|
|
cdlf() {
|
2023-03-04 09:41:34 +00:00
|
|
|
cd "$(cat ~/.cache/lf-last-dir)"
|
2020-06-30 15:57:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
lfcd() {
|
|
|
|
lf -last-dir-path="$HOME"/.cache/lf-last-dir
|
|
|
|
cdlf
|
|
|
|
}
|
|
|
|
|
2023-09-17 16:23:57 +00:00
|
|
|
update() {
|
|
|
|
echo -e "Executing \"${ALIASES_GREEN}pacman -Syu${ALIASES_NC}\" via \"${ALIASES_BLUE}archnews_wrap${ALIASES_NC}\" wrapper"
|
|
|
|
|
|
|
|
sudo ~/.src/archnews/archnews_wrap -Syu && cat /dev/null > /home/ray/.checkupdates
|
|
|
|
}
|
|
|
|
|
2019-04-10 18:22:55 +00:00
|
|
|
# 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"
|
|
|
|
}
|
2020-03-19 18:12:50 +00:00
|
|
|
|
2020-05-18 18:35:01 +00:00
|
|
|
re() {
|
|
|
|
git clone ssh://git@git.rayelliott.dev:3222/rayelliott/"$1".git $2
|
|
|
|
}
|
|
|
|
|
2020-03-19 18:12:50 +00:00
|
|
|
mc() {
|
|
|
|
mkdir "$1" && cd "$1"
|
|
|
|
}
|
2020-03-30 12:05:59 +00:00
|
|
|
|
2020-11-21 13:35:16 +00:00
|
|
|
newsh() {
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ -f "$1" ] ; then
|
|
|
|
echo "Error: file exists: $1"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "#!/bin/sh" > "$1"
|
|
|
|
echo "" >> "$1"
|
|
|
|
echo "$2" >> "$1"
|
|
|
|
|
|
|
|
chmod +x "$1"
|
|
|
|
nvim "$1" +3
|
|
|
|
}
|