Created
March 3, 2022 10:49
-
-
Save CodeSigils/bdeb0d94d647e3905cac9237d5546c0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## ~/.shell/.aliasrc | |
## Included in ~/.bashrc | |
## Includes all other configs and paths | |
## TERM | |
# sudo update-alternatives --config x-terminal-emulator | |
## Define folder that holds the alias files | |
export ALIASPATH="${HOME}/.shell" | |
export EDITOR=nvim | |
## substitute sudo with OpenDoas | |
#alias sudo=doas | |
## =================================================== | |
## === COLORS - READABILITY | |
## =================================================== | |
if [ -f "${ALIASPATH}/.colorsrc" ]; then | |
"." "${ALIASPATH}/.colorsrc"; | |
fi | |
## =================================================== | |
## === APT | |
## =================================================== | |
if grep -qE "(Ubuntu)" /etc/*release*; then | |
"." "${ALIASPATH}/.aptrc" | |
alias cf-apt="\$EDITOR \${ALIASPATH}/.aptrc" | |
fi | |
## =================================================== | |
## === APK | |
## =================================================== | |
if grep -qE "(Alpine)" /etc/*release*; then | |
"." "${ALIASPATH}/.apkrc"; | |
fi | |
## =================================================== | |
## === PATHS - Must be declared at the top | |
## =================================================== | |
if [ -f "${ALIASPATH}/.pathrc" ]; then | |
"." "${ALIASPATH}/.pathrc"; | |
fi | |
## =================================================== | |
## === SCOOP - Only for Windows WLS | |
## =================================================== | |
#if [ -f "${ALIASPATH}/.scooprc" ]; then | |
#"." "${ALIASPATH}/.scooprc"; | |
#fi | |
## =================================================== | |
## === APPS - External CLI | |
## =================================================== | |
## Buku | |
if [ "$(command -v buku)" ]; then | |
"." "${ALIASPATH}/.bukurc"; | |
fi | |
## =================================================== | |
## === CONSOLE - Configs - Common Helpers | |
## =================================================== | |
hgrep() { | |
history | grep "$1"; | |
} | |
alias algrep='cat ${ALIASPATH}/.aliasrc* | grep' | |
alias cl='clear' | |
alias q='exit' | |
alias rs='reset' | |
alias shred='shred -u -vzn 0' | |
alias rld='source ' | |
alias cf-alias="\$EDITOR \${ALIASPATH}/.aliasrc" | |
alias rld-alias="source \${ALIASPATH}/.aliasrc" | |
alias cf-pathrc="\$EDITOR \${ALIASPATH}/.pathrc" | |
alias rld-pathrc="source \${ALIASPATH}/.pathrc" | |
alias cf-scooprc="\$EDITOR \${ALIASPATH}/.scooprc" | |
alias rld-scooprc="source \${ALIASPATH}/.scooprc" | |
alias cf-zshrc="\$EDITOR ~/.zshrc" | |
alias rld-zshrc="source ~/.zshrc" | |
alias cf-bashrc="\$EDITOR ~/.bashrc" | |
alias rld-bashrc="source ~/.bashrc" | |
alias cf-profile="\$EDITOR ~/.profile" | |
alias rld-profile="source ~/.profile" | |
alias cf-alacritty="\$EDITOR /mnt/c/Users/sigil/AppData/Roaming/alacritty/alacritty.yml" | |
#net | |
alias cf-hosts="sudo \$EDITOR /etc/hosts" | |
alias cf-wsl="sudo \$EDITOR /etc/wsl.conf" | |
alias cf-fstab="sudo \$EDITOR /etc/fstab" | |
## =================================================== | |
## === Substitutions - list - history - weather - date | |
## =================================================== | |
## Kitty trminal | |
## https://sw.kovidgoyal.net/kitty/binary/ | |
alias cf-kitty="\$EDITOR \$XDG_CONFIG_HOME/kitty/kitty.conf" | |
## Navigation | |
alias rng="ranger" | |
## Substitutions | |
## https://github.com/Peltoche/lsd | |
alias ls=exa | |
alias l='ls -l' | |
alias la='ls -a' | |
alias lla='ls -la' | |
alias ll='ls -lah' | |
alias lt='ls --tree' | |
alias df='df -hT --total' ## human readable, print filetype, and total | |
alias du='du -d1 -h' ## max depth, human readable | |
alias mkpasswd='mkpasswd --method=SHA-512' | |
alias kee='keepassxc-cli' | |
alias info='info --vi-keys' ## GNU info act like man command | |
alias mkdir='mkdir -p -v' ## create if not exist, verbose | |
alias cp='cp -aiv' ## cp prompt confirmation | |
## File Managers | |
alias n='nnn -H' | |
## Editors | |
# alias code='codium' | |
alias nano='nano -c -$' ## word wrapping | |
alias vim='nvim' | |
alias svim="sudo nvim" | |
alias visudo='sudo EDITOR="$EDITOR" visudo' | |
## Youtube viewer flags: -C=color, -f=fullscreen, -1=1080p, number of results | |
alias ytv='straw-viewer -C -f -1 --results=30' | |
alias sr='sr -browser=$BROWSERCLI' ## surfraw: open in cli browser | |
alias srf='surfraw -browser=$BROWSER' ## surfraw: open in gui browser | |
alias wget='wget -N -c' ## continues/resumes | |
alias w3m='w3m -num' ## w3m with line number | |
## Browsers | |
#alias firefox="/mnt/c/Program\ Files/Mozilla\ Firefox/firefox.exe" | |
alias chrome="/mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe" | |
alias librewolf="/mnt/c/Program\ Files/LibreWolf/librewolf.exe" | |
#alias mpv="/mnt/c/ProgramData/chocolatey/lib/mpv.install/tools/mpv.exe" | |
## Weather - date -time | |
alias weather='curl http://wttr.in/athens' | |
alias weather-malta='curl http://wttr.in/malta' | |
alias date-time='sudo dpkg-reconfigure tzdata' | |
## =================================================== | |
## === Keys - Files | |
## =================================================== | |
## Net - gpg - ssh | |
## For legacy servers: | |
#alias ssh-key-gen="ssh-keygen -t rsa -b 4096 -C " ## "your_email@example.com" | |
alias ssh-key-gen-ed="ssh-keygen -t ed25519 -C " ## "your_email@example.com" | |
alias ssh-key-gen-ecd="ssh-keygen -t ecdsa -b 512" | |
alias ssh-cp-pub-key='xclip -sel clip < ~/.ssh/id_rsa.pub' | |
alias gpg-ls-keys="gpg -K --keyid-format long --with-colons --with-fingerprint" | |
alias cf-sshd="sudo $EDITOR /etc/ssh/sshd_config" | |
alias rm-srt='find . -type f -name "*.srt" -delete' | |
alias rm-vtt='find . -type f -name "*.vtt" -delete' | |
alias rm-log='sudo find . -type f -name "*.log" -delete' | |
## npm | |
if [ "$(command -v npm)" ]; then | |
alias npmi='npm install --no-optional' # avoid 'fsevents linux' warning | |
alias npmid='npm install --no-optional --save-dev' | |
fi | |
## yarn | |
if [ $(command -v yarn) ]; then | |
alias ya='yarn' | |
alias yaa='yarn add' | |
alias yada='yarn add -D' | |
alias yacc='yarn cache clean' | |
alias yah='yarn help' | |
alias yao='yarn outdated' | |
alias yaui='yarn upgrade-interactive' | |
alias yagl='yarn global list' | |
alias yaga='yarn global add' | |
alias yagr='yarn global remove' | |
alias yagu='yarn global upgrade' | |
alias yagui='yarn global upgrade-interactive' | |
alias yacfg='yarn global bin' # output symlinks to executables | |
fi | |
## Netlify | |
if [ "$(command -v netlify)" ]; then | |
"." "${ALIASPATH}/netlify"; | |
fi | |
## =================================================== | |
## === DOTFILES | |
## =================================================== | |
# TITLE: Manage dotfiles with a git bare repo | |
# URL: https://www.atlassian.com/git/tutorials/dotfiles | |
# To init run once: git init --bare $HOME/.dotfiles | |
# Run this after once: config config --local status.showUntrackedFiles no | |
# To add: config add /path/to/file | |
# To commit: config commit -m "message" | |
alias config='$(command -v git) --git-dir=$HOME/.dotfiles --work-tree=$HOME' | |
## Chezmoi | |
alias cm=chezmoi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment