Useful Scripts Versions Save

🐌 useful scripts for making developer's everyday life easier and happier, involved java, shell etc.

v2.4.0

3 years ago

New Features

  1. add cp-into-docker-run 🗂

Improvements

  • show-duplicate-java-classes: ☕️
    • improve jar in jar index marker
    • improve sort logic in print_duplicate_classes_info

Have Fun! 💕
2021-4-26

v2.3.1

3 years ago

New Features

  1. add version option for scripts #73 🎱
  2. show-duplicate-java-classes:
    • show duplicate class paths total count 🔢
    • output class path index

Improvements

  • show-duplicate-java-classes:
    • improve output sort 📶
      • sort by multiple keys:
        1. class paths count, descending
        2. duplicate classes count, descending
        3. class paths, ascending
      • sort also ensure output consistent for same input.
  • find-in-jars:
    • performance improvement, use grep -c option reduce internal output
  • show-busy-java-threads:
    • rename i to update_round_num
  • improve help and docs 📚
  • code refactor/cleanup

Have Fun! 💕
2021-4-5

v2.3.0

3 years ago

New Features

  1. show-busy-java-threads:
    • add "No java process found" check, output in error message 📭
    • add update_delay/update_count/pid_list option value validation
  2. show-duplicate-java-classes:
    • show duplicate classes total count 🔢
    • output responsive progress info at console 🛎
    • add option -R, --no-find-progress, do not display responsive find progress 🔇
    • validate lib/class dir
  3. find-in-jars:
    • add -L, --files-not-contained-found and -l, --files-contained-found options
    • add option -R, --no-find-progress, do not display responsive find progress 🔇
  4. uq:
    • add max input defensive check option -XM, --max-input

BugFix

  • show-busy-java-threads: fix top extract error by process name 👓
    • COMMAND column of top -H output can be thread name not process name
    • top 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
      ...
      

Improvements

  • show-busy-java-threads:
    • improve self rerun command line in output
  • show-duplicate-java-classes:
    • refactor: split function build_index__class_to_class_paths to 2 small functions:
      • collect_class_path_to_classes
      • invert_as_class_to_class_paths
  • find-in-jars:
    • improve responsive output, output jars searching message 👓
    • extract searchJarFiles function
  • fix Bash Traps and Pitfalls:
    • DO NOT combine var declaration and assignment which value supplied by sub-shell!
  • improve help and docs
  • code refactor/cleanup

Have Fun! 💕
2021-4-1

v2.2.0

3 years ago

New Features

  1. show-duplicate-java-classes:
    • support find jar files in lib sub-dir and jar file recursively(add -L/-J option) 🌀
    • skip java 9 module-info files 📦
    • ignore BadZipFile for jar files 🙅‍♀️

Improvements

  • uq: make it standalone 🧩
  • find-in-jars: improve output, display responsive message on stderr
  • c: fix absence of redEcho function
  • echo-args: change output color
  • improve output format, more human readable 👓
    • show-duplicate-java-classes
    • tcp-connection-state-counter
  • add MacOS and multiply linux distributions in travis-ci 👨‍🚒
  • fix typo in document: buildin -> builtin

Have Fun! 💕
2021-3-25

v2.1.0

3 years ago

New Features

  1. add new script uq 🦄 https://github.com/oldratlee/useful-scripts/blob/dev-2.x/docs/shell.md#-uq
  2. show-busy-java-threads:
    • support: set count 0 to show all threads

Improvements

  • bash strict mode ⛑
    • use set -eEuo pipefail
    • use $* instead of $@ in string
    • use if-else instead of &&/||
    • use $() instead of ``
  • add travis-ci 👨‍🚒
  • add/use shUnit2 lib for Unit Test #39 ☂️
  • improve multiply var declaration/read
    • read multiply var instead array
    • simplify the multiply local var deceleration

Code Cleanup

  • add .gitignore/.editorconfig

Have Fun! 💕
2021-2-28

v2.0.0

4 years ago

Normalized directory structure, New beginning!

  • normalize directory structure: bin, lib, doc, etc #87 🆕✨💖

Have Fun! 💕 2019-12-02

v1.5.2

5 years ago

Code Cleanup

  1. improve help message: one line contains less 80 chars 🎶
    • show-busy-java-threads
    • find-in-jars
  2. improve docs 📚
  3. fix typo: seperator -> separator 🤡
    • show-busy-java-threads
    • find-in-jars

Have Fun! 💕 2019-06-01

v1.5.1

5 years ago

Improvements

  1. show-busy-java-threads:
    • check before write file ✍️
  2. find-in-jars:
    • check dirs
  3. coat & a2l
    • reorder color, avoid first line is red

Code Cleanup

  1. show-busy-java-threads:
    • extract util functions: logAndRun, logAndCat
    • use satisfy condition or die pattern
    • use printf instead of print in awk script.
    • use pipe instead <(), improve readability. 😋
    • reorder/extract functions/variables.
  2. find-in-jars:
    • use arithmetic operation
    • use satisfy condition or die pattern
    • use pipe instead <(), improve readability.
  3. documentation:
    • compress png files 🐾
    • improve docs of coat, find-in-jars
    • improve format of markdown

Have Fun! 💕
2019-01-28

v1.5.0

5 years ago

New Features

  1. show-busy-java-threads:
    • store all intermediate output for review/debug #74 🍭
    • support command name jsvc to find java process #72 🌀

Bug Fix

  1. show-busy-java-threads:
    • fix bug for top v3.2 #71 🎩

Improvements

  1. show-busy-java-threads:
    • check append file of -a option #70 ☔
    • ensure output blank line between thread stacks #68
  2. find-in-jars:
    • reecho wc -l, ensure no extra whitespace for jar file total count.

Code Cleanup

  1. show-busy-java-threads:
    • use printf instead of print in awk script.
    • use pipe instead <(), improve readability. 😋
    • reorder/extract functions/variables.
  2. find-in-jars:
    • use pipe instead <(), improve readability.

Have Fun! 💕
2018-6-17

v1.4.0

6 years ago

New Features

  1. show-busy-java-threads:
    • use top command to get percent of thread cpu usage 🎩 🎉 you can use -P, --use-ps option so as to use ps command to find busy thead(cpu usage) instead of top command.
    • support -S, --jstack-file-dir option to specify the dir for storing jstack output files, and keep files. 🛐
      default store jstack output files at tmp dir, and auto remove after run.
      use this option to keep files so as to review jstack output later.
    • support -d, --top-delay option to specifies the delay between top samples. 😋
      get thread cpu percentage during this delay interval.
  2. xpf/xpl:
    • support mac, parse option by hand instead of getopt #66 🍡

Bug Fix

  1. show-busy-java-threads:
    • should re-jstack when next update
    • option parse fail should exit

Improvements

  • show-busy-java-threads:
    • improve show-busy-java-threads help format 📚
    • improve output color 🌈
    • improve docs

Code Cleanup

  • show-busy-java-threads:
    • main function style 💅
    • reorder functions
    • use ARITHMETIC EVALUATION explicitly instead of -gt etc 🔢

Have Fun! 💕
2018-5-22