Skip to content

Instantly share code, notes, and snippets.

@codebender828
Last active August 23, 2021 05:14
Show Gist options
  • Save codebender828/1f4b1c3fe7eb4610004bb090a413c540 to your computer and use it in GitHub Desktop.
Save codebender828/1f4b1c3fe7eb4610004bb090a413c540 to your computer and use it in GitHub Desktop.
My favourite Bash Functions and Aliases
# This script will look for all the files inside the `~/.profiles.d/` directory and require them in a new terminal
# Source all files in .profile.d
# ============================
for file in ~/.profile.d/*
do
source $file
done
# Yarn Aliases
alias yi="yarn install"
alias yid="yarn install && yarn dev"
alias yiw="yarn install && yarn watch"
alias gs="git status"
alias gp="git push"
alias gl="git pull"
alias yw="yarn watch"
alias yd="yarn dev"
alias yb="yarn build"
alias ys="yarn start"
alias yp="yarn build && yarn start"
# PNPM Aliases
alias pi="pnpm install"
alias pid="pnpm install && pnpm dev"
alias piw="pnpm install && pnpm watch"
alias pw="pnpm watch"
alias pd="pnpm dev"
alias pb="pnpm build"
alias ps="pnpm start"
alias pp="pnpm build && pnpm start"
# Git commit shortcut
function lz() {
git add .
git commit -m $1 $2
echo "🚀 Done."
git status
}
# Resets git tracked files
function resetGit() {
git rm -r --cached .
git add .
git commit -m "refactor: reset and removed untracked files"
}
export CLICOLOR=1
export LSCOLORS=gx
alias l='ls | lolcat'
# Useless byt nicelooking celebration parrot
function parrot() {
curl parrot.live
}
# Checks for ports that are actively listening
function listening() {
if [ $# -eq 0 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P
elif [ $# -eq 1 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1
else
echo 'Usage: listening [pattern]'
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment