mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 13:23:15 +02:00
Resource-usage report showed ~29 cores of average load coming from i3blocks helper scripts forking awk/tr/grep/bc/sensors/nvidia-smi every tick. Rewrite all five hot-path scripts to eliminate forks: - volume.sh: persist mode, blocks on 'pactl subscribe' event stream. No polling, no sleep, no fork per tick. - gpu_monitor.sh: persist mode, single long-lived 'nvidia-smi --loop=5' feeds a bash 'while read' loop. Falls back to /sys for amdgpu. - battery_status.sh: reads /sys/class/power_supply/BAT*/ directly. Zero forks; replaces 'acpi | awk' pipeline. - cpu_monitor.sh: reads /proc/loadavg and k10temp/coretemp /sys/class/hwmon. Zero forks; replaces 'sensors | awk | tr' + bc arithmetic. - motherboard_temp.sh: reads nct*/it*/f71* Super-I/O hwmon node directly. Zero forks. Configure volume + gpu_monitor with interval=persist so i3blocks keeps one long-lived producer each instead of forking per tick. Also add: - kill_stale_recorders.sh -- kill stray ffmpeg x11grab / dotnet-trace / dotnet-monitor processes left running after sessions. - monitors.slice -- resource-capped user slice (CPUQuota=50%, MemoryMax=512M, MemorySwapMax=0 for zram safety, TasksMax=256) to bound future monitoring regressions. - efficient-polling-scripts SKILL -- rules for writing status-bar and polling scripts without forks; fork-pipeline to bash-builtin translation table; verification checklist. Verified live: strace -c on cpu_monitor.sh shows 1 execve / 0 clones; persist producers (pactl subscribe, nvidia-smi --loop) show 0 CPU ticks over a 3s idle sample. Per-invocation timing 1.6-1.9 ms (was 30-80 ms). |
||
|---|---|---|
| .github | ||
| .vscode | ||
| C | ||
| CPP | ||
| horatio | ||
| linux_configuration | ||
| phone_focus_mode | ||
| pomodoro_app | ||
| python_pkg | ||
| robotgo_demo | ||
| scripts | ||
| sonic_pi | ||
| TS | ||
| .binary-allowlist | ||
| .copilotignore | ||
| .fvmrc | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| eslint.config.mjs | ||
| lint_python.sh | ||
| out.json | ||
| package-lock.json | ||
| package.json | ||
| pyproject.toml | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| setup.sh | ||
testsAndMisc
A collection of personal projects, scripts, and experiments — from a GPS-based phone focus tool to C/C++ demos, with CI, linting, and pre-commit hooks across the board.
Highlights
Phone Focus Mode
Location-based app restriction for rooted Android. Automatically disables non-whitelisted apps within 500 m of home using ADB + Magisk. Features Haversine distance calculation, hysteresis to prevent toggling, fail-safe unlock, and state persistence. Bash, Android ADB.
Linux Configuration
Automated Arch Linux setup: fresh-install scripts, i3 window manager config, LaTeX environment, and system tests. Includes documentation and test result logging.
Scripts
Utility scripts for development workflows — C/C++ build file validation, secret detection, and custom makepkg helpers.
Other Projects
| Directory | Description |
|---|---|
poker_modifier_app/ |
Browser-based poker hand modifier (HTML/JS) |
pomodoro_app/ |
Pomodoro timer (Flutter) |
Bash/ |
FFmpeg build scripts |
C/, CPP/, TS/ |
Language-specific experiments |
sonic_pi/ |
Music programming experiments |
robotgo_demo/ |
Go desktop automation demo |
python_pkg/ |
Python package structure example |
Tooling
- Python linting: Ruff with all rules enabled (see
pyproject.toml) - JS/TS linting: ESLint (flat config)
- CI: GitHub Actions — lint, build, and test on push
- Testing: pytest (Python), custom shell-based test harness for scripts