-
Notifications
You must be signed in to change notification settings - Fork 0
/
.alias
126 lines (112 loc) · 5.47 KB
/
.alias
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
# Aliases and shell functions for Hashgraph Mac laptops.
# Sometimes Mac decides to flash the heck out of the screen instead of beeping, regardless of setting.
# This fixes it.
alias fixVisualScream='sudo killall coreaudiod '
alias ls='ls '
alias ll='ls -l '
alias la='ls -la '
alias lart='ls -lart '
alias lars='ls -larS '
alias peekd='dirs '
alias clearh='clear;history -c;history -w '
alias largest='du -ms * | sort -n | tail '
alias findNodes='ps auxww | fgrep java | cut -w -f 2,3,4,9,10-12 '
alias showGitCleanTargets=' clear; git clean -dxn | egrep -v "build/|\.idea/|\.gradle/|hapi/checkouts\.bin|ExpectedMap.json.gz" '
alias findEmbeddedChrome='clear;ps -ev | fgrep "(Renderer)" | cut -c 1-180 | fgrep -v "fgrep" | less '
alias netserv='netstat -van -p tcp | fgrep LISTEN | cut -w -f 1,4,6,9 '
alias netlist='lsof -P -iTCP -sTCP:LISTEN '
alias sha384sum='shasum --UNIVERSAL -a 384 '
alias gitupdate='git fetch && git prune && git remote prune origin && git gc '
alias gitstat='date "+%Y-%m-%d"; git status '
alias gitreset='git checkout local-base && git fetch && git prune && git remote prune origin && git rebase origin/develop && git gc && git branch '
alias gitmainreset='git checkout local-base && git fetch && git prune && git remote prune origin && git rebase origin/main && git gc && git branch '
alias newclone='git checkout -b local-base && git branch -D develop && git prune && git gc && git branch '
# Gradle commands are a pain to type, add some shortcuts
export GRADLE='nice -n 20 gradle '
export GRADLE_UT_OPTS=' -Dtestlogger.showPassed=false -Dtestlogger.showSkipped=false -Dtestlogger.showPassedStandardStreams=false -Dtestlogger.theme=mocha-parallel '
export GRADLE_PARALLEL_OPTS='--parallel --max-workers=12' # Apple M1 Max has only 10 cores...
export GRADLE_CLEAN_OPTS='--no-daemon --no-build-cache --no-configuration-cache'
export GRADLE_COMPILE_OPTS="-Dsonar.gradle.skipCompile=true --warning-mode=summary ${GRADLE_PARALLEL_OPTS} ${GRADLE_CLEAN_OPTS}"
export GRADLE_TEST_OPTS="--no-daemon ${GRADLE_PARALLEL_OPTS} ${GRADLE_UT_OPTS}"
alias grdlProjects='${GRADLE} projects ${GRADLE_CLEAN_OPTS} '
alias grdlClean='${GRADLE} clean --warning-mode=summary ${GRADLE_PARALLEL_OPTS} ${GRADLE_CLEAN_OPTS} '
alias grdlTest='${GRADLE} assemble ${GRADLE_COMPILE_OPTS} && ${GRADLE} test ${GRADLE_TEST_OPTS} '
alias grdlHapi='${GRADLE} hapiTest -Dsonar.gradle.skipCompile=true ${GRADLE_TEST_OPTS} ${GRADLE_CLEAN_OPTS} '
alias grdlModules='${GRADLE} checkAllModuleInfo ${GRADLE_COMPILE_OPTS} '
alias grdlCompile='${GRADLE} assemble ${GRADLE_COMPILE_OPTS} '
alias grdlCleanCompile='${GRADLE} clean assemble ${GRADLE_COMPILE_OPTS} '
alias grdlCleanTest='grdlCleanCompile && ${GRADLE} test ${GRADLE_TEST_OPTS} '
alias grdlScanTest='grdlCleanCompile && ${GRADLE} test ${GRADLE_TEST_OPTS} ${GRADLE_CLEAN_OPTS} --scan '
alias grdlFastTest='${GRADLE} test --warning-mode=summary ${GRADLE_TEST_OPTS} '
alias grdlExtraCleanTest='grdlCleanCompile && grdlModules && ${GRADLE} test ${GRADLE_TEST_OPTS} ${GRADLE_CLEAN_OPTS} '
alias grdlSpotless='grdlCompile && ${GRADLE} ${GRADLE_PARALLEL_OPTS} ${GRADLE_CLEAN_OPTS} checkAllModuleInfo spotlessCheck --warning-mode=summary -Dsonar.gradle.skipCompile=true '
alias grdlReformat='${GRADLE} ${GRADLE_PARALLEL_OPTS} ${GRADLE_CLEAN_OPTS} spotlessApply --warning-mode=summary -Dsonar.gradle.skipCompile=true '
alias finalPRChecks='grdlReformat && grdlExtraCleanTest && ${GRADLE} build --warning-mode=summary ${GRADLE_TEST_OPTS} && grdlHapi '
alias pbjInt='${GRADLE} ${GRADLE_CLEAN_OPTS} clean :generatePbjSource :generateProto && ${GRADLE} ${GRADLE_CLEAN_OPTS} assemble test ${GRADLE_PARALLEL_OPTS} ${GRADLE_UT_OPTS} '
alias pbjCore='${GRADLE} ${GRADLE_CLEAN_OPTS} clean assemble test ${GRADLE_PARALLEL_OPTS} ${GRADLE_UT_OPTS} publishToMavenLocal '
alias pip='pip3 '
gitFixMerge()
{
echo ' '
echo 'Fixing Merge-vs-Rebase issues should always be done manually!'
echo 'replace "origin/develop" with the target rebase branch'
echo 'This set of commands will *ERASE* history;'
echo ' only use if you have no need to keep branch commit history.'
echo ' '
echo ' git checkout YOUR_BRANCH'
echo ' git reset $(git merge-base origin/develop $(git branch --show-current))'
echo ' git add ALL_YOUR_STUFF'
echo ' git commit -sS'
echo ' git push -f'
echo ' '
}
findRefs()
{
reference="${1:-UNSPECIFIED}"
filespec="${2:-java}"
folder="${3:-.}"
find "${folder}" -name "*.${filespec}" -and -not -path "*/generated/*" \
-and -not -path "*/.git/*" -and -not -path "*/.git" \
-and -not -path "*/.gradle" -and -not -path "*/.gradle/*" \
-and -not -path "*/.idea/*" -and -not -path "*/.idea" \
-and -not -path "*/build/*" -exec fgrep "${reference}" '{}' \+
}
countLines()
{
folder="${1:-.}"
filespec="${2:-*.java}"
wc -l <(find "${folder}" -name "${filespec}" -exec cat '{}' \+)
}
cleanupRepo() {
filesToRemove="$(git clean -dxn | egrep -v '\.gradle|.idea|ExpectedMap.json.gz' | sed -e 's^Would remove \(.*\)^\1^')"
echo removing
echo ${filesToRemove}
rm -rf ${filesToRemove}
}
AllRepoCleanup() {
pushd ~/Projects
for repo in $(find . -type d -depth 2)
do
if [[ -d ${repo}/.git ]]
then
pushd ${repo}
git stash
git checkout local-base
git fetch
git remote prune origin
git rebase origin/develop
git branch -a
popd
sleep 5
fi
done
popd
}
b64d() {
base64 -d <<<"$*"
echo
}
sha384check() {
input="$*"
shasum -a 384 --UNIVERSAL --check <<<"${input}"
}