forked from enflow/wsl2-php-development
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_aliases
executable file
·159 lines (125 loc) · 3.74 KB
/
.bash_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
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias h='cd ~'
alias c='clear'
alias wip='git commit -am "WIP" && git pull origin HEAD --no-edit && git push -u origin HEAD'
alias pd='git pull --no-edit && git push -u origin HEAD && $(crane deploy > /dev/null 2>&1)'
alias fpd='git push -u origin HEAD && $(crane deploy --patch > /dev/null 2>&1)'
alias a='rlwrap php artisan'
alias tinker='rlwrap php artisan tinker'
alias migrate='rlwrap php artisan migrate'
alias db='mysql -h127.0.0.1 -uroot -psecret'
alias phpunit="vendor/bin/phpunit"
alias c="composer"
alias cu="composer update"
alias cr="composer require"
alias ci="composer install"
alias cda="composer dump-autoload"
alias gw="gulp watch"
alias update="git pull origin HEAD && composer update && yarn upgrade"
alias clearexif='for i in *; do echo "Processing $i"; exiftool -overwrite_original -all= "$i"; done'
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
# Commit everything
function commit() {
commitMessage="$1"
if [ "$commitMessage" = "" ]; then
commitMessage="commit"
fi
git add .
eval "git commit -a -m '${commitMessage}'"
}
# commit, push & deploy
function cpd() {
if [ "$1" = "" ]; then
echo "Commit message is required"
return
fi
commit "$1"
pd
}
function bg() {
nohup "$@" &>/dev/null &
}
function open() {
explorer.exe .
}
# Scrape a single webpage with all assets
function scrapePageWithAssets() {
wget --adjust-extension --convert-links --page-requisites --span-hosts --no-host-directories "$1"
}
# Request using GET, POST, etc. method
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
alias "$method"="lwp-request -m '$method'"
done
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias ipl="ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'"
alias week="date +%V"
export DISPLAY=:0
# Autocorrect typos in path names when using `cd`
shopt -s cdspell
transfer() {
# write to output to tmpfile because of progress bar
tmpfile=$( mktemp -t transferXXX )
curl --progress-bar --upload-file $1 https://transfer.sh/$(basename $1) >> $tmpfile;
cat $tmpfile;
rm -f $tmpfile;
}
resetdb() {
if [ $# -eq 0 ]
then
echo "No DB supplied"
return
fi
mysql -h127.0.0.1 --user="root" --password="secret" --execute="DROP DATABASE $1; CREATE DATABASE $1;"
}
towerlink() {
rm -rf vendor/enflow/tower vendor/enflow/tower-shop
ln -s /home/michel/code/enflow/tower vendor/enflow/tower
ln -s /home/michel/code/enflow/tower-shop vendor/enflow/tower-shop
}
link() {
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "1 argument required, $# provided"
rm -rf "vendor/enflow/$1" "node_modules/$1"
ln -s "/home/michel/code/enflow/$1" "vendor/enflow/$1"
ln -s "/home/michel/code/vendor/$1" "node_modules/$1"
}
flavorlink() {
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "1 argument required, $# provided"
rm -rf "vendor/enflow-flavors/$1"
ln -s "/home/michel/code/enflow/flavors/$1" "vendor/enflow-flavors/$1"
}
restart() {
sudo mkdir -p /var/run/php
sudo service nginx restart
sudo service php8.1-fpm restart
sudo mkdir /var/run/mysqld && sudo chown mysql:mysql /var/run/mysqld
sudo service mysql start
sudo service redis-server start
sudo service memcached start
}
function dusk() {
pids=$(pidof /usr/bin/Xvfb)
if [ ! -n "$pids" ]; then
Xvfb :0 -screen 0 1280x960x24 &
fi
php artisan dusk "$@"
}
gulp() {
if [ -f "webpack.mix.js" ]; then
command npm run watch
else
command gulp "$@"
fi
}
# starting in the right directory
cd ~/code/enflow