Skip to content

Instantly share code, notes, and snippets.

@xfenix
Last active December 16, 2015 08:09
Show Gist options
  • Select an option

  • Save xfenix/5404060 to your computer and use it in GitHub Desktop.

Select an option

Save xfenix/5404060 to your computer and use it in GitHub Desktop.

Revisions

  1. xfenix revised this gist Dec 9, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -112,7 +112,7 @@ function prest() {
    sudo /etc/init.d/postgresql restart
    }

    # web server + php
    # restart pohape + nginx
    function webrst() {
    sudo /etc/init.d/nginx restart
    # restart fpm, only kill, only hardcore
  2. xfenix revised this gist Dec 9, 2013. 1 changed file with 0 additions and 8 deletions.
    8 changes: 0 additions & 8 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,3 @@
    PR_ROOT='/home/dev3/web/beebill/'
    FRONT_ROOT=$PR_ROOT'frontend/bill/app/'
    CONTROLLERS_ROOT=$FRONT_ROOT'controller/'
    STORE_ROOT=$FRONT_ROOT'store/'
    MODEL_ROOT=$FRONT_ROOT'model/'
    VIEW_ROOT=$FRONT_ROOT'view/'
    BACK_ROOT=$PR_ROOT'apps/'

    # bash
    alias rr=". ~/.bash_profile"
    alias ..="cd .."
  3. xfenix revised this gist Dec 9, 2013. 1 changed file with 0 additions and 6 deletions.
    6 changes: 0 additions & 6 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -127,12 +127,6 @@ function webrst() {
    sudo kill -9 $(ps ax | grep php | awk '{print $1}')
    }

    # ssh
    function sshbeta() {
    sshfs -o idmap=user [email protected]:/ ~/web/topnomer_remote/
    # WN3pgbspPg
    }

    # projects
    function pr() {
    ROOT='cd ~/web/'
  4. xfenix revised this gist Dec 9, 2013. 1 changed file with 86 additions and 24 deletions.
    110 changes: 86 additions & 24 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,11 @@
    PR_ROOT='/home/dev3/web/beebill/'
    FRONT_ROOT=$PR_ROOT'frontend/bill/app/'
    CONTROLLERS_ROOT=$FRONT_ROOT'controller/'
    STORE_ROOT=$FRONT_ROOT'store/'
    MODEL_ROOT=$FRONT_ROOT'model/'
    VIEW_ROOT=$FRONT_ROOT'view/'
    BACK_ROOT=$PR_ROOT'apps/'

    # bash
    alias rr=". ~/.bash_profile"
    alias ..="cd .."
    @@ -19,6 +27,10 @@ function frees() {
    sudo swapon -a
    }

    function freet() {
    sudo rm -rf ~/.local/share/Trash/*
    }

    function changeio() {
    echo $1 | sudo tee /sys/block/sda/queue/scheduler
    }
    @@ -41,22 +53,29 @@ function iconcache() {
    fc-cache ~/.fonts
    }

    alias cb='xclip -sel clip'

    # django
    alias dm="./manage.py"
    function dmt() {
    PREFIX='RUN_TESTS=True DJANGO_DB_ENGINE="django.db.backends.sqlite3" dm test apps.'
    INFIX='.tests:'
    if [ $# -eq 3 ]; then
    eval $PREFIX$1$INFIX$2'.'$3
    else
    PREFIX='RUN_TESTS=True DJANGO_DB_ENGINE="django.db.backends.sqlite3" dm test '
    INFIX='.'

    if [ -z "$3" ]; then
    eval $PREFIX$1$INFIX$2
    else
    eval $PREFIX$1$INFIX$2'.'$3
    fi
    }

    function dms() {
    dm shell
    }

    function dmsp() {
    dm shell_plus
    }

    function dr() {
    COMMAND='./manage.py runserver'

    @@ -92,35 +111,50 @@ function mm() {
    fi
    }

    # postgres
    function plogin() {
    sudo -u postgres psql postgres
    }

    function prest() {
    sudo /etc/init.d/postgresql restart
    }

    # web server + php
    function webrst() {
    sudo /etc/init.d/nginx restart
    # restart fpm, only kill, only hardcore
    sudo kill -9 $(ps ax | grep php | awk '{print $1}')
    }

    # ssh
    function sshbeta() {
    sshfs -o idmap=user [email protected]:/ ~/web/topnomer_remote/
    # WN3pgbspPg
    }

    # projects
    function pr() {
    PATH1='cd '$PR_ROOT
    PATH2=''
    WORK='workon '
    ROOT='cd ~/web/'
    VENV='beebill'

    # switch to virtualenv
    if [ $# -eq 2 ]; then
    eval $WORK$2
    else
    eval $WORK$VENV
    fi

    # go to the project root
    if [ $# -eq 1 ]; then
    eval $PATH1$1
    eval 'workon '$1
    eval $ROOT$1'/'
    else
    # default - bill
    eval $PATH1$PATH2
    eval 'workon '$VENV
    eval $ROOT'beebill/'
    fi
    }

    function createui() {
    if [ $# -eq 2 ]; then
    python ~/myscripts/create_ui.py $1 $2 $PR_ROOT $FRONT_ROOT $CONTROLLERS_ROOT $MODEL_ROOT $STORE_ROOT $VIEW_ROOT $BACK_ROOT
    else
    echo 'Not enough params'
    fi
    # if [ $# -eq 2 ]; then
    # python ~/myscripts/create_ui.py $1 $2 $PR_ROOT $FRONT_ROOT $CONTROLLERS_ROOT $MODEL_ROOT $STORE_ROOT $VIEW_ROOT $BACK_ROOT
    # else
    # echo 'Not enough params'
    # fi
    python $PR_ROOT'/scripts/createui.py' $1 $2 $3
    }

    # go to django folder and runserver
    @@ -197,4 +231,32 @@ function gbb() {
    gpo $BILL -u
    }

    alias bst='./buildstatic.sh'
    alias bst='./buildstatic.sh'

    # fix properties
    # PS1="($VIRTUAL_ENV)\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u:\w\$ "

    # Postgres won't work without this
    export PGHOST=/tmp

    # grep colorize
    export GREP_OPTIONS="--color=auto"

    # bash completion
    if [ -f /usr/local/bin/brew ]; then
    if [ -f `/usr/local/bin/brew --prefix`/etc/bash_completion ]; then
    . `/usr/local/bin/brew --prefix`/etc/bash_completion
    fi
    fi

    # bash aliases
    if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
    fi

    # this is for delete words by ^W
    tty -s && stty werase ^- 2>/dev/null

    export PATH=/opt/SenchaSDKTools-2.0.0-beta3:$PATH

    export SENCHA_SDK_TOOLS_2_0_0_BETA3="/opt/SenchaSDKTools-2.0.0-beta3"
  5. xfenix revised this gist Oct 11, 2013. 1 changed file with 28 additions and 8 deletions.
    36 changes: 28 additions & 8 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -44,7 +44,7 @@ function iconcache() {
    # django
    alias dm="./manage.py"
    function dmt() {
    PREFIX='DJANGO_DB_ENGINE="django.db.backends.sqlite3" dm test apps.'
    PREFIX='RUN_TESTS=True DJANGO_DB_ENGINE="django.db.backends.sqlite3" dm test apps.'
    INFIX='.tests:'
    if [ $# -eq 3 ]; then
    eval $PREFIX$1$INFIX$2'.'$3
    @@ -53,6 +53,10 @@ function dmt() {
    fi
    }

    function dms() {
    dm shell
    }

    function dr() {
    COMMAND='./manage.py runserver'

    @@ -90,7 +94,7 @@ function mm() {

    # projects
    function pr() {
    PATH1='cd ~/web/beebill/'
    PATH1='cd '$PR_ROOT
    PATH2=''
    WORK='workon '
    VENV='beebill'
    @@ -111,6 +115,14 @@ function pr() {
    fi
    }

    function createui() {
    if [ $# -eq 2 ]; then
    python ~/myscripts/create_ui.py $1 $2 $PR_ROOT $FRONT_ROOT $CONTROLLERS_ROOT $MODEL_ROOT $STORE_ROOT $VIEW_ROOT $BACK_ROOT
    else
    echo 'Not enough params'
    fi
    }

    # go to django folder and runserver
    function prr() {
    pr
    @@ -131,27 +143,35 @@ alias gst='git status'
    alias gsh='git stash'
    alias gl='git pull'
    alias gp='git push'
    alias gpo='git push origin'
    alias gpo='gp origin'
    alias gd='git diff | sublime'
    alias gau='git add --update'
    alias gc='git commit -vam'
    alias gb='git branch'
    alias gba='git branch -a'
    alias gba='gb -a'
    alias gcoo='git checkout'
    alias gcob='git checkout -b'
    alias gcot='git checkout -t'
    alias gcob='gcoo -b'
    alias gcot='gcoo -t'
    alias gcotb='git checkout --track -b'
    alias glog='git log'
    alias glogp='git log --pretty=format:"%h %s" --graph'
    alias glogp='glog --oneline --abbrev-commit --all --graph --color --decorate'
    alias greset='git reset HEAD~1'

    function gitrack() {
    git update-index --no-assume-unchanged $1
    }

    function gituntrack() {
    git update-index --assume-unchanged $1
    }

    function gco() {
    gcoo BILL-$1
    }

    function glo() {
    gl
    git merge origin dev
    git merge origin/dev
    }

    function gcp() {
  6. xfenix revised this gist Sep 16, 2013. 1 changed file with 58 additions and 12 deletions.
    70 changes: 58 additions & 12 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,57 @@
    # bash
    alias rr=". ~/.bash_profile"

    alias ..="cd .."
    alias ...="cd ../.."
    alias ....="cd ../../.."
    alias .....="cd ../../../.."
    alias ......="cd ../../../../.."

    alias c=clear

    function freem() {
    free -m
    sync
    sudo su -c "echo 3 > /proc/sys/vm/drop_caches"
    free -m
    }

    function frees() {
    sudo swapoff -a
    sudo swapon -a
    }

    function changeio() {
    echo $1 | sudo tee /sys/block/sda/queue/scheduler
    }

    function showio() {
    cat /sys/block/sda/queue/scheduler
    }

    function changexorg() {
    sudo renice -n $1 $(pidof X)
    }

    function iconcache() {
    # update icon cache in the home folder
    for d in ~/.icons/*; do gtk-update-icon-cache -f $d; done
    # update icon cache on the system
    for d in /usr/share/icons/*; do sudo gtk-update-icon-cache -f $d; done
    # Update the font cache
    sudo fc-cache -fv
    fc-cache ~/.fonts
    }

    # django
    alias dm="./manage.py"
    alias dmt="dm test"
    function dmt() {
    PREFIX='DJANGO_DB_ENGINE="django.db.backends.sqlite3" dm test apps.'
    INFIX='.tests:'
    if [ $# -eq 3 ]; then
    eval $PREFIX$1$INFIX$2'.'$3
    else
    eval $PREFIX$1$INFIX$2
    fi
    }

    function dr() {
    COMMAND='./manage.py runserver'
    @@ -51,7 +91,7 @@ function mm() {
    # projects
    function pr() {
    PATH1='cd ~/web/beebill/'
    PATH2='domains/bill/'
    PATH2=''
    WORK='workon '
    VENV='beebill'

    @@ -71,6 +111,12 @@ function pr() {
    fi
    }

    # go to django folder and runserver
    function prr() {
    pr
    dr
    }

    function nums() {
    python <<END
    import re
    @@ -80,12 +126,6 @@ p.communicate(input=re.sub('[^0-9]', '', "$1"))
    END
    }

    # go to django folder and runserver
    function prr() {
    pr
    dr
    }

    # git
    alias gst='git status'
    alias gsh='git stash'
    @@ -105,11 +145,15 @@ alias glog='git log'
    alias glogp='git log --pretty=format:"%h %s" --graph'
    alias greset='git reset HEAD~1'


    function gco() {
    gcoo BILL-$1
    }

    function glo() {
    gl
    git merge origin dev
    }

    function gcp() {
    BILL=$1
    TEXT=$2
    @@ -130,5 +174,7 @@ function gbb() {
    fi

    gcob $BILL origin/$BRANCH
    gpo $BILL
    gpo $BILL -u
    }

    alias bst='./buildstatic.sh'
  7. xfenix revised this gist Jun 10, 2013. 1 changed file with 56 additions and 11 deletions.
    67 changes: 56 additions & 11 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,14 @@
    # bash
    alias rr=". ~/.bash_profile"

    alias ..="cd .."
    alias ...="cd ../.."
    alias ....="cd ../../.."
    alias .....="cd ../../../.."
    alias ......="cd ../../../../.."

    alias c=clear

    # django
    alias dm="./manage.py"
    alias dmt="dm test"
    @@ -27,20 +35,22 @@ function drk() {

    # mysql
    function mm() {
    INIT='sudo /etc/init.d/mysql '
    INIT='sudo service mysql '

    if [ $1 = 's' ]; then
    eval $INIT start
    elif [ $1 = 'r' ]; then
    eval $INIT restart
    if [ $# -eq 1 ]; then
    if [ $1 = 's' ]; then
    eval $INIT start
    elif [ $1 = 'r' ]; then
    eval $INIT restart
    fi
    else
    eval $INIT stop
    fi
    }

    # projects
    function pr() {
    PATH1='cd ~/web/git/beebill/'
    PATH1='cd ~/web/beebill/'
    PATH2='domains/bill/'
    WORK='workon '
    VENV='beebill'
    @@ -61,6 +71,15 @@ function pr() {
    fi
    }

    function nums() {
    python <<END
    import re
    from subprocess import Popen, PIPE
    p = Popen(['xsel','-bi'], stdin=PIPE)
    p.communicate(input=re.sub('[^0-9]', '', "$1"))
    END
    }

    # go to django folder and runserver
    function prr() {
    pr
    @@ -73,17 +92,43 @@ alias gsh='git stash'
    alias gl='git pull'
    alias gp='git push'
    alias gpo='git push origin'
    alias gd='git diff | mate'
    alias gd='git diff | sublime'
    alias gau='git add --update'
    alias gc='git commit -vam'
    alias gcv='git commit -v -a'
    alias gb='git branch'
    alias gba='git branch -a'
    alias gbb='git branch -b'
    alias gco='git checkout'
    alias gcoo='git checkout'
    alias gcob='git checkout -b'
    alias gcot='git checkout -t'
    alias gcotb='git checkout --track -b'
    alias glog='git log'
    alias glogp='git log --pretty=format:"%h %s" --graph'
    alias greset='git reset HEAD~1'
    alias greset='git reset HEAD~1'


    function gco() {
    gcoo BILL-$1
    }

    function gcp() {
    BILL=$1
    TEXT=$2
    gc "BILL-$BILL: $TEXT"
    gpo BILL-$BILL
    }

    function gbb() {
    BRANCH=$1
    BILL=BILL-$2

    if [ $1 = 'd' ]; then
    BRANCH='dev'
    fi

    if [ $1 = 'm' ]; then
    BRANCH='master'
    fi

    gcob $BILL origin/$BRANCH
    gpo $BILL
    }
  8. xfenix revised this gist Apr 19, 2013. 1 changed file with 9 additions and 4 deletions.
    13 changes: 9 additions & 4 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,7 @@ alias rr=". ~/.bash_profile"

    # django
    alias dm="./manage.py"
    alias dmt="dm test"

    function dr() {
    COMMAND='./manage.py runserver'
    @@ -21,7 +22,7 @@ function drk() {
    PORT=8000
    fi

    eval sudo fuser -k $PORT/tcp
    eval fuser -k $PORT/tcp
    }

    # mysql
    @@ -68,17 +69,21 @@ function prr() {

    # git
    alias gst='git status'
    alias gsh='git stash'
    alias gl='git pull'
    alias gp='git push'
    alias gpo='git push origin'
    alias gd='git diff | mate'
    alias gau='git add --update'
    alias gc='git commit -v'
    alias gca='git commit -v -a'
    alias gc='git commit -vam'
    alias gcv='git commit -v -a'
    alias gb='git branch'
    alias gba='git branch -a'
    alias gbb='git branch -b'
    alias gco='git checkout'
    alias gcob='git checkout -b'
    alias gcot='git checkout -t'
    alias gcotb='git checkout --track -b'
    alias glog='git log'
    alias glogp='git log --pretty=format:"%h %s" --graph'
    alias glogp='git log --pretty=format:"%h %s" --graph'
    alias greset='git reset HEAD~1'
  9. xfenix revised this gist Apr 17, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ function dr() {
    COMMAND='./manage.py runserver'

    if [ $# -eq 1 ]; then
    eval $COMMAND' '$1
    eval $COMMAND $1
    else
    eval $COMMAND
    fi
  10. xfenix created this gist Apr 17, 2013.
    84 changes: 84 additions & 0 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,84 @@
    # bash
    alias rr=". ~/.bash_profile"

    # django
    alias dm="./manage.py"

    function dr() {
    COMMAND='./manage.py runserver'

    if [ $# -eq 1 ]; then
    eval $COMMAND' '$1
    else
    eval $COMMAND
    fi
    }

    function drk() {
    if [ $# -eq 1 ]; then
    PORT=$1
    else
    PORT=8000
    fi

    eval sudo fuser -k $PORT/tcp
    }

    # mysql
    function mm() {
    INIT='sudo /etc/init.d/mysql '

    if [ $1 = 's' ]; then
    eval $INIT start
    elif [ $1 = 'r' ]; then
    eval $INIT restart
    else
    eval $INIT stop
    fi
    }

    # projects
    function pr() {
    PATH1='cd ~/web/git/beebill/'
    PATH2='domains/bill/'
    WORK='workon '
    VENV='beebill'

    # switch to virtualenv
    if [ $# -eq 2 ]; then
    eval $WORK$2
    else
    eval $WORK$VENV
    fi

    # go to the project root
    if [ $# -eq 1 ]; then
    eval $PATH1$1
    else
    # default - bill
    eval $PATH1$PATH2
    fi
    }

    # go to django folder and runserver
    function prr() {
    pr
    dr
    }

    # git
    alias gst='git status'
    alias gl='git pull'
    alias gp='git push'
    alias gd='git diff | mate'
    alias gau='git add --update'
    alias gc='git commit -v'
    alias gca='git commit -v -a'
    alias gb='git branch'
    alias gba='git branch -a'
    alias gco='git checkout'
    alias gcob='git checkout -b'
    alias gcot='git checkout -t'
    alias gcotb='git checkout --track -b'
    alias glog='git log'
    alias glogp='git log --pretty=format:"%h %s" --graph'