| 1 | touch ~/.ghost/secret.sh |
| 2 | source ~/.ghost/secret.sh |
| 3 | git config --global core.autocrlf input |
| 4 | if uname -a | grep -q MINGW;then |
| 5 | export thisos='windows' |
| 6 | alias python3=python |
| 7 | alias Python=python |
| 8 | else |
| 9 | alias python=python3 |
| 10 | fi |
| 11 | |
| 12 | alias Vim='vim ~/.vimrc' |
| 13 | alias Gvim='vim ~/.ghost/ghost.vimrc' |
| 14 | alias Gbash='vim ~/.ghost/ghost.sh' |
| 15 | alias clip=clip.exe |
| 16 | alias Bash='vim ~/.bashrc' |
| 17 | alias Source='source ~/.bashrc' |
| 18 | alias ghook='~/.ghost/ghook/startproject.sh' |
| 19 | alias venv='python -m venv venv' |
| 20 | 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 | |
| 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 | } |