Git Statistics

工具 hercules go,维护良好,较为复杂,可以尝试 https://github.com/src-d/hercules gitinspector Python 但是最后一次维护是Oct 19, 2020,不能在py3下运行,可以尝试 https://github.com/ejwa/gitinspector git-stats 合并程序是二进制,输出是js,不好改造 https://github.com/IonicaBizau/git-stats git-quick-stats written by shell(不太好改造),持续有维护,可以尝试 https://github.com/arzzen/git-quick-stats#macos-homebrew brew install git-quick-stats You can use the Docker image provided: Build: docker build -t arzzen/git-quick-stats . Run interactive menu: docker run --rm -it -v $(pwd):/git arzzen/git-quick-stats Docker pull command: docker pull arzzen/git-quick-stats docker repository docker run --rm -it -e _GIT_SINCE="2017-01-20" -v $(pwd):/git arzzen/git-quick-stats -j 统计 代码量 不鼓励卷这个绩效,需要自取 #!/bin/bash # README # 1. 找一个目录git clone $repos 中定义的目录 # 2. 查看各个仓库自己提交过的作者名 # 3. branches 规则 ${repo}_branches,合并过的分支请选择最新的即可,反着会重复统计 repos=("python" "php" "go") authors=("peter" "pe") start_date="2024-01-01" end_date="2024-03-31" python_branches=("dev" "master") php_branches=("dev", "master") go_branches=("master" "dev") # 目前是按格式匹配,根据需要调整 include="-- \"*.py\" \"*.go\" \"*.php\" \"*.sh\"" # 默认排除了 go 的 vendor 目录,其他根据需要调整 exclude="':(exclude)vendor/'" # print csv header echo "Repo,Author,Branch,Files Changed,Lines Inserted,Lines Deleted" > stats.csv function count_changes { author=$1 branch=$2 repo=$3 git checkout $branch && git pull --ff git_log_commit="git log --pretty=oneline --shortstat --since=\"$start_date\" --until=\"$end_date\" --author=\"$author\" $include $exclude $branch" echo "excuting: $git_log_commit" stats=$(eval "$git_log_commit" | grep -E 'files? changed' | awk -v author=$author '{files+=$1; inserted+=$4; deleted+=$6} END {print files, ", ", inserted, ", ", deleted}') # print csv data row echo "$repo, $author, $branch, $stats" >> ../stats.csv } for repo in "${repos[@]}"; do echo $repo pushd $repo branch_var="${repo}_branches[@]" for branch in "${!branch_var}"; do echo $branch for author in "${authors[@]}"; do count_changes "$author" "$branch" "$repo" done done popd && pwd done

January 4, 2023 · 2 min · Peter

rsyslog

man page https://man7.org/linux/man-pages/man3/syslog.3.html install yum install rsyslog systemctl start rsyslog systemctl enable rsyslog systemctl status rsyslog config server # for udp #module(load=”imudp”) #input(type=”imudp” port=”514") # for tcp #module(load=”imtcp”) #input(type=”imtcp” port=”514") facility: the type of process sending logs, can be kernel, cron, daemon, etc. priority: the security level or type of log, emerg (0), alert (1), crit (2), err-(3), warn (4), notice (5), info (6), debug (7). destination: location to save log messages, local file host (/var/log directory), or remote syslog server identified by @ IP:port. e.g. server with udp opened, for local7.* facility msg: ...

January 4, 2023 · 1 min · Peter

i18n

msgfmt -c zh_HK.po -o zh_HK.mo

December 29, 2022 · 1 min · Peter

OCR

brew install tesseract pngpaste brew install tesseract-lang # 语言支持 ctrl + shift + command + 4 截图 pngpaste - | tesseract -l chi_sim stdin stdout 加入zsh alias,.zshrc alias ocr='pngpaste - | tesseract -l chi_sim stdin stdout'

December 29, 2022 · 1 min · Peter

Compile

compile # python -m compileall [*.py ...] python -m compileall . decompile python3.7 or newer decompyle3 pip install decompyle3 decompyle3 XX.pyc > xx.py before python3.7 pip install uncompyle6 uncompyle6 *compiled-python-file-pyc-or-pyo*

October 14, 2022 · 1 min · Peter