-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.general_aliases
185 lines (164 loc) · 5.19 KB
/
.general_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
#####################
# ALIASES #
######################
#---------------------
# BASH #
#---------------------
alias profile="${EDITOR} ~/.zshrc"
alias src='source ~/.zshrc'
alias fdir='find . -type d -name' # Attempt to find direcotory
alias ffil='find . -type f -name' # Attempt to find file
alias parrot='curl -s parrot.live'
alias mkdir='mkdir -p -v' # Make dirs recursively
alias mktar='tar -cvf' # Turn into tar
alias mkgz='tar -cvzf' # Turn into tar.gz
alias untar='tar -xvf' # Untar
alias ungz='tar -xvzf' # Untar.gz
alias grep='grep --color=auto' # Colorful grep
alias ipinfo='echo "Internal info"; ifconfig; echo "\nExternal info:"; curl ifconfig.me/all' # Get ip information
alias cd='>/dev/null cd' # Don't show path it changed to if CDPATH is used
alias sshkey="clipboard < ~/.ssh/id_rsa.pub && echo 'Copied to clipboard.'" # Copy ssh key to clipboard
alias back="popd" # Jump back to the previous directory
#---------------------
# GIT #
#---------------------
alias gs='git status'
alias ga='git add'
alias gc='git commit -m'
alias gp='git push'
alias gb='git branch'
alias gco='git checkout'
alias nbr='git checkout -b'
alias chbr='git checkout'
alias gpp='git pull upstream `git rev-parse --abbrev-ref HEAD` --recurse-submodules; git push origin `git rev-parse --abbrev-ref HEAD` &' # Pull current branch from upstream and push to origin
alias commitmsg='print $(curl -s whatthecommit.com/index.txt)'
alias pup='phpunit && git push'
# Change to the specified branch and reset it to upstream
function resetToUpstream() {
if [ "$1" = "" ]; then
branch=$(git rev-parse --abbrev-ref HEAD)
else
branch=$1
fi
git checkout $branch
git fetch upstream $branch
git reset --hard upstream/$branch
}
# Use git flow to finish the release
function release() {
current_release=$(git flow release list | head -1 | cut -d ' ' -f 2)
ORIGINAL_ORIGIN=$(git config --get gitflow.origin || echo origin)
git config gitflow.origin upstream
git flow release finish $current_release -F -p -m"${current_release}"
git checkout master
git push upstream master --tags
git checkout develop
git push upstream develop
git push upstream :release/$current_release
git config gitflow.origin $ORIGINAL_ORIGIN
}
#---------------------
# COMPOSER #
#---------------------
alias ci='composer install'
alias cr='composer require'
alias grum='grumphp git:pre-commit'
# Update packages filtered
cuf() {
jq -r '.require | keys[]' composer.json | grep "$1" | tr '\n' ' ' | xargs composer update
}
#---------------------
# YARN #
#---------------------
alias yi='yarn'
alias ya='yarn add'
alias yr='yarn remove'
alias yrd='yarn run dev'
alias yrw='yarn run watch'
#---------------------
# NPM #
#---------------------
alias ni='npm install'
alias nr='npm remove'
alias nrd='npm run dev'
alias nrw='npm run watch'
#---------------------
# LARAVEL #
#---------------------
alias pa='php artisan'
alias pas='php artisan serve'
alias pam='php artisan migrate'
alias pams='php artisan migrate --seed'
#---------------------
# MAGENTO #
#---------------------
alias m='php bin/magento'
alias msu='php bin/magento setup:upgrade && php bin/magento cache:disable full_page layout block_html'
alias mcc='php bin/magento cache:clean'
alias mcf='php bin/magento cache:flush'
alias mca='php bin/magento cache:clean && php bin/magento cache:flush'
alias cleanup2='rm -rf generated/code var/cache var/view_preprocessed pub/static; php bin/magento cache:flush'
alias mir='php bin/magento indexer:reindex'
alias msetup='(composer install --ignore-platform-reqs && php bin/magento setup:upgrade)'
#---------------------
# GENERAL #
#---------------------
# Import db with warden
function wimport() {
if [[ ! -f "$1" ]]; then
echo "file does not exist"
return 0
fi
if [[ $1 == *.sql.gz ]]; then
pv $1 | gunzip -c | warden db import
elif [[ $1 == *.sql ]]; then
pv $1 | warden db import
else
echo "No recognised file extension."
return 0
fi
}
# Open database with default application
db() {
open mysql://127.0.0.1/$1
}
# Get dns info
function digga() {
dig +nocmd "$1" any +multiline +noall +answer
}
# Download all assets for page
function scrapeUrl() {
wget --adjust-extension --convert-links --page-requisites --span-hosts --no-host-directories "$1"
}
# Interact with clipboard, piping into or out of clipboard
# Example, base64 encode clipboard content: `clipboard | base64 | clipboard`
function clipboard() {
[ ! -t 0 ] && clipcopy || clippaste
}
function diffclip() {
diff -ubB "$@" <(clipboard)
}
function clipdiff() {
diff -ubB <(clipboard) "$@"
}
# Manual for command
rtfm() {
help $@ ||
info $@ ||
man $@ ||
open "http://www.google.com/search?q=$@"
}
# Pull up cheat sheet for command
function cheat {
curl -s cheat.sh/$1 | less
}
function fixDist() {
COMPOSER_MEMORY_LIMIT=-1 composer remove $1; COMPOSER_MEMORY_LIMIT=-1 composer require $1:$2
}
# Clear some application caches and temporary files
cleanmachine() {
rm -rf ~/.codeintel &;
composer cc &;
npm cache clean --force &;
yarn cache clean &;
}