irongit

A combination of vim and bash that I find useful

ghostshell/ghost.sh
128 lines2.7 KBBourne Again Shell (bash)
1touch ~/.ghost/secret.sh
2source ~/.ghost/secret.sh
3git config --global core.autocrlf input
4if uname -a | grep -q MINGW;then
5 export thisos='windows'
6 alias python3=python
7 alias Python=python
8else
9 alias python=python3
10fi
11#alias python=python3
12alias Vim='vim ~/.vimrc'
13alias Gvim='vim ~/.ghost/ghost.vimrc'
14alias Gbash='vim ~/.ghost/ghost.sh'
15alias clip=clip.exe
16alias Bash='vim ~/.bashrc'
17alias Source='source ~/.bashrc'
18alias ghook='~/.ghost/ghook/startproject.sh'
19alias venv='python -m venv venv'
20alias Gsecret='vim ~/.ghost/secret.sh'
21function gcom {
22 local message=$@
23 echo "$message"
24 git add . && git commit -m "$message"
25}
26function 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}
37function Gpush() {
38 local start=`pwd`
39 cd ~/.ghost
40 gcom $@
41 git push -u origin main
42 cd $start
43}
44function 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}
53function 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}
62function Gupdate() {
63 local start=`pwd`
64 cd ~/.ghost && git pull
65 Source
66 cd $start
67}
68function djp() {
69 # start a django project
70 django-admin startproject $@
71}
72function pi {
73 python -m pip install $@
74}
75function pm {
76 python -m $@
77}
78function redis {
79 docker run -p 6379:6379 --name redis -d redis:5
80}
81function redis-cli {
82 docker exec -it redis redis-cli $@
83}
84function 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}
95function 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}
108function 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}
123function postgres {
124 docker run -p 5432:5432 --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres
125}
126function psql {
127 docker exec -it postgres psql -U postgres $@
128}