Skip to content

Instantly share code, notes, and snippets.

@Sam-R
Last active September 19, 2020 13:26
Show Gist options
  • Save Sam-R/1fa9525f6a2c835ba8c3bdd9c7ba1a1f to your computer and use it in GitHub Desktop.
Save Sam-R/1fa9525f6a2c835ba8c3bdd9c7ba1a1f to your computer and use it in GitHub Desktop.
Bash aliases file.
# ---------------------------------------
# Git Commands
# ---------------------------------------
alias gits="git status"
alias gitp="git push"
alias gita="git add -A"
alias gitc="git commit"
alias gitcr="git remote set-url origin"
alias gitdiff="git difftool --tool=meld --dir-diff"
# ---------------------------------------
# Standard System Commands
# ---------------------------------------
alias la="ls -la"
# ---------------------------------------
# Laravel Commands
# ---------------------------------------
alias lararoute='php artisan route:list'
alias laraserve='php artisan serve'
alias laramake='php artisan make'
alias laranew="composer create-project --prefer-dist laravel/laravel $1"
laranew_lts() {
composer create-project --prefer-dist laravel/laravel "$1" "5.5.*"
}
alias phpunit="./vendor/bin/phpunit"
alias vapor="./vendor/bin/vapor"
# ---------------------------------------
# Docker Commands
# ---------------------------------------
alias docker-refresh='docker-compose down && docker-compose up'
alias docker="sudo docker"
alias docker-compose="sudo docker-compose"
di() {
sudo docker exec -it "$1" /bin/bash
}
# ---------------------------------------
# PHP commands
# ---------------------------------------
alias phpunit="./vendor/bin/phpunit"
alias vapor="./vendor/bin/vapor"
# ---------------------------------------
# MiscCommands
# ---------------------------------------
# Scrape images with wget
# https://davidwalsh.name/scrape-images-wget
# $1 = url
# Example: scrapeimages https://davidwalsh.name/
scrapeimages() {
wget -nd -H -p -A jpg,jpeg,png,gif -e robots=off $1
}
# Kill off a local dev env
startover() {
echo 'Killing everything'
rm -rf build/
docker-compose down
docker rm -f $(docker ps -a -q)
docker rmi -f $(docker images -q)
echo 'Everything killed, my lord'
}
# Sort history by most used commands
#alias histograph=history|awk '{print $2}'|sort|uniq -c|sort -rn|head -30|awk '!max{max=$1;}{r="";i=s=100*$1/max;while(i-->0)r=r"#";printf "%50s %5d %s %s",$2,$1,r,"\n";}'
# Find
alias dhsort='du -a -d 1 -h | sort -h'
alias dusort='du -a -d 1 | sort -n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment