๐ useful scripts for making developer's everyday life easier and happier, involved java, shell etc.
APACHE-2.0 License
Bot releases are hidden (Show)
Published by oldratlee 6 months ago
[!IMPORTANT]
This is a WIP/cleanup release for upgrading version to3.x
legacy bin
๐ฎtest-cases
to test
๐It's time to say goodbye, my friend
It's been a long day without you my friend
And I'll tell you all about it when I see you again
We've come a long way from where we began
Oh I'll tell you all about it when I see you again
Have Fun! ๐
2024-04-15
Published by oldratlee 6 months ago
c
]: ensure use command on path, and check the command existence on PATH ๐ฃcoat/taoc
]: add --help/--version
options ๐ฉfind-in-jars
]: add IFS=
for read
, more robust ๐ช
show-busy-java-threads
]:
timestamp
var to avoid inconsistency โ๏ธ${var##}
instead of basename
๐๏ธ
realpath
instead of function portableReadLink
๐
show-busy-java-threads
]: rename global var USER
-> WHOAMI
๐คuq
]: use exponential operation instead of multiplication to calculate size ๐งฎc
]: rename functions ๐กtype -P
instead of which
command ๐UNAME
var ๐ Shell Arithmetic
comparison instead of Conditional Expressions
๐ข||/&&
instead of one branch/one line if
๐ฐ1
in redirections โก๏ธusage
function simple-s
/-h
option for optional argument of die
functiontype -P
instead of which
command ๐COLOR_INDEX
instead of COUNT
colorPrint
function if only one callerlocal nl=$'\n'
declaration if only one usage{}
when use var=
instead of ==
in Conditional Expressions
shellcheck
item doc link instead of prolixity comments โจdependabot.yml
๐คshunit2
libHave Fun! ๐
2024-04-12
Published by oldratlee 8 months ago
show-busy-java-threads
] support Java21
๐ โ๏ธ
Java21
, because Java21
changed the format of stack title line (issue #120 submmited by @jianyun)show-busy-java-threads
] improve separator blank line output format ๐
Have Fun! ๐
2024-02-18
Published by oldratlee 9 months ago
coat/taoc
: missing last line if thereโs no newline at the end of the file ๐ ๐/usr/bin/env
in shebang (by @hyperupcall in #119) ๐xpl
: missing error exit code when file not existed or open file failure โ๏ธcoat/taoc
: ๐
cat
colorLines
functionawl
: merge function colorPrint
into rotateColorPrint
๐ ๏ธprintf format
if possiblemessage
-> content
, normal
-> color_reset
\e
instead of \033
-t
check{}
when use varshunit2
libHave Fun! ๐
2024-01-25
Published by oldratlee 11 months ago
c
: wrong exit code with -q
option ๐${array[@]:-}
/${array[@]:+}
to simplify codes ๐/dev/std*
(#114 by @wushengde)bump-scripts-version.sh
:
printf
instead of echo
console-text-color-themes.sh
:
BASH_SOURCE
array to detect whether this script is sourced or not ๐ต๏ธprintf
๐ช instead of echo
if
instead of &&
bash
๐Have Fun! ๐
2023-12-05
Published by oldratlee about 1 year ago
taoc
๐ซด ๐echo-args
: align the index numberc
, improve readable: ๐
teeAndCopy
functionprintf
instead of echo
if-else
instead of &&-||
c
/coat
/a2l
/echo-args
/ap
/rp
/xpl
/xpf
/uq
cp-into-docker-run
/tcp-connection-state-counter
/console-text-color-themes.sh
find-in-jars
/show-busy-java-threads
shellcheck
issuesci.yaml
, test on latest MacOS
๐shunit2
libHave Fun! ๐
2023-09-06
Published by oldratlee almost 2 years ago
show-duplicate-java-classes
: print info message and exit when search no jar files or find no class files โน๏ธcoat/a2l
: skip color for white space lines ๐readonly
if possible ๐
$*
in string instead of $@
๐.editorconfig
$()
instead of ``
ci.yaml
(remove travis
) ๐ทโโ๏ธMacOS CI
๐Have Fun! ๐
2022-12-24
Published by oldratlee about 3 years ago
show-duplicate-java-classes
:
CPU
percentage order under ps
from procps-ng 3.3.12
๐ข--cpu-sample-interval
instead of --top-delay
/--use-ps
โณHave Fun! ๐
2021-7-21
Published by oldratlee over 3 years ago
show-duplicate-java-classes
:
cp-into-docker-run
:
-c/--container
๐Have Fun! ๐
2021-5-16
Published by oldratlee over 3 years ago
show-busy-java-threads
: ๐ต๏ธโโ๏ธ
jstack
command search order, JAVA_HOME
before PATH
find-in-jars
:
cp-into-docker-run/ap/xpf
: use portableReadLink
๐xpl
: fix unbound variable args[@]
โพHave Fun! ๐
2021-4-30
Published by oldratlee over 3 years ago
cp-into-docker-run
๐show-duplicate-java-classes
: โ๏ธ
print_duplicate_classes_info
Have Fun! ๐
2021-4-26
Published by oldratlee over 3 years ago
show-duplicate-java-classes
:
show-duplicate-java-classes
:
find-in-jars
:
grep -c
option reduce internal outputshow-busy-java-threads
:
i
to update_round_num
Have Fun! ๐
2021-4-5
Published by oldratlee over 3 years ago
show-busy-java-threads
:
update_delay/update_count/pid_list
option value validationshow-duplicate-java-classes
:
-R, --no-find-progress
, do not display responsive find progress ๐find-in-jars
:
-L, --files-not-contained-found
and -l, --files-contained-found
options-R, --no-find-progress
, do not display responsive find progress ๐uq
:
-XM, --max-input
โshow-busy-java-threads
: fix top
extract error by process name ๐
COMMAND
column of top -H
output can be thread name not process nametop
output sample and env info:
$ uname -a
Linux 33e449b39f66 4.19.121-linuxkit #1 SMP Thu Jan 21 15:36:34 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)
$ top -v
ย procps-ng 3.3.12
Usage:
ย top -hv | -bcHiOSs -d secs -n max -u|U user -p pid(s) -o field -w [cols]
$ top -H
ย PID USERย ย ย ย ย PRย NIย ย ย VIRTย ย ย RESย ย ย SHR S %CPU %MEMย ย ย ย TIME+ COMMAND
7012 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.00 java
7014 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.62 GC Thread#0
7015 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.00 G1 Main Marker
7017 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.00 G1 Refine#0
7018 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.06 G1 Young RemSet
7019 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.67 VM Thread
7020 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.00 Reference Handl
7021 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.00 Finalizer
7022 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.00 Signal Dispatch
7023 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.34 C2 CompilerThre
7024 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.03 C1 CompilerThre
7025 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.00 Sweeper thread
7026 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.00 Service Thread
7027 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.26 VM Periodic Tas
7032 jerryย ย ย ย 20ย ย 0 3492604ย 79492ย 27096 Sย 0.0ย 3.9ย ย 0:00.52 GC Thread#1
...
show-busy-java-threads
:
show-duplicate-java-classes
:
build_index__class_to_class_paths
to 2 small functions:
collect_class_path_to_classes
invert_as_class_to_class_paths
find-in-jars
:
searchJarFiles
functionBash
Traps and Pitfalls:
Have Fun! ๐
2021-4-1
Published by oldratlee over 3 years ago
show-duplicate-java-classes
:
-L
/-J
option) ๐java
9 module-info
files ๐ฆBadZipFile
for jar files ๐
โโ๏ธuq
: make it standalone ๐งฉfind-in-jars
: improve output, display responsive message on stderrc
: fix absence of redEcho functionecho-args
: change output colorshow-duplicate-java-classes
tcp-connection-state-counter
MacOS
and multiply linux
distributions in travis-ci ๐จโ๐Have Fun! ๐
2021-3-25
Published by oldratlee over 3 years ago
uq
๐ฆshow-busy-java-threads
:
set -eEuo pipefail
$*
instead of $@
in stringif-else
instead of &&
/||
$()
instead of ``
shUnit2
lib for Unit Test #39 โ๏ธ.gitignore
/.editorconfig
Have Fun! ๐
2021-2-28
Published by oldratlee almost 5 years ago
Have Fun! ๐
2019-12-02
Published by oldratlee over 5 years ago
show-busy-java-threads
find-in-jars
show-busy-java-threads
find-in-jars
Have Fun! ๐
2019-06-01
Published by oldratlee over 5 years ago
show-busy-java-threads
:
find-in-jars
:
coat
& a2l
show-busy-java-threads
:
logAndRun
, logAndCat
satisfy condition or die
pattern<()
, improve readability. ๐find-in-jars
:
satisfy condition or die
pattern<()
, improve readability.Have Fun! ๐
2019-01-28
Published by oldratlee over 6 years ago
show-busy-java-threads
:
jsvc
to find java process #72 ๐show-busy-java-threads
:
show-busy-java-threads
:
-a
option #70 โfind-in-jars
:
wc -l
, ensure no extra whitespace for jar file total count.show-busy-java-threads
:
<()
, improve readability. ๐find-in-jars
:
<()
, improve readability.Have Fun! ๐
2018-6-17
Published by oldratlee over 6 years ago
show-busy-java-threads
:
top
command to get percent of thread cpu usage ๐ฉ ๐-P, --use-ps
option so as to use ps command to find busy thead(cpu usage) instead of top command.-S, --jstack-file-dir
option to specify the dir for storing jstack output files, and keep files. ๐-d, --top-delay
option to specifies the delay between top samples. ๐xpf/xpl
:
getopt
#66 ๐กshow-busy-java-threads
:
show-busy-java-threads
:
show-busy-java-threads
:
ARITHMETIC EVALUATION
explicitly instead of -gt
etc ๐ขHave Fun! ๐
2018-5-22