-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases.sh
166 lines (145 loc) · 5.24 KB
/
aliases.sh
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
export WINDOWS_HOME='/mnt/c/Users/Christhopher Leao'
export WINDOWS='/mnt/c/Users/Christhopher Leao'
export W='/mnt/c/Users/Christhopher Leao'
help() {
echo "OpenSSL is known to fail on macOS. Case that happens, run gem update with the following arguments:"
echo "gem update --user -- --with-openssl-dir=/usr/local/Cellar/[email protected]/1.1.1s"
echo ""
echo "cloneSub <git-repo> <folder-name> -> clones repositories with submodules"
echo "update-sub -> updates child submodules"
echo "find . -name '*.js' -type f -delete -> find and deletes files recursively"
echo "prune SOME_FILE -> find and deletes files recursively"
echo "git rm -r --cached . -> removes git cache (ignorant files)"
echo "'CMD + Shift + .' -> toggle hidden folders on Mac"
echo ""
echo "NVM:"
echo "nvmInstall arg1(version) -> install a specific node version"
echo "noderange arg1(version) -> new node version, but uninstalling current"
echo "nodeup -> upgrade to latest node"
echo ""
echo "kraken-update -> update gitkraken on debian-based OS (wsl)"
}
nvmInstall(){
nvm install $1 --latest-npm --reinstall-packages-from=node
}
noderange() {
local previous=$(nvm current)
nvm install $1 --latest-npm --reinstall-packages-from=current
nvm uninstall $previous
nvm cache clear
}
nodeup() {
local nodeVersion=$(nvm current)
nvm install node --latest-npm --reinstall-packages-from=node
# OR --reinstall-packages-from=$nodeVersion
# OR --reinstall-packages-from=current
nvm alias default node
nvm uninstall $nodeVersion
nvm cache clear
linkshell
}
alias nodeUp=nodeup
cloneSub() {
local MAIN=$(git symbolic-ref --short HEAD)
git clone --recursive $1 $2
cd $2
git submodule foreach --recursive "git checkout $MAIN"
}
kraken-update() {
wget https://release.gitkraken.com/linux/gitkraken-amd64.deb
sudo chown -Rv _apt:root ./gitkraken-amd64.deb
sudo chmod -Rv 700 ./gitkraken-amd64.deb
sudo apt install ./gitkraken-amd64.deb
rm ./gitkraken-amd64.deb
}
if [[ "`uname`" == "Darwin"* ]]; then
update() {
# get updates
mas upgrade
brew update &
# gem update --user &
npm upgrade --location=global &
wait
brew upgrade &
wait
brew upgrade --cask &
wait
fg
# cleanups
# gem cleanup --user &
brew cleanup &
npm cache verify &
wait
npm outdated --location=global
softwareupdate --download --all
# flags --download
}
# Sketch hack.. (MONTH|DAY|HH|MIN|YY)
alias sketch="sudo date 0228111120 && open /Applications/Sketch.app && sudo sntp -sS time.euro.apple.com"
# source $HOME/shellscripts/iterm_shell_integration.zsh
elif [[ "$(source /etc/os-release && echo $NAME)" == "Arch"* ]]; then
alias update="sudo pacman -Syu && yay -Syu --aur --noconfirm && npm upgrade --location=global && npm cache verify && npm outdated --location=global"
elif [[ "$(source /etc/os-release && echo $NAME)" == "Ubuntu" ]]; then
alias update="sudo apt update && sudo apt-get full-upgrade -y && sudo apt autoremove -y && npm upgrade --location=global && npm cache verify && npm outdated --location=global"
fi
alias upgrade="update"
alias zshrc="code $LION_SHELL/zshconfig.sh"
j15() { export JAVA_HOME=`/usr/libexec/java_home -v 15`; java -version }
j8() { export JAVA_HOME=`/usr/libexec/java_home -v 1.8`; java -version }
# Ultility to code remote stuff on editor by tunneling
alias alia="ssh -R 52698:localhost:52698 api.alia.ml"
# Docker utils
alias stop="docker-compose kill"
alias restart="docker-compose restart"
alias containers="ctop -s mem"
alias log="docker-compose logs -f --tail 20"
alias logtail="docker-compose logs -f --tail 100"
alias build="docker-compose pull && docker-compose build --pull"
alias up="docker-compose up -d"
alias docker-start="sudo systemctl start docker"
alias docker-on="sudo systemctl start docker"
alias docker-stop="sudo systemctl stop docker"
alias docker-off="sudo systemctl stop docker"
# DEV
alias peers="npx install-peerdeps"
dedupe() {
yarn-deduplicate --strategy=highest yarn.lock
yarn
}
publish() {
local defaultTag='next'
yarn publish --prerelease --tag ${defaultTag:-$1}
}
# SERVER
alias nginx-restart="sudo service nginx restart"
alias nginx-test="sudo nginx -c $HOME/nginx/nginx.conf -t"
alias addssl="sudo certbot --nginx"
if [[ -n $SSH_CONNECTION ]]; then
alias code="rmate"
fi
rebuild() {
docker-compose pull $1
docker-compose build $1 --pull
}
alias update-sub="git submodule update --init --recursive"
alias crlf="find ./ ! -path \"./node_modules/*\" -type f -exec dos2unix {} \;"
# Deletes a file recursively
prune() {
find . -name $1 -exec rm -rf {} \;
}
shellSecrets() {
curl -H "Authorization: token $GIT_TOKEN" -H 'Accept: application/vnd.github.v4.raw' -fsSL https://api.github.com/repos/itsmelion/keychain/contents/shell.sh > $HOME/.secrets.sh
}
# AZURE KEYVAULT
get-env() {
if ! hash jq 2>/dev/null
then
az keyvault secret show --vault-name hwbg-webhosting-keyvault --name $1
else
az keyvault secret show --vault-name hwbg-webhosting-keyvault --name $1 | jq -r '.value'
fi
}
set-env() {
az keyvault secret set --vault-name hwbg-webhosting-keyvault --name $1 --file $2
}
# AZURE KEYVAULT