forked from andy3471/keyshare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases
276 lines (232 loc) · 7.32 KB
/
aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
alias ..="cd .."
alias ...="cd ../.."
alias h='cd ~'
alias c='clear'
alias art=artisan
alias phpspec='vendor/bin/phpspec'
alias phpunit='vendor/bin/phpunit'
alias serve=serve-laravel
alias xoff='sudo phpdismod -s cli xdebug'
alias xon='sudo phpenmod -s cli xdebug'
alias nrd="npm run dev"
alias nrw="npm run watch"
alias nrwp="npm run watch-poll"
alias nrh="npm run hot"
alias nrp="npm run production"
alias yrd="yarn run dev"
alias yrw="yarn run watch"
alias yrwp="yarn run watch-poll"
alias yrh="yarn run hot"
alias yrp="yarn run production"
function artisan() {
php artisan "$@"
}
function dusk() {
pids=$(pidof /usr/bin/Xvfb)
if [ ! -n "$pids" ]; then
Xvfb :0 -screen 0 1280x960x24 &
fi
php artisan dusk "$@"
}
function php71() {
sudo update-alternatives --set php /usr/bin/php7.1
sudo update-alternatives --set php-config /usr/bin/php-config7.1
sudo update-alternatives --set phpize /usr/bin/phpize7.1
}
function php72() {
sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set php-config /usr/bin/php-config7.2
sudo update-alternatives --set phpize /usr/bin/phpize7.2
}
function php73() {
sudo update-alternatives --set php /usr/bin/php7.3
sudo update-alternatives --set php-config /usr/bin/php-config7.3
sudo update-alternatives --set phpize /usr/bin/phpize7.3
}
function serve-apache() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/scripts/serve-apache.sh
sudo bash /vagrant/scripts/serve-apache.sh "$1" "$2" 80 443 "${3:-7.1}"
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-apache domain path"
fi
}
function serve-laravel() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/scripts/serve-laravel.sh
sudo bash /vagrant/scripts/serve-laravel.sh "$1" "$2" 80 443 "${3:-7.1}"
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve domain path"
fi
}
function serve-proxy() {
if [[ "$1" && "$2" ]]
then
sudo dos2unix /vagrant/scripts/serve-proxy.sh
sudo bash /vagrant/scripts/serve-proxy.sh "$1" "$2" 80 443 "${3:-7.1}"
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-proxy domain port"
fi
}
function serve-silverstripe() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/scripts/serve-silverstripe.sh
sudo bash /vagrant/scripts/serve-silverstripe.sh "$1" "$2" 80 443 "${3:-7.1}"
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-silverstripe domain path"
fi
}
function serve-spa() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/scripts/serve-spa.sh
sudo bash /vagrant/scripts/serve-spa.sh "$1" "$2" 80 443 "${3:-7.1}"
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-spa domain path"
fi
}
function serve-statamic() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/scripts/serve-statamic.sh
sudo bash /vagrant/scripts/serve-statamic.sh "$1" "$2" 80 443 "${3:-7.1}"
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-statamic domain path"
fi
}
function serve-symfony2() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/scripts/serve-symfony2.sh
sudo bash /vagrant/scripts/serve-symfony2.sh "$1" "$2" 80 443 "${3:-7.1}"
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-symfony2 domain path"
fi
}
function serve-symfony4() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/scripts/serve-symfony4.sh
sudo bash /vagrant/scripts/serve-symfony4.sh "$1" "$2" 80 443 "${3:-7.1}"
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-symfony4 domain path"
fi
}
function serve-pimcore() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/scripts/serve-pimcore.sh
sudo bash /vagrant/scripts/serve-pimcore.sh "$1" "$2" 80 443 "${3:-7.1}"
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-pimcore domain path"
fi
}
function share() {
if [[ "$1" ]]
then
ngrok http ${@:2} -host-header="$1" 80
else
echo "Error: missing required parameters."
echo "Usage: "
echo " share domain"
echo "Invocation with extra params passed directly to ngrok"
echo " share domain -region=eu -subdomain=test1234"
fi
}
function flip() {
sudo bash /vagrant/scripts/flip-webserver.sh
}
function __has_pv() {
$(hash pv 2>/dev/null);
return $?
}
function __pv_install_message() {
if ! __has_pv; then
echo $1
echo "Install pv with \`sudo apt-get install -y pv\` then run this command again."
echo ""
fi
}
function dbexport() {
FILE=${1:-/vagrant/mysqldump.sql.gz}
# This gives an estimate of the size of the SQL file
# It appears that 80% is a good approximation of
# the ratio of estimated size to actual size
SIZE_QUERY="select ceil(sum(data_length) * 0.8) as size from information_schema.TABLES"
__pv_install_message "Want to see export progress?"
echo "Exporting databases to '$FILE'"
if __has_pv; then
ADJUSTED_SIZE=$(mysql --vertical -uhomestead -psecret -e "$SIZE_QUERY" 2>/dev/null | grep 'size' | awk '{print $2}')
HUMAN_READABLE_SIZE=$(numfmt --to=iec-i --suffix=B --format="%.3f" $ADJUSTED_SIZE)
echo "Estimated uncompressed size: $HUMAN_READABLE_SIZE"
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | pv --size=$ADJUSTED_SIZE | gzip > "$FILE"
else
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | gzip > "$FILE"
fi
echo "Done."
}
function dbimport() {
FILE=${1:-/vagrant/mysqldump.sql.gz}
__pv_install_message "Want to see import progress?"
echo "Importing databases from '$FILE'"
if __has_pv; then
pv "$FILE" --progress --eta | zcat | mysql -uhomestead -psecret 2>/dev/null
else
cat "$FILE" | zcat | mysql -uhomestead -psecret 2>/dev/null
fi
echo "Done."
}
function xphp() {
(php -m | grep -q xdebug)
if [[ $? -eq 0 ]]
then
XDEBUG_ENABLED=true
else
XDEBUG_ENABLED=false
fi
if ! $XDEBUG_ENABLED; then xon; fi
php \
-dxdebug.remote_host=192.168.10.1 \
-dxdebug.remote_autostart=1 \
"$@"
if ! $XDEBUG_ENABLED; then xoff; fi
}
function update-socket-wrench() {
cd /var/www/socket-wrench
git pull origin release
composer install
php artisan migrate --force
}
function seed-socket-wrench() {
cd /var/www/socket-wrench
php artisan db:seed
}