Skip to content

Instantly share code, notes, and snippets.

@nazmulpcc
Created October 21, 2021 09:53
Show Gist options
  • Select an option

  • Save nazmulpcc/7e1ef0094f13467ed6b6c774aa9184d9 to your computer and use it in GitHub Desktop.

Select an option

Save nazmulpcc/7e1ef0094f13467ed6b6c774aa9184d9 to your computer and use it in GitHub Desktop.
Shell Aliases
alias update='sudo pacman -Syu --noconfirm' # for manjaro, arch etc
#alias update='brew update && brew upgrade' # for mac
#alias update='sudo apt update && sudo apt upgrade -y'
alias ll='ls -la'
# Git
alias gs='git status'
alias gc='git commit -m'
alias ga='git add '
alias gca='git commit -a -m'
alias gd='git diff '
alias gt="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias gl="git log"
function gitzip {
zip -r updates-$(date +%d-%m-%Y-%H%M%S).zip $(git diff --name-only HEAD~$1)
}
# Laravel
alias pa='php artisan'
alias pat='php artisan tinker'
# Devilbox -> https://github.com/cytopia/devilbox
alias box='CU=$(pwd) && cd ~/lab/devilbox && docker-compose up -d && cd $CU'
alias no-box='CU=$(pwd) && cd ~/lab/devilbox && docker-compose down && cd $CU'
alias drm='dk stop $(dk ps -q)' # Remove all running docker containers
function bsh {
CU=$(pwd)
cd ~/lab/devilbox
docker-compose exec --user=devilbox php bash
cd $CU
}
# add virtual hosts in /etc/hosts file
function addhost {
HST="127.0.0.1 $1"
echo $HST | sudo tee -a /etc/hosts
}
# Docker
alias dk=docker
dc () {
CMD="docker-compose"
if [ -f docker-compose.dev.yml ]
then
CMD="docker-compose -f docker-compose.yml -f docker-compose.dev.yml"
fi
PARTS=$@
sh -c "$CMD $PARTS"
}
# PHP Composer may run out of memory without this
export COMPOSER_MEMORY_LIMIT=-1
################# MAC ###################
#export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
#export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
#########################################
# Direct download from google drive
function drive_dl() {
CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')
echo "Got confirmation: $CONFIRM"
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2
rm -rf /tmp/cookies.txt
}
@nazmulpcc
Copy link
Copy Markdown
Author

Add this in in your .bashrc, .zshrc or similar file for other shells.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment