Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/22abad_donglicode.json
T

1 line
32 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "22abad/donglicode", "files": {"README.md": {"8aa302e9cd3314bd58dc438295cb75ce7c8150d7": {"t": 1785746619.5692837, "n": 7516, "h": "8354d47eebad0583", "c": "# 📜 Algorithm Constitution — Deliberate-Practice Dojo\n\n**donglicode** · 李东算法宪法 · 刻意练习台\n\n> Open a page, and deliberately drill **99 reusable algorithm \"building blocks\"**: an AI plans your day, you blind-type from memory against the clock, an AI judge scores you on correctness × speed, and the scheduler quietly raises or lowers each block's review frequency.\n>\n> 打开网页,就能刻意练习 **99 块可复用的算法「积木」**:系统自动排今日计划 → 你对着计时器盲敲 → AI 判官按「正确性 × 速度」打分 → 调度器自动升降每块的复习频率。\n\n🌐 **Live / 线上**: [donglicode.nb.ax](https://donglicode.nb.ax) *(invite-only — gated behind Cloudflare Access / 邀请制,需通过 Cloudflare Access 邮箱登录)*\n\n*English and 中文 are interleaved throughout. 全文中英双语对照。*\n\n---\n\n## ✨ Features / 功能亮点\n\n- 🧠 **Deliberate-practice loop** — plan → blind-type → AI-judged → auto-reschedule.\n **刻意练习闭环** —— 排计划 → 盲敲计时 → AI 判分 → 自动升降频。\n- 📅 **Rating-driven spaced repetition** — solid blocks fade to the background, shaky ones resurface. Frequency is computed from your own results, not hand-tuned.\n **评级驱动的间隔复习** —— 掌握的积木自动沉底,生疏的自动浮现;频率由你的成绩算出,不用手动调。\n- 🤖 **AI judge** — a server-side model (key kept private) scores your reproduction of the *pattern* (not one specific problem) and checks your stated time/space complexity. Falls back to an offline similarity check when offline.\n **AI 判官** —— 服务端模型(密钥私存)评估你复现的是否是**模板套路**(而非某一题),并核对你填写的时间/空间复杂度;断网时自动回落到离线相似度评分。\n- ☕🐍 **Java & Python** — one-click language toggle; every block ships in both.\n **Java 与 Python 双语言** —— 一键切换,99 块每块都有两种实现。\n- 🌏 **Bilingual UI** — English / 中文, light / dark.\n **双语界面** —— 中英文、日间/夜间随心切。\n- 🏆 **Leaderboard** — friendly ranking across users: total reps, blocks mastered, accuracy, active days.\n **排行榜** —— 跨用户友好竞争:总练习量、掌握积木数、准确率、投入天数。\n- ⌨️ **Lightweight code editor** — auto-indent, bracket/quote pairing, an auto-growing box, and a signature-only stub so you truly type from memory.\n **轻量代码编辑器** —— 自动缩进、括号/引号配对、随内容自动变高,只预填函数签名让你真正靠记忆盲敲。\n- 📴 **Offline-friendly** — drafts and results are cached locally and sync when you're back online.\n **离线友好** —— 草稿与成绩本地缓存,联网后自动同步。\n\nCurrently **99 blocks / 274 linked problems**, tiered S/A/B/C (must-know → rare), each with Java, English-commented Python, and NeetCode/LeetCode links.\n目前 **99 块 / 274 道关联题**,按 S/A/B/C 分级(必考 → 冷门),每块含 Java、英文注释的 Python,以及 NeetCode/LeetCode 链接。\n\n---\n\n## 🛠 Tech stack / 技术栈\n\nPure static frontend on **Cloudflare Pages** (no build step) · **Pages Functions** for the API · **Cloudflare D1** (SQLite) for per-user records · **Cloudflare Access** (email OTP) for login.\n\n纯静态前端跑在 **Cloudflare Pages**(无构建步骤)· API 用 **Pages Functions** · 每人的训练记录存 **Cloudflare D1**(SQLite)· 登录用 **Cloudflare Access**(邮箱验证码)。\n\n```\npublic/ Static frontend / 静态前端\n index.html Shell + nav / 页面骨架与导航\n app.js All UI logic (SPA, vanilla JS) / 全部前端逻辑(原生 JS 单页应用)\n styles.css Themes & layout / 主题与布局\n data/blocks.json The 99 blocks (Java + English + Python + problems) / 99 块内容\nfunctions/api/ Cloudflare Pages Functions / 后端接口\n attempts.js CRUD for practice records / 训练记录增删改查\n judge.js AI judge proxy (DeepSeek) / AI 判官代理\n leaderboard.js Cross-user aggregation / 跨用户聚合排行榜\n me.js Current identity / 当前身份\nschema.sql D1 table definition / D1 建表语句\nscripts/ Content-generation helpers / 内容生成脚本\n```\n\n---\n\n## 🧩 How it works / 运行原理\n\n- **A \"block\" is a reusable pattern skeleton**, not a single solution — e.g. *Flood Fill*, *Sliding Window*, *Binary Search on Answer*. Compound blocks are auto-split into independently-drillable parts by a call graph, so a main method and its private helpers (e.g. `numIslands` + `dfs`) stay welded together.\n **一块「积木」是可复用的套路骨架**,而非某道题的答案 —— 如*连通分量*、*滑动窗口*、*二分答案*。复合积木按调用图自动拆成可独立盲敲的小组,主函数与其私有辅助函数(如 `numIslands` + `dfs`)会绑在一起。\n- **Scheduling** ranks due blocks as *reinforce (failed) → review (seen) → learn (new)*, weighted by tier (must-know → rare) and how overdue they are.\n **调度**把到期积木排成*强化(做砸的)→ 复习(学过的)→ 新学*,再按重要度(必考 → 冷门)与逾期程度加权。\n- **Data model**: one `attempts` row per blind-type or problem drill (rating, score, seconds, code, part index…). See `schema.sql`.\n **数据模型**:每次盲敲或刷题一行 `attempts`(评级、分数、用时、代码、分组下标……),见 `schema.sql`。\n\n---\n\n## 🚀 Local development / 本地开发\n\n```bash\nnpm install # install wrangler / 装 wrangler\nnpx wrangler d1 execute donglicode --local --file=schema.sql # create the local table / 建本地表\nnpm run dev # http://localhost:8788\n```\n\nLocally there's no Cloudflare Access, so `functions/_lib.js` falls back to the `DEV_EMAIL` in your `.dev.vars` as the logged-in user. The AI judge needs a `DEEPSEEK_KEY` in `.dev.vars`; without it, the app quietly uses the offline similarity check.\n\n本地没有 Cloudflare Access,`functions/_lib.js` 会回落到 `.dev.vars` 里的 `DEV_EMAIL` 当登录用户。AI 判官需要 `.dev.vars` 里的 `DEEPSEEK_KEY`;没有它,应用会自动改用离线相似度评分。\n\n`.dev.vars` (gitignored — never commit it / 已忽略,切勿提交):\n\n```\nDEV_EMAIL=you@example.com\nDEEPSEEK_KEY=sk-... # optional / 可选\n```\n\n---\n\n## ☁️ Deploy to Cloudflare / 部署到 Cloudflare\n\n```bash\nnpx wrangler login # authorize / 授权\n\nnpx wrangler d1 create donglicode # create D1, paste the id into wrangler.toml / 建库并把 id 填进 wrangler.toml\nnpx wrangler d1 execute donglicode --remote --file=schema.sql # create the remote table / 建远程表\n\nnpx wrangler pages project create donglicode --production-branch main\nnpm run deploy # wrangler pages deploy public / 部署\n```\n\nLater updates are just `npm run deploy` (or wire up Git auto-deploy in the Pages dashboard).\n以后更新只需 `npm run deploy`(或在 Pages 面板接 Git 自动部署)。\n\n**Custom domain / 绑定域名**: Pages → your project → *Custom domains* → add your domain (auto-CNAME within the same account).\n**Login gate / 登录门禁**: *Zero Trust → Access → Applications → Self-hosted*, add an **Allow** policy listing the emails (or an `Emails ending in @your-school.edu` rule). Visitors then log in with a one-time email PIN, and each person's records are isolated by email.\n在 *Zero Trust → Access → Applications → Self-hosted* 加一条 **Allow** 策略,列出放行的邮箱(或按 `@某校.edu` 整段放行)。访客用邮箱验证码登录,记录按邮箱各自隔离。\n\n---\n\n## 🔒 A note on auth & privacy / 关于身份与隐私\n\nIdentity is intentionally lightweight: the API trusts an email/nickname to separate each person's records — it has **no password layer of its own**. The real gate is **Cloudflare Access**, which authenticates the email before any request reaches the app. If you fork this and remove Access, add your own auth. The leaderboard only shows the part of an email before `@`, never the full address.\n\n身份刻意做得很轻:接口用邮箱/昵称来隔离每个人的记录,**自身不设密码**。真正的门禁是 **Cloudflare Access**,它在请求到达应用前先验证邮箱。若你 fork 后去掉了 Access,请自行加鉴权。排行榜只显示邮箱 `@` 前的一段,绝不暴露完整邮箱。\n\n---\n\n## 🔁 Regenerating content / 重新生成内容\n\nThe 99 blocks live in `public/data/blocks.json`. Python translations were generated via `scripts/py_*.py` (each verified with `python3`); the base Java blocks are parsed from a source markdown by `scripts/parse_blocks.py`:\n\n99 块内容存在 `public/data/blocks.json`。Python 版由 `scripts/py_*.py` 生成(每段都过 `python3` 校验);基础 Java 积木由 `scripts/parse_blocks.py` 从源 markdown 解析:\n\n```bash\npython3 scripts/parse_blocks.py path/to/constitution.md public/data/blocks.json\n```\n\nRecords can be exported/imported as JSON from the **Records** tab for backup.\n训练记录可在**训练记录**页导出/导入 JSON 备份。\n\n---\n\n## 📄 License / 许可\n\n[MIT](LICENSE) © 2026 Dong — free to use, modify, and share.\n[MIT](LICENSE) 许可 © 2026 Dong —— 可自由使用、修改、分享。\n"}, "3782de1a40939203a1f757eda5d3797541b671f0": {"t": 1785766337.9963973, "n": 7516, "h": "8354d47eebad0583", "c": "# 📜 Algorithm Constitution — Deliberate-Practice Dojo\n\n**donglicode** · 李东算法宪法 · 刻意练习台\n\n> Open a page, and deliberately drill **99 reusable algorithm \"building blocks\"**: an AI plans your day, you blind-type from memory against the clock, an AI judge scores you on correctness × speed, and the scheduler quietly raises or lowers each block's review frequency.\n>\n> 打开网页,就能刻意练习 **99 块可复用的算法「积木」**:系统自动排今日计划 → 你对着计时器盲敲 → AI 判官按「正确性 × 速度」打分 → 调度器自动升降每块的复习频率。\n\n🌐 **Live / 线上**: [donglicode.nb.ax](https://donglicode.nb.ax) *(invite-only — gated behind Cloudflare Access / 邀请制,需通过 Cloudflare Access 邮箱登录)*\n\n*English and 中文 are interleaved throughout. 全文中英双语对照。*\n\n---\n\n## ✨ Features / 功能亮点\n\n- 🧠 **Deliberate-practice loop** — plan → blind-type → AI-judged → auto-reschedule.\n **刻意练习闭环** —— 排计划 → 盲敲计时 → AI 判分 → 自动升降频。\n- 📅 **Rating-driven spaced repetition** — solid blocks fade to the background, shaky ones resurface. Frequency is computed from your own results, not hand-tuned.\n **评级驱动的间隔复习** —— 掌握的积木自动沉底,生疏的自动浮现;频率由你的成绩算出,不用手动调。\n- 🤖 **AI judge** — a server-side model (key kept private) scores your reproduction of the *pattern* (not one specific problem) and checks your stated time/space complexity. Falls back to an offline similarity check when offline.\n **AI 判官** —— 服务端模型(密钥私存)评估你复现的是否是**模板套路**(而非某一题),并核对你填写的时间/空间复杂度;断网时自动回落到离线相似度评分。\n- ☕🐍 **Java & Python** — one-click language toggle; every block ships in both.\n **Java 与 Python 双语言** —— 一键切换,99 块每块都有两种实现。\n- 🌏 **Bilingual UI** — English / 中文, light / dark.\n **双语界面** —— 中英文、日间/夜间随心切。\n- 🏆 **Leaderboard** — friendly ranking across users: total reps, blocks mastered, accuracy, active days.\n **排行榜** —— 跨用户友好竞争:总练习量、掌握积木数、准确率、投入天数。\n- ⌨️ **Lightweight code editor** — auto-indent, bracket/quote pairing, an auto-growing box, and a signature-only stub so you truly type from memory.\n **轻量代码编辑器** —— 自动缩进、括号/引号配对、随内容自动变高,只预填函数签名让你真正靠记忆盲敲。\n- 📴 **Offline-friendly** — drafts and results are cached locally and sync when you're back online.\n **离线友好** —— 草稿与成绩本地缓存,联网后自动同步。\n\nCurrently **99 blocks / 274 linked problems**, tiered S/A/B/C (must-know → rare), each with Java, English-commented Python, and NeetCode/LeetCode links.\n目前 **99 块 / 274 道关联题**,按 S/A/B/C 分级(必考 → 冷门),每块含 Java、英文注释的 Python,以及 NeetCode/LeetCode 链接。\n\n---\n\n## 🛠 Tech stack / 技术栈\n\nPure static frontend on **Cloudflare Pages** (no build step) · **Pages Functions** for the API · **Cloudflare D1** (SQLite) for per-user records · **Cloudflare Access** (email OTP) for login.\n\n纯静态前端跑在 **Cloudflare Pages**(无构建步骤)· API 用 **Pages Functions** · 每人的训练记录存 **Cloudflare D1**(SQLite)· 登录用 **Cloudflare Access**(邮箱验证码)。\n\n```\npublic/ Static frontend / 静态前端\n index.html Shell + nav / 页面骨架与导航\n app.js All UI logic (SPA, vanilla JS) / 全部前端逻辑(原生 JS 单页应用)\n styles.css Themes & layout / 主题与布局\n data/blocks.json The 99 blocks (Java + English + Python + problems) / 99 块内容\nfunctions/api/ Cloudflare Pages Functions / 后端接口\n attempts.js CRUD for practice records / 训练记录增删改查\n judge.js AI judge proxy (DeepSeek) / AI 判官代理\n leaderboard.js Cross-user aggregation / 跨用户聚合排行榜\n me.js Current identity / 当前身份\nschema.sql D1 table definition / D1 建表语句\nscripts/ Content-generation helpers / 内容生成脚本\n```\n\n---\n\n## 🧩 How it works / 运行原理\n\n- **A \"block\" is a reusable pattern skeleton**, not a single solution — e.g. *Flood Fill*, *Sliding Window*, *Binary Search on Answer*. Compound blocks are auto-split into independently-drillable parts by a call graph, so a main method and its private helpers (e.g. `numIslands` + `dfs`) stay welded together.\n **一块「积木」是可复用的套路骨架**,而非某道题的答案 —— 如*连通分量*、*滑动窗口*、*二分答案*。复合积木按调用图自动拆成可独立盲敲的小组,主函数与其私有辅助函数(如 `numIslands` + `dfs`)会绑在一起。\n- **Scheduling** ranks due blocks as *reinforce (failed) → review (seen) → learn (new)*, weighted by tier (must-know → rare) and how overdue they are.\n **调度**把到期积木排成*强化(做砸的)→ 复习(学过的)→ 新学*,再按重要度(必考 → 冷门)与逾期程度加权。\n- **Data model**: one `attempts` row per blind-type or problem drill (rating, score, seconds, code, part index…). See `schema.sql`.\n **数据模型**:每次盲敲或刷题一行 `attempts`(评级、分数、用时、代码、分组下标……),见 `schema.sql`。\n\n---\n\n## 🚀 Local development / 本地开发\n\n```bash\nnpm install # install wrangler / 装 wrangler\nnpx wrangler d1 execute donglicode --local --file=schema.sql # create the local table / 建本地表\nnpm run dev # http://localhost:8788\n```\n\nLocally there's no Cloudflare Access, so `functions/_lib.js` falls back to the `DEV_EMAIL` in your `.dev.vars` as the logged-in user. The AI judge needs a `DEEPSEEK_KEY` in `.dev.vars`; without it, the app quietly uses the offline similarity check.\n\n本地没有 Cloudflare Access,`functions/_lib.js` 会回落到 `.dev.vars` 里的 `DEV_EMAIL` 当登录用户。AI 判官需要 `.dev.vars` 里的 `DEEPSEEK_KEY`;没有它,应用会自动改用离线相似度评分。\n\n`.dev.vars` (gitignored — never commit it / 已忽略,切勿提交):\n\n```\nDEV_EMAIL=you@example.com\nDEEPSEEK_KEY=sk-... # optional / 可选\n```\n\n---\n\n## ☁️ Deploy to Cloudflare / 部署到 Cloudflare\n\n```bash\nnpx wrangler login # authorize / 授权\n\nnpx wrangler d1 create donglicode # create D1, paste the id into wrangler.toml / 建库并把 id 填进 wrangler.toml\nnpx wrangler d1 execute donglicode --remote --file=schema.sql # create the remote table / 建远程表\n\nnpx wrangler pages project create donglicode --production-branch main\nnpm run deploy # wrangler pages deploy public / 部署\n```\n\nLater updates are just `npm run deploy` (or wire up Git auto-deploy in the Pages dashboard).\n以后更新只需 `npm run deploy`(或在 Pages 面板接 Git 自动部署)。\n\n**Custom domain / 绑定域名**: Pages → your project → *Custom domains* → add your domain (auto-CNAME within the same account).\n**Login gate / 登录门禁**: *Zero Trust → Access → Applications → Self-hosted*, add an **Allow** policy listing the emails (or an `Emails ending in @your-school.edu` rule). Visitors then log in with a one-time email PIN, and each person's records are isolated by email.\n在 *Zero Trust → Access → Applications → Self-hosted* 加一条 **Allow** 策略,列出放行的邮箱(或按 `@某校.edu` 整段放行)。访客用邮箱验证码登录,记录按邮箱各自隔离。\n\n---\n\n## 🔒 A note on auth & privacy / 关于身份与隐私\n\nIdentity is intentionally lightweight: the API trusts an email/nickname to separate each person's records — it has **no password layer of its own**. The real gate is **Cloudflare Access**, which authenticates the email before any request reaches the app. If you fork this and remove Access, add your own auth. The leaderboard only shows the part of an email before `@`, never the full address.\n\n身份刻意做得很轻:接口用邮箱/昵称来隔离每个人的记录,**自身不设密码**。真正的门禁是 **Cloudflare Access**,它在请求到达应用前先验证邮箱。若你 fork 后去掉了 Access,请自行加鉴权。排行榜只显示邮箱 `@` 前的一段,绝不暴露完整邮箱。\n\n---\n\n## 🔁 Regenerating content / 重新生成内容\n\nThe 99 blocks live in `public/data/blocks.json`. Python translations were generated via `scripts/py_*.py` (each verified with `python3`); the base Java blocks are parsed from a source markdown by `scripts/parse_blocks.py`:\n\n99 块内容存在 `public/data/blocks.json`。Python 版由 `scripts/py_*.py` 生成(每段都过 `python3` 校验);基础 Java 积木由 `scripts/parse_blocks.py` 从源 markdown 解析:\n\n```bash\npython3 scripts/parse_blocks.py path/to/constitution.md public/data/blocks.json\n```\n\nRecords can be exported/imported as JSON from the **Records** tab for backup.\n训练记录可在**训练记录**页导出/导入 JSON 备份。\n\n---\n\n## 📄 License / 许可\n\n[MIT](LICENSE) © 2026 Dong — free to use, modify, and share.\n[MIT](LICENSE) 许可 © 2026 Dong —— 可自由使用、修改、分享。\n"}, "544862d5325a5de95c78f7c1e3055353f014a1c1": {"t": 1785766339.3594358, "n": 7576, "h": "bcda4f7279f9c7e3", "c": "# 📜 Algorithm Constitution — Deliberate-Practice Dojo\n\n**donglicode** · 李东算法宪法 · 刻意练习台\n\n> Open a page, and deliberately drill **99 reusable algorithm \"building blocks\"**: an AI plans your day, you blind-type from memory against the clock, an AI judge scores you on correctness × speed, and the scheduler quietly raises or lowers each block's review frequency.\n>\n> 打开网页,就能刻意练习 **99 块可复用的算法「积木」**:系统自动排今日计划 → 你对着计时器盲敲 → AI 判官按「正确性 × 速度」打分 → 调度器自动升降每块的复习频率。\n\n🌐 **Live / 线上**: [donglicode.nb.ax](https://donglicode.nb.ax) *(invite-only — gated behind Cloudflare Access / 邀请制,需通过 Cloudflare Access 邮箱登录)*\n\n*English and 中文 are interleaved throughout. 全文中英双语对照。*\n\n---\n\n## ✨ Features / 功能亮点\n\n- 🧠 **Deliberate-practice loop** — plan → blind-type → AI-judged → auto-reschedule.\n **刻意练习闭环** —— 排计划 → 盲敲计时 → AI 判分 → 自动升降频。\n- 📅 **Rating-driven spaced repetition** — solid blocks fade to the background, shaky ones resurface. Frequency is computed from your own results, not hand-tuned.\n **评级驱动的间隔复习** —— 掌握的积木自动沉底,生疏的自动浮现;频率由你的成绩算出,不用手动调。\n- 🤖 **AI judge** — a server-side model (key kept private) scores your reproduction of the *pattern* (not one specific problem) and checks your stated time/space complexity. Falls back to an offline similarity check when offline.\n **AI 判官** —— 服务端模型(密钥私存)评估你复现的是否是**模板套路**(而非某一题),并核对你填写的时间/空间复杂度;断网时自动回落到离线相似度评分。\n- ☕🐍 **Java & Python** — one-click language toggle; every block ships in both.\n **Java 与 Python 双语言** —— 一键切换,99 块每块都有两种实现。\n- 🌏 **Bilingual UI** — English / 中文, light / dark.\n **双语界面** —— 中英文、日间/夜间随心切。\n- 🏆 **Leaderboard** — friendly ranking across users: total reps, blocks mastered, accuracy, active days.\n **排行榜** —— 跨用户友好竞争:总练习量、掌握积木数、准确率、投入天数。\n- ⌨️ **Lightweight code editor** — auto-indent, bracket/quote pairing, an auto-growing box, and a signature-only stub so you truly type from memory.\n **轻量代码编辑器** —— 自动缩进、括号/引号配对、随内容自动变高,只预填函数签名让你真正靠记忆盲敲。\n- 📴 **Offline-friendly** — drafts and results are cached locally and sync when you're back online.\n **离线友好** —— 草稿与成绩本地缓存,联网后自动同步。\n\nCurrently **99 blocks / 274 linked problems**, tiered S/A/B/C (must-know → rare), each with Java, English-commented Python, and NeetCode/LeetCode links.\n目前 **99 块 / 274 道关联题**,按 S/A/B/C 分级(必考 → 冷门),每块含 Java、英文注释的 Python,以及 NeetCode/LeetCode 链接。\n\n---\n\n## 🛠 Tech stack / 技术栈\n\nPure static frontend on **Cloudflare Pages** (no build step) · **Pages Functions** for the API · **Cloudflare D1** (SQLite) for per-user records · **Cloudflare Access** (email OTP) for login.\n\n纯静态前端跑在 **Cloudflare Pages**(无构建步骤)· API 用 **Pages Functions** · 每人的训练记录存 **Cloudflare D1**(SQLite)· 登录用 **Cloudflare Access**(邮箱验证码)。\n\n```\npublic/ Static frontend / 静态前端\n index.html Shell + nav / 页面骨架与导航\n app.js All UI logic (SPA, vanilla JS) / 全部前端逻辑(原生 JS 单页应用)\n styles.css Themes & layout / 主题与布局\n data/blocks.json The 99 blocks (Java + English + Python + problems) / 99 块内容\nfunctions/api/ Cloudflare Pages Functions / 后端接口\n attempts.js CRUD for practice records / 训练记录增删改查\n judge.js AI judge proxy (DeepSeek) / AI 判官代理\n leaderboard.js Cross-user aggregation / 跨用户聚合排行榜\n me.js Current identity / 当前身份\nschema.sql D1 table definition / D1 建表语句\nscripts/ Content-generation helpers / 内容生成脚本\n```\n\n---\n\n## 🧩 How it works / 运行原理\n\n- **A \"block\" is a reusable pattern skeleton**, not a single solution — e.g. *Flood Fill*, *Sliding Window*, *Binary Search on Answer*. Compound blocks are auto-split into independently-drillable parts by a call graph, so a main method and its private helpers (e.g. `numIslands` + `dfs`) stay welded together.\n **一块「积木」是可复用的套路骨架**,而非某道题的答案 —— 如*连通分量*、*滑动窗口*、*二分答案*。复合积木按调用图自动拆成可独立盲敲的小组,主函数与其私有辅助函数(如 `numIslands` + `dfs`)会绑在一起。\n- **Scheduling** ranks due blocks as *reinforce (failed) → review (seen) → learn (new)*, weighted by tier (must-know → rare) and how overdue they are.\n **调度**把到期积木排成*强化(做砸的)→ 复习(学过的)→ 新学*,再按重要度(必考 → 冷门)与逾期程度加权。\n- **Data model**: one `attempts` row per blind-type or problem drill (rating, score, seconds, code, part index…). See `schema.sql`.\n **数据模型**:每次盲敲或刷题一行 `attempts`(评级、分数、用时、代码、分组下标……),见 `schema.sql`。\n\n---\n\n## 🚀 Local development / 本地开发\n\n```bash\nnpm install # install wrangler / 装 wrangler\nnpx wrangler d1 execute donglicode --local --file=schema.sql # create the local table / 建本地表\nnpm run dev # http://localhost:8788\n```\n\nLocally there's no Cloudflare Access, so `functions/_lib.js` falls back to the `DEV_EMAIL` in your `.dev.vars` as the logged-in user. The AI judge needs a `DEEPSEEK_KEY` in `.dev.vars`; without it, the app quietly uses the offline similarity check.\n\n本地没有 Cloudflare Access,`functions/_lib.js` 会回落到 `.dev.vars` 里的 `DEV_EMAIL` 当登录用户。AI 判官需要 `.dev.vars` 里的 `DEEPSEEK_KEY`;没有它,应用会自动改用离线相似度评分。\n\n`.dev.vars` (gitignored — never commit it / 已忽略,切勿提交):\n\n```\nDEV_EMAIL=you@example.com\nDEEPSEEK_KEY=sk-... # optional / 可选\n```\n\n---\n\n## ☁️ Deploy to Cloudflare / 部署到 Cloudflare\n\n```bash\nnpx wrangler login # authorize / 授权\n\nnpx wrangler d1 create donglicode # create D1, paste the id into wrangler.toml / 建库并把 id 填进 wrangler.toml\nnpx wrangler d1 execute donglicode --remote --file=schema.sql # create the remote table / 建远程表\n\nnpx wrangler pages project create donglicode --production-branch main\nnpm run deploy # wrangler pages deploy public / 部署\n```\n\nLater updates are just `npm run deploy` (or wire up Git auto-deploy in the Pages dashboard).\n以后更新只需 `npm run deploy`(或在 Pages 面板接 Git 自动部署)。\n\n**Custom domain / 绑定域名**: Pages → your project → *Custom domains* → add your domain (auto-CNAME within the same account).\n**Login gate / 登录门禁**: *Zero Trust → Access → Applications → Self-hosted*, add an **Allow** policy listing the emails (or an `Emails ending in @your-school.edu` rule). Visitors then log in with a one-time email PIN, and each person's records are isolated by email.\n在 *Zero Trust → Access → Applications → Self-hosted* 加一条 **Allow** 策略,列出放行的邮箱(或按 `@某校.edu` 整段放行)。访客用邮箱验证码登录,记录按邮箱各自隔离。\n\n---\n\n## 🔒 A note on auth & privacy / 关于身份与隐私\n\nIdentity is intentionally lightweight: the API trusts an email/nickname to separate each person's records — it has **no password layer of its own**. The real gate is **Cloudflare Access**, which authenticates the email before any request reaches the app. If you fork this and remove Access, add your own auth. The leaderboard only shows the part of an email before `@`, never the full address.\n\n身份刻意做得很轻:接口用邮箱/昵称来隔离每个人的记录,**自身不设密码**。真正的门禁是 **Cloudflare Access**,它在请求到达应用前先验证邮箱。若你 fork 后去掉了 Access,请自行加鉴权。排行榜只显示邮箱 `@` 前的一段,绝不暴露完整邮箱。\n\n---\n\n## 🔁 Regenerating content / 重新生成内容\n\nThe 99 blocks live in `public/data/blocks.json`. Python translations were generated via `scripts/py_*.py` (each verified with `python3`); the base Java blocks are parsed from a source markdown by `scripts/parse_blocks.py`:\n\n99 块内容存在 `public/data/blocks.json`。Python 版由 `scripts/py_*.py` 生成(每段都过 `python3` 校验);基础 Java 积木由 `scripts/parse_blocks.py` 从源 markdown 解析:\n\n```bash\npython3 scripts/parse_blocks.py path/to/constitution.md public/data/blocks.json\n```\n\nRecords can be exported/imported as JSON from the **Records** tab for backup.\n训练记录可在**训练记录**页导出/导入 JSON 备份。\n\n---\n\n## 📄 License / 许可\n\nA personal learning project — no open-source license is set yet. If you'd like to reuse or adapt it, please open an issue first.\n个人学习项目,暂未设置开源许可。如需复用或改编,请先提 issue 沟通。\n"}, "c950c644e57451b64bcbc002a3753640f42e344b": {"t": 1785766340.9190154, "n": 1980, "h": "5aa0a2c4bc3fab56", "c": "# 📜 李东算法宪法 · 刻意练习台 (donglicode)\n\n打开网页就能刻意练习 99 块算法积木:**每天自动排计划 → 盲敲计时 → 自评 🟢🟡🟠🔴 → 系统自动升降频**。\n数据按登录邮箱存 Cloudflare D1,手机/电脑互通。刷题(LC)也能记时长+结果,权重低于积木块。\n\n- **前端**:纯静态(Cloudflare Pages),无构建步骤。\n- **后端**:Pages Functions(`/functions/api`)读写 **Cloudflare D1**。\n- **登录**:**Cloudflare Access** 邮箱验证码(OTP),免密码,只放行白名单邮箱(你 + 同学)。\n- **数据来源**:`public/data/blocks.json`,由「宪法」md 解析生成(99 块 + 274 题,含 NeetCode/LeetCode 链接)。\n\n线上地址:`https://donglicode.nb.ax`\n\n---\n\n## 一、本地开发\n\n```bash\nnpm i # 装 wrangler\nwrangler d1 execute donglicode --local --file=schema.sql # 建本地表\nnpm run dev # http://localhost:8788\n```\n本地无 Access,`_lib.js` 会回落到 `.dev.vars` 里的 `DEV_EMAIL` 当登录用户。\n\n## 二、部署到 Cloudflare(一次性)\n\n> 前提:`nb.ax` 已托管在同一个 Cloudflare 账号。先 `wrangler login` 授权。\n\n```bash\n# 1) 建云端 D1,把输出的 database_id 填进 wrangler.toml\nwrangler d1 create donglicode\n# 2) 建表(远程)\nwrangler d1 execute donglicode --remote --file=schema.sql\n# 3) 建 Pages 项目并首次部署\nwrangler pages project create donglicode --production-branch main\nwrangler pages deploy public --project-name=donglicode\n```\n以后更新只需:`wrangler pages deploy public --project-name=donglicode`(或接 Git 自动部署)。\n\n## 三、绑定域名 donglicode.nb.ax\n\nCloudflare 面板 → **Workers & Pages → donglicode → Custom domains → Set up a custom domain** →\n输入 `donglicode.nb.ax` → 确认(同账号会自动加 CNAME 记录)。几分钟后即可访问。\n\n## 四、开启邮箱登录(Cloudflare Access,免费 ≤50 人)\n\nCloudflare 面板 → **Zero Trust**(首次需给团队起个名,选 Free 计划)→\n**Access → Applications → Add an application → Self-hosted**:\n\n1. **Application name**:donglicode;**domain**:`donglicode.nb.ax`\n2. **Add policy**:Name = allow-me;Action = **Allow**;\n Include → **Emails** → 填你和同学的邮箱(或 Include → *Emails ending in* → `@某校.edu` 放行整个学校)。\n3. 保存。登录方式默认带 **One-time PIN**(邮箱收验证码),无需接第三方。\n\n完成后:任何人访问 `donglicode.nb.ax` 都会先跳到邮箱验证码登录;只有白名单邮箱能进,\n且每个人的训练记录按邮箱各自隔离。\n\n## 五、更新积木内容\n\n改了「宪法」md 后,重跑解析脚本生成 `public/data/blocks.json`,再 `wrangler pages deploy` 即可。\n\n## 数据备份\n\n网页「训练记录」页有 **导出/导入 JSON**,可随时备份到 GitHub / 谷歌网盘。\n"}}}}