A combination of vim and bash that I find useful
pull is always rebase
3 files changed, +115 -109
+16-0dwipe.sh
| @@ -0,0 +1,16 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +containers=`docker container ls -aq` | |
| 3 | +images=`docker image ls -q` | |
| 4 | +volumes=`docker volume ls -q` | |
| 5 | +if [ ${#containers} != 0 ];then | |
| 6 | + docker container rm -f $containers | |
| 7 | +fi | |
| 8 | +echo 'All containers deleted.' | |
| 9 | +if [ ${#images} != 0 ];then | |
| 10 | + docker image rm -f $images | |
| 11 | +fi | |
| 12 | +echo 'All images deleted.' | |
| 13 | +if [ ${#volumes} != 0 ];then | |
| 14 | + docker volume rm -f $volumes | |
| 15 | +fi | |
| 16 | +echo 'All volumes deleted.' |
+86-0gfuncs.sh
| @@ -0,0 +1,86 @@ | ||
| 1 | +function gcom { | |
| 2 | + local message=$@ | |
| 3 | + echo "$message" | |
| 4 | + git add . && git commit -m "$message" | |
| 5 | +} | |
| 6 | +function vsource() { | |
| 7 | + local start=`pwd` | |
| 8 | + for i in $(seq 1 5);do | |
| 9 | + if ! source venv/**/activate; then | |
| 10 | + cd .. | |
| 11 | + else | |
| 12 | + cd $start | |
| 13 | + break | |
| 14 | + fi | |
| 15 | + done | |
| 16 | +} | |
| 17 | +function Gpush() { | |
| 18 | + local start=`pwd` | |
| 19 | + cd ~/.ghost | |
| 20 | + gcom $@ | |
| 21 | + git push -u origin main | |
| 22 | + cd $start | |
| 23 | +} | |
| 24 | +function djs() { | |
| 25 | + local start=`pwd` | |
| 26 | + for i in $(seq 1 5);do | |
| 27 | + if test -f manage.py;then | |
| 28 | + python manage.py runserver $1 | |
| 29 | + break | |
| 30 | + fi | |
| 31 | + done | |
| 32 | +} | |
| 33 | +function dj() { | |
| 34 | + local start=`pwd` | |
| 35 | + for i in $(seq 1 5);do | |
| 36 | + if test -f manage.py;then | |
| 37 | + python manage.py $@ | |
| 38 | + break | |
| 39 | + fi | |
| 40 | + done | |
| 41 | +} | |
| 42 | +function Gupdate() { | |
| 43 | + local start=`pwd` | |
| 44 | + cd ~/.ghost && git pull | |
| 45 | + Source | |
| 46 | + cd $start | |
| 47 | +} | |
| 48 | +function pygrep { | |
| 49 | + local start=`pwd` | |
| 50 | + local pylocation=`which python` | |
| 51 | + local pydir=`dirname $pylocation` | |
| 52 | + local packagedir=$pydir/Lib/site-packages | |
| 53 | + cd $packagedir | |
| 54 | + local package=$1 | |
| 55 | + shift | |
| 56 | + grep -rni "$@" $package | |
| 57 | + cd $start | |
| 58 | +} | |
| 59 | +function rootrun { | |
| 60 | + local start=`pwd` | |
| 61 | + for i in $(seq 1 5);do | |
| 62 | + if test -f rootrun.sh;then | |
| 63 | + chmod +x rootrun.sh | |
| 64 | + ./rootrun.sh | |
| 65 | + break | |
| 66 | + else | |
| 67 | + cd .. | |
| 68 | + fi | |
| 69 | + done | |
| 70 | + cd $start | |
| 71 | +} | |
| 72 | +function gcode { | |
| 73 | + local files=`find . -name $1` | |
| 74 | + local i=0 | |
| 75 | + local choices=( ) | |
| 76 | + for r in $files;do | |
| 77 | + echo "$i) $r" | |
| 78 | + choices+=( $r ) | |
| 79 | + let i=i+1 | |
| 80 | + done | |
| 81 | + echo "What file do you want?" | |
| 82 | + read choicenum | |
| 83 | + local choice=${choices[$choicenum]} | |
| 84 | + echo "Opening $choice with vscode" | |
| 85 | + code $choice | |
| 86 | +} |
+13-109ghost.sh
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | touch ~/.ghost/secret.sh |
| 2 | 2 | source ~/.ghost/secret.sh |
| 3 | 3 | git config --global core.autocrlf input |
| 4 | +git config --global pull.rebase true | |
| 4 | 5 | if uname -a | grep -q MINGW;then |
| 5 | 6 | export thisos='windows' |
| 6 | 7 | alias python3=python |
| @@ -8,121 +9,24 @@ if uname -a | grep -q MINGW;then | ||
| 8 | 9 | else |
| 9 | 10 | alias python=python3 |
| 10 | 11 | fi |
| 11 | -#alias python=python3 | |
| 12 | 12 | alias Vim='vim ~/.vimrc' |
| 13 | 13 | alias Gvim='vim ~/.ghost/ghost.vimrc' |
| 14 | 14 | alias Gbash='vim ~/.ghost/ghost.sh' |
| 15 | +alias Gfuncs='vim ~/.ghost/gfuncs.sh' | |
| 15 | 16 | alias clip=clip.exe |
| 16 | 17 | alias Bash='vim ~/.bashrc' |
| 17 | 18 | alias Source='source ~/.bashrc' |
| 18 | 19 | alias ghook='~/.ghost/ghook/startproject.sh' |
| 19 | 20 | alias venv='python -m venv venv' |
| 20 | 21 | alias Gsecret='vim ~/.ghost/secret.sh' |
| 21 | -function gcom { | |
| 22 | - local message=$@ | |
| 23 | - echo "$message" | |
| 24 | - git add . && git commit -m "$message" | |
| 25 | -} | |
| 26 | -function vsource() { | |
| 27 | - local start=`pwd` | |
| 28 | - for i in $(seq 1 5);do | |
| 29 | - if ! source venv/**/activate; then | |
| 30 | - cd .. | |
| 31 | - else | |
| 32 | - cd $start | |
| 33 | - break | |
| 34 | - fi | |
| 35 | - done | |
| 36 | -} | |
| 37 | -function Gpush() { | |
| 38 | - local start=`pwd` | |
| 39 | - cd ~/.ghost | |
| 40 | - gcom $@ | |
| 41 | - git push -u origin main | |
| 42 | - cd $start | |
| 43 | -} | |
| 44 | -function djs() { | |
| 45 | - local start=`pwd` | |
| 46 | - for i in $(seq 1 5);do | |
| 47 | - if test -f manage.py;then | |
| 48 | - python manage.py runserver $1 | |
| 49 | - break | |
| 50 | - fi | |
| 51 | - done | |
| 52 | -} | |
| 53 | -function dj() { | |
| 54 | - local start=`pwd` | |
| 55 | - for i in $(seq 1 5);do | |
| 56 | - if test -f manage.py;then | |
| 57 | - python manage.py $@ | |
| 58 | - break | |
| 59 | - fi | |
| 60 | - done | |
| 61 | -} | |
| 62 | -function Gupdate() { | |
| 63 | - local start=`pwd` | |
| 64 | - cd ~/.ghost && git pull | |
| 65 | - Source | |
| 66 | - cd $start | |
| 67 | -} | |
| 68 | -function djp() { | |
| 69 | - # start a django project | |
| 70 | - django-admin startproject $@ | |
| 71 | -} | |
| 72 | -function pi { | |
| 73 | - python -m pip install $@ | |
| 74 | -} | |
| 75 | -function pm { | |
| 76 | - python -m $@ | |
| 77 | -} | |
| 78 | -function redis { | |
| 79 | - docker run -p 6379:6379 --name redis -d redis:5 | |
| 80 | -} | |
| 81 | -function redis-cli { | |
| 82 | - docker exec -it redis redis-cli $@ | |
| 83 | -} | |
| 84 | -function pygrep { | |
| 85 | - local start=`pwd` | |
| 86 | - local pylocation=`which python` | |
| 87 | - local pydir=`dirname $pylocation` | |
| 88 | - local packagedir=$pydir/Lib/site-packages | |
| 89 | - cd $packagedir | |
| 90 | - local package=$1 | |
| 91 | - shift | |
| 92 | - grep -rni "$@" $package | |
| 93 | - cd $start | |
| 94 | -} | |
| 95 | -function rootrun { | |
| 96 | - local start=`pwd` | |
| 97 | - for i in $(seq 1 5);do | |
| 98 | - if test -f rootrun.sh;then | |
| 99 | - chmod +x rootrun.sh | |
| 100 | - ./rootrun.sh | |
| 101 | - break | |
| 102 | - else | |
| 103 | - cd .. | |
| 104 | - fi | |
| 105 | - done | |
| 106 | - cd $start | |
| 107 | -} | |
| 108 | -function gcode { | |
| 109 | - local files=`find . -name $1` | |
| 110 | - local i=0 | |
| 111 | - local choices=( ) | |
| 112 | - for r in $files;do | |
| 113 | - echo "$i) $r" | |
| 114 | - choices+=( $r ) | |
| 115 | - let i=i+1 | |
| 116 | - done | |
| 117 | - echo "What file do you want?" | |
| 118 | - read choicenum | |
| 119 | - local choice=${choices[$choicenum]} | |
| 120 | - echo "Opening $choice with vscode" | |
| 121 | - code $choice | |
| 122 | -} | |
| 123 | -function postgres { | |
| 124 | - docker run -p 5432:5432 --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres | |
| 125 | -} | |
| 126 | -function psql { | |
| 127 | - docker exec -it postgres psql -U postgres $@ | |
| 128 | -} | |
| 22 | +alias postgres='docker run -p 5432:5432 --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -v postgres -d postgres:15' | |
| 23 | +alias psql='docker exec -it postgres psql -U postgres' | |
| 24 | +alias redis='docker run -p 6379:6379 --name redis -v redis -d redis:5' | |
| 25 | +alias redis-cli='docker exec -it redis redis-cli' | |
| 26 | +alias pm='python -m' | |
| 27 | +alias pi='python -m pip install' | |
| 28 | +alias djp='django-admin startproject' | |
| 29 | +alias dwipe='~/.ghost/dwipe.sh' | |
| 30 | +alias Ggit='vim ~/.gitconfig' | |
| 31 | + | |
| 32 | +source ~/.ghost/gfuncs.sh |