-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaliases
More file actions
118 lines (108 loc) · 3.52 KB
/
aliases
File metadata and controls
118 lines (108 loc) · 3.52 KB
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
alias psg='ps -ef | grep -i'
alias hig='history | grep -i'
# Search Recursively in all files
alias greprec='grep -inR -A2 -B2'
# Prompt for bash
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u \t\[\033[01;34m\] \W \$\[\033[00m\] "
# History with timestamp
HISTTIMEFORMAT="%F %T => "
# npm/node PATH
source $NVM_DIR/nvm.sh
# pip3 utilities
PATH=$PATH:/home/vscode/.local/bin
##################################
# AWS
##################################
# CLI Auth
# https://github.com/benkehoe/aws-sso-util
awssso() {
SQUAD=${1:-stockbroking}
ACCOUNT=${2:-nonprod}
ROLE=${3:-product-breakglass}
aws-sso-util login --profile ${SQUAD}-${ACCOUNT}.${ROLE}
export AWS_PROFILE=${SQUAD}-${ACCOUNT}.${ROLE}
echo "Exported profile '${AWS_PROFILE}'"
echo "$0 ${SQUAD} ${ACCOUNT} ${ROLE}"
}
##################################
# init for first setup
##################################
awsssoconfigure() {
# This populates all the profiles you have access to in your .aws/credentials:
aws-sso-util configure populate --sso-start-url https://cmcmarkets-sso.awsapps.com/start --sso-region eu-west-1 --region ap-southeast-2
# List configured profiles
aws configure list-profiles
}
firsttimesetup() {
# The default npm setting adds dependencies with “^”, which means that runtime dependencies change over time from what is set in the package.json.
# To avoid this, lock the versions by default with this command:
npm config set save-prefix=''
npm config set save-exact=true
# pip
pip3 config set global.trusted-host "pypi.org files.pythonhosted.org pypi.python.org"
# This walks you through the steps to setup auth
gh auth login
}
##################################
# git / gh
##################################
# In case docker is not started automatically.
dockerstart() {
sudo service docker start
}
# Git add all, commit with first message, push, pull.
gitshort() {
git pull --tags && git add -A :/ && git commit -m "$1" && git pull && git push
}
gitshortpr() {
git pull --tags && git add -A :/ && git commit -m "$1" && git pull && git push
gh pr create --title "$1" --fill
}
gitshortprdraft() {
git pull --tags && git add -A :/ && git commit -m "$1" && git pull && git push
gh pr create --title "$1" --fill --draft
}
gitrelease() {
git release --semver patch
}
gitnewbranch() {
git checkout master && \
git pull --all --tags -f && \
git checkout -b $1 && \
git push --set-upstream origin $1 && \
git pull
}
gitmergemaster() {
git checkout master && \
git pull --all --tags -f && \
git switch - && \
git merge master -m 'merge from master'
}
gitmaster() {
git checkout master && \
git pull --all --tags -f
}
gitclean() {
git branch | grep -v "master" | grep -v "main" | xargs git branch -D
}
##############################################
# Typescript shortcuts
##############################################
find_npmci() {
find . -name package.json -not -path "*/node_modules/*" -not -path "*/cdk.out/*" -execdir pwd \; -execdir npm ci \; ;
}
find_npmauditfix() {
find . -name package.json -not -path "*/node_modules/*" -not -path "*/cdk.out/*" -execdir pwd \; -execdir npm audit fix \; ;
}
##############################################
# Terraform
##############################################
terraformlatest() {
tfenv use latest
}
terraformselectversioninstalled() {
tfenv list
}
terraformselectversion() {
tfenv list-remote
}