Skip to content

Instantly share code, notes, and snippets.

@kurtbuilds
Created December 31, 2022 21:12
Show Gist options
  • Save kurtbuilds/013559d500da3094fbc46d9dd6d53bc8 to your computer and use it in GitHub Desktop.
Save kurtbuilds/013559d500da3094fbc46d9dd6d53bc8 to your computer and use it in GitHub Desktop.
bash aliases
# Rust replacements
function find() {
echo $(dye -r WARN) Try using fd instead. >&2
/usr/bin/find "$@"
}
function sed() {
echo $(dye -r WARN) Try using sd instead. >&2
/usr/bin/sed "$@"
}
function grep() {
echo $(dye -r WARN) Try using rg instead. >&2
/usr/bin/grep "$@"
}
function curl() {
echo $(dye -r WARN) Try using req instead. >&2
/usr/bin/curl "$@"
}
# Conveniences
alias cask='brew install --cask'
function ignore() {
echo "$@" >> .gitignore
}
# Movement
alias ls='ls --color=auto'
alias l="ls"
alias ll="ls -la"
alias c="z "
alias c.="cd .."
alias c-="cd -"
alias c..="cd ../.."
alias ip="req 'https://api.ipify.org?format=json' | jq -r .ip"
alias less="less -r"
alias v="vi"
alias idea="/usr/local/bin/idea ."
alias myip="dig +short myip.opendns.com @resolver1.opendns.com"
password() {
head -c24 /dev/urandom | base64
}
uuid() {
python3 -c 'import uuid;print(uuid.uuid4())'
}
# General Developer
alias g="git"
alias gs="git status"
alias gb="git branch"
alias gp="git pull"
alias gu="git push"
alias vg="vagrant "
alias mo="modenv "
alias color="pastel "
alias t="just"
alias j="just"
complete -o bashdefault -o default -F _just t
complete -o bashdefault -o default -F _just j
alias jc="just check"
alias jr="just run"
alias jb="just build"
alias jw="just watch"
alias jt="just test"
alias ji="just install"
alias jp="just publish"
alias je="just example"
alias jer="just expand-run"
alias jrr="just rerun"
alias rep="replicator"
alias ren="render"
# Rust
alias ca="cargo "
alias template="cargo template "
function clean() {
echo $(dye -c INFO) Clean anyhow
cargo clean -p anyhow
echo $(dye -c INFO) Clean thiserror
cargo clean -p thiserror
}
# Node
alias npm="pnpm"
# iOS
ios() {
TARGET=$(find . -name '*.xcworkspace' -maxdepth 1)
if test -z "$TARGET"; then
TARGET=$(find . -name '*.xcodeproj' -maxdepth 1)
fi
open $TARGET
}
# Python
alias py="python3"
alias py3="python3"
alias ipy3="ipython3"
alias ipy="ipython"
alias pip='pip3'
alias venv_activate='. env/bin/activate'
# Keyboard
vim-qwerty() {
ln -s $HOME/.vimrc.qwerty $HOME/.vimrc
ln -s $HOME/.ideavimrc.qwerty $HOME/.ideavimrc
}
vim-colemak() {
ln -s $HOME/.vimrc.colemak $HOME/.vimrc
ln -s $HOME/.ideavimrc.colemak $HOME/.ideavimrc
}
pgrestart-force() {
rm /opt/homebrew/var/postgres/postmaster.pid
brew services start postgres
}
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
function clone() {
dye -m git clone https://github.com/kurtbuilds/"$1"
git clone https://github.com/kurtbuilds/"$1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment