Go to file
Krzysztof kuhy Rudnicki 59e863f2a5 feat: Add shell script quality enforcement and polling optimization guidelines
- Add pre-commit hook (check_polling_antipatterns.sh) to detect fork-storm anti-patterns
- Update .pre-commit-config.yaml with no-polling-antipatterns hook registration
- Add comprehensive documentation (6 guides, 1000+ lines total)

Detects and blocks:
  * while true + sleep patterns (suggests event-driven I/O)
  * $(date +...) subprocess forks (suggests /proc/uptime or bash printf)
  * pgrep/xdotool in polling functions (expensive fork overhead)
  * aggressive polling (sleep < 1s causing fork storms)
  * heavy piped commands (| awk | grep | tr with multiple forks)

Documentation included:
  - SHELL_SCRIPT_QUALITY_GUIDELINES.md: 3-layer guide for developers/reviewers
  - SHELL_QUALITY_IMPLEMENTATION_SUMMARY.md: Technical implementation reference
  - COMPLETE_IMPLEMENTATION_SUMMARY.md: Full overview and integration guide
  - QUICK_REFERENCE_SHELL_QUALITY.md: Visual checklist and quick lookup
  - DELIVERABLES_INDEX.md: Index of all deliverables and next steps
  - shell.instructions.md: R1-R8 polling optimization rules (in ~/.copilot/instructions/)

System impact:
  - Prevents new scripts from introducing fork-storm regressions
  - Already active optimizations: network_monitor.sh zero-fork, battery 1s->5s, music adaptive sleep
  - Expected daily savings: ~1-2 CPU-hours from eliminated fork overhead

Related: Resolves previous fork-storm issue identified on May 3 causing 728k CPU-seconds
2026-05-03 21:42:49 +02:00
.github feat(phone-focus): add recovery workflow, automation scripts, and docs 2026-05-01 19:07:27 +02:00
.vscode Fix pre-commit OOM: oom_score_adj + Node heap caps 2026-04-12 21:34:56 +02:00
C chore(tooling): update pre-commit config and repo ignores 2026-05-01 19:06:43 +02:00
CPP Add tests and fix pre-commit issues across all projects 2026-04-12 20:45:24 +02:00
docs/superpowers feat(phone-focus): add recovery workflow, automation scripts, and docs 2026-05-01 19:07:27 +02:00
horatio chore: optimize pre-commit, remove tracked binaries, fix lint issues 2026-04-10 18:48:37 +02:00
linux_configuration Optimize linux polling and i3blocks scripts 2026-05-01 20:15:45 +02:00
phone_focus_mode feat(phone-focus): add recovery workflow, automation scripts, and docs 2026-05-01 19:07:27 +02:00
pomodoro_app Add tests and fix pre-commit issues across all projects 2026-04-12 20:45:24 +02:00
python_pkg feat(screen-locker): add early-bird workout checks and phone verification updates 2026-05-01 19:07:34 +02:00
robotgo_demo feat: robotgo improvements in phone focus bluetooth and printer scripts 2026-03-09 18:34:15 +01:00
scripts feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00
sonic_pi feat: text learning pipe 2025-12-27 17:22:17 +01:00
TS Add tests and fix pre-commit issues across all projects 2026-04-12 20:45:24 +02:00
.binary-allowlist feat: make horatio audio work on android 2026-03-30 20:18:33 +02:00
.copilotignore chore(tooling): update pre-commit config and repo ignores 2026-05-01 19:06:43 +02:00
.fvmrc fixes for existing scripts and pomodoro with local sync 2026-02-14 18:42:20 +01:00
.gitignore phone_focus_mode: add persistent home-mode status notification 2026-04-20 15:33:46 +02:00
.pre-commit-config.yaml feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00
COMPLETE_IMPLEMENTATION_SUMMARY.md feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00
DELIVERABLES_INDEX.md feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00
eslint.config.mjs feat: great beautiful fixes 2026-02-20 00:37:32 +01:00
lint_python.sh fix: resolve shellcheck warnings 2025-11-30 13:48:17 +01:00
out.json test: achieve 100% branch coverage across all python_pkg packages 2026-03-21 17:51:36 +01:00
package-lock.json fix: resolve all pre-commit hook failures after file splits 2026-03-18 22:20:05 +01:00
package.json feat: great beautiful fixes 2026-02-20 00:37:32 +01:00
POLLING_OPTIMIZATION_REPORT.md feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00
pyproject.toml chore(tooling): update pre-commit config and repo ignores 2026-05-01 19:06:43 +02:00
QUICK_OPTIMIZATION_GUIDE.md feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00
QUICK_REFERENCE_SHELL_QUALITY.md feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00
README.md refactor: enforce 500-line limit on all Python source files 2026-03-17 22:47:42 +01:00
requirements-dev.txt fix: correct shebang and executable permissions 2025-11-30 13:42:16 +01:00
requirements.txt Add tests and fix pre-commit issues across all projects 2026-04-12 20:45:24 +02:00
run.sh feat(phone-focus): add recovery workflow, automation scripts, and docs 2026-05-01 19:07:27 +02:00
setup.sh feat: great beautiful fixes 2026-02-20 00:37:32 +01:00
SHELL_QUALITY_IMPLEMENTATION_SUMMARY.md feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00
SHELL_SCRIPT_QUALITY_GUIDELINES.md feat: Add shell script quality enforcement and polling optimization guidelines 2026-05-03 21:42:49 +02:00

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