Skip to content

Instantly share code, notes, and snippets.

@njames
Last active March 10, 2024 04:49
Show Gist options
  • Save njames/9a045668c7526c073a9f08189f0ac291 to your computer and use it in GitHub Desktop.
Save njames/9a045668c7526c073a9f08189f0ac291 to your computer and use it in GitHub Desktop.
full .bash_aliases
alias dkr-nuke='docker stop $(docker ps -a -q);docker rm $(docker ps -a -q);'
# create a directory and cd into it
mkcdir ()
{
mkdir -p -- "$1" &&
cd -P -- "$1"
}
# helper for jira
function jira() {
TICKET_NUMBER=${${1}#*DEV-}
if [ -z "${TICKET_NUMBER}" ]; then
TICKET_NUMBER=$(git symbolic-ref HEAD 2>/dev/null | cut -d/ -f4 | cut -d- -f2)
fi
if [ -n "${TICKET_NUMBER}" ]; then
xdg-open "https://<yoursubdomain>.atlassian.net/browse/DEV-${TICKET_NUMBER}"
fi
}
#pull all repositories in a directory
alias gitall='find . -maxdepth 1 -type d -print -execdir git --git-dir={}/.git --work-tree=$PWD/{} pull origin main \;'
# up & down map to history search once a command has been started.
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
function xo { xdg-open $PWD;}
alias copy="xclip -sel clip"
alias e="echo $1"
alias ..="cd .."
alias ...="cd ../.."
function cdv(){
D='/var/www/'"$0"
cd $D
}
# Git aliases
alias g="git"
alias gti="git"
alias gst="git status"
alias gsh="git push"
alias gu="git push"
alias gd="git pull"
alias gll="git pull"
alias gf="git fetch"
alias ga="git add "
alias gap="git add -p"
function gco(){
git commit -m"$(echo $@)";
}
alias gcm='git checkout main; git pull;'
alias gcd='git fetch; git checkout develop; git pull;'
alias mad='git add .;git commit -m"Made A Diff --skip-ci"; git push'
alias grl="git reflog"
alias gl="git log"
alias gg="git log --graph --abbrev-commit --decorate --oneline --all"
alias ggg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# git clean up branches
function git-clean(){
for k in $(git branch | sed /\*/d); do
if [ -n "$(git log -1 --before='1 week ago' -s $k)" ]; then
git branch -d $k
fi
done
git remote prune origin
}
#laravel aliases
alias artisan='php artisan'
alias pa='php artisan'
alias please='php artisan'
alias jig='./vendor/bin/jigsaw'
alias vapor='./vendor/bin/vapor'
# pest testing alias
alias pest='./vendor/bin/pest'
#php lint alias
alias phpl="find . -type f -name '*.php' -not -path '*vendor/*' -print0 | xargs -0 -n1 -P8 php -l |grep 'PHP Parse error'"
#php server alias
alias phps="php -S localhost:8015"
alias asd="php artisan serve"
#python aliases
alias p='python3'
alias p3s='python3 -m http.server'
#fun aliases
alias standup='date +"Standup %A, %d %b %Y" | xclip -se c'
alias devup='date +"Dev Update %A, %d %b %Y" | xclip -se c'
alias pd='pushd'
alias shh='ssh'
alias cdm='cd /media/nigeljames/'
# code aliases
alias phpunit='vendor/bin/phpunit'
alias phpstan='vendor/bin/phpstan'
alias phpcs='vendor/bin/php-cs-fixer'
# editor aliases
alias s=subl
alias vim=nvim
alias vi=nvim
#other utilities
alias tnf='tail -n100 -f'
alias serialno='sudo dmidecode -t system | grep Serial'
alias at=atuin
# btp / cf / node aliases
alias nr='npm run'
alias cfsso='cf login --sso'
alias cap=cds
alias exm=exercism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment