This project runs on a Raspberry Pi and generates multiple LeetCode-style commits per day using a local Ollama model. The scheduler now persists a randomized daily plan to disk, spaces runs at least 45 minutes apart, skips missed slots instead of backfilling them, and pushes automatically after a successful commit.
- Default schedule: 3 to 8 commits per day.
- Active window: random slots between 09:00 and 22:00 local time.
- Minimum spacing: 45 minutes between scheduled runs.
- Persistent state: daily schedules are stored in
.state/schedules/YYYY-MM-DD.json. - Missed runs: old pending slots are marked
skipped_missedand never replayed in a burst. - Duplicate protection: the bot uses an exclusive lock, records slot state, avoids recently used problems, and skips empty staged diffs.
- Dry-run mode: evaluates scheduling and writes a preview under
.state/dry_run_previewswithout touching the git repo.
Copy .env.example to .env and preserve your existing secrets, repo settings, and push configuration.
Key settings:
MIN_COMMITS_PER_DAY=3MAX_COMMITS_PER_DAY=8ACTIVE_HOURS_START=09:00ACTIVE_HOURS_END=22:00MIN_GAP_MINUTES=45DUE_GRACE_MINUTES=20RUNNING_STALE_MINUTES=180DRY_RUN=falseLCB_RUN_MODE=normalLCB_DRY_RUN_USE_LLM=falseLCB_OLLAMA_TIMEOUT=210LCB_NUM_PREDICT=160
LCB_NOW is optional and useful only for local testing when you want to force the scheduler to evaluate a specific timestamp.
- Create and activate the venv with
scripts/bootstrap.sh. - Add problem blocks to
data/questions.txt. - For a safe local smoke test, run
LCB_RUN_MODE=dry-run python -m leetcode_bot.run. - If you want dry-run to call Ollama too, set
LCB_DRY_RUN_USE_LLM=true.
- SSH to the Pi and
cd ~/Github_Automation. - Update the repo contents in place.
- Preserve the existing
.env, SSH keys, git remote, and branch setup. - Run
scripts/bootstrap.sh. - Install the timer with
scripts/setup_systemd.sh. - Verify the timer with
systemctl status leetcode-bot.timer. - Inspect recent runs with
journalctl -u leetcode-bot.service -n 100 --no-pager.
The service remains systemd-based. The timer now polls every 5 minutes; the Python scheduler decides whether a slot is actually due.
- Solutions are LLM-assisted and only syntax-checked locally.
- On Raspberry Pi, the model now only has to return
solution.py; concise notes are generated locally to reduce malformed JSON failures. - If Ollama is unreachable, normal runs will fail fast and the slot will be recorded as failed.
- Generated solution folders now include the run time so multiple commits on the same day do not collide.
Last updated: 2026-07-17T03:27:11Z
Total solutions: 289
- Easy: 289
- 2026-07-16: Two Sum
- 2026-07-16: Two Sum
- 2026-07-16: Reverse Linked List
- 2026-07-16: Reverse Linked List
- 2026-07-15: Reverse Linked List
- 2026-07-15: Reverse Linked List
- 2026-07-15: Two Sum
- 2026-07-15: Reverse Linked List
- 2026-07-15: Two Sum
- 2026-07-14: Reverse Linked List