Skip to content

Instantly share code, notes, and snippets.

@stephanecoinon
Last active June 2, 2016 21:47
Show Gist options
  • Save stephanecoinon/abaffb651fb135e5b467 to your computer and use it in GitHub Desktop.
Save stephanecoinon/abaffb651fb135e5b467 to your computer and use it in GitHub Desktop.
Aliases
# Just download this file to your home directory and load it from your ~/.zshrc or ~/.bashrc
### Configuration
# Determine current shell
SHELLNAME=${SHELL##*/}
SHELLCONFIG="~/.${SHELLNAME}rc"
# Set editor
export EDITOR='subl -w'
# Set path to homestead (laravel vagrant box)
HOMESTEAD_PATH="~/web/Homestead"
### Shell profile and aliases handling
# Edit shell preferences
alias sh:e="${EDITOR} ${SHELLCONFIG} &"
# Reload shell preferences
alias sh:r=". ${SHELLCONFIG} && echo \"Reloaded ${SHELLCONFIG}\""
# Update your .aliases from this gist
alias sha:u='curl https://gist.githubusercontent.com/stephanecoinon/abaffb651fb135e5b467/raw > ~/.aliases && sha:r'
# Edit local aliases
alias sha:e="${EDITOR} ~/.aliases &"
# Reload local aliases
alias sha:r='. ~/.aliases && echo "Reloaded ~/.aliases"'
### Command line customisations
alias ~='cd ~'
alias path='echo -e ${PATH//:/\\n}'
alias nowtime='date +"%T"'
alias nowdate='date +"%d-%m-%Y"'
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../../'
alias .3='cd ../../../'
alias .4='cd ../../../../'
alias h='history'
function mkcd {
mkdir -p "$@" && cd "$@"
}
### Git
alias gitname='git config --global user.name'
alias gitemail='git config --global user.email'
function gitas {
gitname $1
gitemail $2
}
alias gitwho='gitname && gitemail'
alias gitasme='gitas Stephane me@stephanecoinon.co.uk && gitwho'
alias gitaswork='gitas Stephane stephane@dentalserve.net && gitwho'
# Check if a port is in use
function sniff {
sudo netstat -anltp|grep :$1
}
### Handy shortcuts
alias subl.="${EDITOR} . &"
# Always continue download if aborted
alias wget='wget -c'
# Downloads a whole website, usage: wget-dump www.my-website.com
alias wget-dump='wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains $1 --no-parent $1'
### Laravel
alias artisan="php artisan"
alias art="php artisan"
alias arts="art serve"
function art:env {
export APP_ENV=$1 && echo "Changed laravel environment to $1"
}
# artisan command run from workbench package directory
alias artp="php ../../../artisan"
alias artps="artp serve"
### Laravel Generators
alias g:m="php artisan generate:model"
alias g:c="php artisan generate:controller"
alias g:v="php artisan generate:view"
alias g:s="php artisan generate:seed"
alias g:mig="php artisan generate:migration"
alias g:r="php artisan generate:resource"
### Laravel Homestead
alias hs="cd $HOMESTEAD_PATH"
alias hs:cfg="${EDITOR} \"$HOMESTEAD_PATH/Homestead.yaml\""
alias hs:r="sh -c 'cd $HOMESTEAD_PATH; vagrant reload --provision'"
alias hs:up="sh -c 'cd $HOMESTEAD_PATH; vagrant up'"
alias hs:halt="sh -c 'cd $HOMESTEAD_PATH; vagrant halt'"
alias hs:down="sh -c 'cd $HOMESTEAD_PATH; vagrant destroy'"
alias hs:s="sh -c 'cd $HOMESTEAD_PATH; vagrant status'"
alias hs:vm="ssh vagrant@127.0.0.1 -p 2222"
alias vm='hs:vm'
### Vagrant
alias vup='vagrant up'
alias vssh='vagrant ssh'
alias vhalt='vagrant halt'
alias vdown='vagrant destroy'
alias vstatus='vagrant global-status'
### Testing
# CodeCeption
# to run full suite, just type: cc run
alias cc="vendor/bin/codecept"
alias cc:u="cc run unit"
alias cc:f="cc run functional"
alias cc:a="cc run acceptance"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment