Skip to content

Instantly share code, notes, and snippets.

@dragol7
Last active April 30, 2018 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragol7/eff980339bd82da3fce0164d0a1c03e1 to your computer and use it in GitHub Desktop.
Save dragol7/eff980339bd82da3fce0164d0a1c03e1 to your computer and use it in GitHub Desktop.
.bashrc file example
# =============================================================== #
#
# By Dragoljub Bogicevic [d.bogicevic7@gmail.com]
#
# Last modified: Sun Apr 30 11:37:47 CET 2018
#
# This file is normally read by interactive shells only.
# Here is the place to define your aliases, functions and
# other interactive features like your prompt.
#
# =============================================================== #
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/opt/php@7.1/bin:$PATH"
export PATH="/usr/local/opt/php@7.1/sbin:$PATH"
export EDITOR=/usr/bin/nano
[[ -f "~/git_completion.bash" ]] && source "~/git_completion.bash"
SCRIPTS_DIR=~
source $SCRIPTS_DIR/.dragol_bash/.dragol_bash_profile_help.bash
### general ###
alias c="clear"
alias h="cd ~/ && clear"
alias l="logout"
alias .="cd ../"
alias ..="cd ../../"
alias p="pwd"
alias ff="find / -name "
alias fd="find / -type d -name "
alias bp="cd ~ && nano .bash_profile"
alias bph="cd ~/.dragol_bash && nano .dragol_bash_profile_help.bash"
alias z="cd ~/Zwivel- && clear"
alias host="cd /private/etc/"
alias w="which "
alias ll="ls -lhA"
alias ip="curl http://ipecho.net/plain; echo"
alias n="sudo nano "
### phpstorm ###
alias pl="sudo npm i ilsap -g && ilsap"
### git ###
alias gii="git init"
alias gs="git status"
alias gl="git log"
alias glv="git log --graph --decorate --oneline"
alias glv2="git log --pretty=oneline --graph --decorate --all"
#alias glv3="git log --pretty='%Cred%h%Creset | %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)[%an]%Creset'"
alias glv4="git log --pretty='%Cred%h%Creset | %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)[%an]%Creset' --graph --all"
alias ga="git add"
# stages new and modified, without deleted
alias ga.="git add ."
# stages all
alias gaa="git add -A"
alias gcam="git commit -am"
alias gch="git checkout"
alias gchb="git checkout -b"
alias gst="git stash"
alias gsta="git stash apply"
alias grh="git reset --hard"
alias gri="git rebase -i"
alias gb="git branch"
alias gpo="git pull origin"
### git flow ###
alias gfi="git flow init -d"
alias gffs="git flow feature start"
alias gffp="git flow feature publish"
alias gfff="git flow feature finish"
alias gfrs="git flow release start"
alias gfrf="git flow release finish"
### angular ###
alias ngs="ng serve --open"
alias nggc="ng generate component"
alias nggmr="ng generate module app-routing --flat --module=app"
alias ngl="ng lint"
alias ngv="ng --version"
### vagrant ###
alias vii="vagrant init"
alias vu="vagrant up"
alias vh="vagrant halt"
alias vd="vagrant destroy -f"
alias vssh="vagrant ssh"
alias vs="vagrant status"
alias vr="vagrant reload"
alias vv="vagrant -v"
### composer ###
alias ci="composer install"
alias cii="composer init"
alias cu="composer update"
alias cda="composer dump-autoload"
alias ccc="composer clear-cache"
alias cv="composer --version"
### php ###
alias pv="php -v"
### phpunit ###
alias pu="vendor/bin/phpunit"
### laravel ###
alias pas="php artisan serve"
alias pat="php artisan tinker"
alias pacc="php artisan cache:clear"
alias pamc="php artisan make:controller"
alias pamm="php artisan make:model"
alias pammi="php artisan make:migration"
alias parl="php artisan route:list"
alias parc="php artisan route:clear"
alias pam="php artisan migrate"
alias pav="php artisan --version"
### sonarqube ###
alias ss="sonar-scanner.bat"
### fancy promp ###
#export PS1="\[\033[01;33m\][$USER@$HOSTNAME]\[\033[0;00m\] \[\033[01;32m\]\w\\n\[\033[01;95m\]$\[\033[0;00m\] "
#PROMPT_COMMAND='echo -ne "\033]0;${PWD/$HOME/~} - ${USER}@${HOSTNAME}\007"'
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
#export PS1="\[\033[01;33m\][dragol]\033[01;95m\]$(__git_ps1)\[\033[0;00m\] \[\033[0;00m\]\[\033[01;32m\]\w\\n\[\033[01;95m\]$\[\033[0;00m\] "
export PS1="\[\033[01;33m\][dragol]\033[01;95m\]\$(parse_git_branch)\[\033[0;00m\] \[\033[0;00m\]\[\033[01;32m\]\w\\n\[\033[01;95m\]$\[\033[0;00m\] "
# ------- FUNCTIONS ------- #
### general ###
md() {
mkdir $1 && cd $1
}
hi() {
history $1
}
### composer ###
cr() {
composer require $1
}
crd() {
composer require $1 --dev
}
crm() {
composer remove $1
}
crmd() {
composer remove $1 --dev
}
### git ###
gcm() {
git commit -m \'$1\'
}
glv3() {
if [ -z "$1" ]; then git log --pretty='%Cred%h%Creset | %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)[%an]%Creset';
else git log -n $1 --pretty='%Cred%h%Creset | %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)[%an]%Creset'; fi
}
gss() {
git show $1 --stat
}
gssa() {
git log --shortstat --author=$1 | grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed: ", files, "lines inserted: ", inserted, "lines deleted: ", deleted }'
}
gp() {
cb="$(git rev-parse --abbrev-ref HEAD)"
git push origin "${cb}"
}
### laravel ###
ln() {
composer create-project --prefer-dist laravel/laravel $1
}
### elasticsearch ###
es() {
cd ~/Downloads/elasticsearch-1.7.2/bin
./elasticsearch
}
### compass ###
cc() {
cd ~/Zwivel-
compass clean && compass compile
}
### angular ###
ngn() {
ng new $1
}
nggs() {
ng generate service $1 --module=app
}
### php ###
ps() {
port=$1
if [ $# -eq 0 ]
then
port=8080
fi
php -S localhost:${port}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment