软件的安全带,不该系在人的记性上Software's Safety Belt Shouldn't Be Strapped to Human Memory
发布于 2026-11-17Published 2026-11-17
今日深读Today's Deep Read
控制层级:为什么「小心一点」是软件里最弱的一道防线The Hierarchy of Controls: Why "Be More Careful" Is the Weakest Line of Defense in Software
十年前,Hillel Wayne 还是个初级工程师:他一边开着生产环境的 shell,一边开着本地开发 shell,在两个标签页之间切错了那一个,跑错了一条查询,几秒钟后生产数据就没了——他因此学会了怎么从备份恢复数据库。事后最常见的反应是加强培训、把步骤写进 checklist、操作前再确认一次、以后要更小心。他说,这套直觉在工业安全领域早就被淘汰了——因为它把防线放在了整条链上最容易出错的那一环:人。Hillel 自己承认,这不是一份安全工程指南,而是一个初学者把工业安全的概念往软件上搬的练习;但正因为它足够具体,这个类比才值得认真对待。Ten years ago Hillel Wayne was a junior engineer with a production shell in one tab and a local development shell in another. He switched to the wrong tab, ran the wrong query, and lost production data within seconds — which is how he learned to restore a database from backup. The usual response is more training, a checklist, one more confirmation dialog, and a resolution to be more careful next time. He points out that industrial safety abandoned that instinct long ago, because it puts the last line of defense at the most fallible link in the chain: the person. Hillel admits this is not a safety-engineering guide but a beginner’s exercise in carrying industrial-safety concepts over to software; the analogy earns its keep precisely because it stays concrete.
工业安全领域有一个成熟的排序,叫「控制层级」(Hierarchy of Controls),从最有效到最无效依次是:消除危险、替代危险、工程控制、管理控制、个体防护。很多人把它当成一句口号背下来,但它的真正力量在一个判据上:工程控制可能失效,替代不会失效。护栏会被绕过,权限会被扩大,确认框会被肌肉记忆点掉;而如果那台机器上根本没有生产库的密码,错误就没有发生的物理条件。Workplace safety has a mature ranking called the Hierarchy of Controls, ordered from most to least effective: eliminate the hazard, substitute it, apply engineering controls, apply administrative controls, and finally rely on personal protective equipment. Most people memorize the list as a slogan. Its real force is a single test: engineering controls can fail, substitutions cannot. A guard rail can be walked around, a permission can be widened, a confirmation dialog can be dismissed by muscle memory. But if the production password simply is not on that machine, the mistake has no physical conditions in which to happen.
拿误删数据库这件事逐层过一遍。消除:先问这个危险是不是必要的——能下线的环境就下线,不再需要的写入口就删掉。替代:日常排查一律连只读副本,写操作换一条完全不同的路径。工程控制:更严的权限策略、生产终端闲置自动登出、确认时要求手动输入完整的库名,而不是点一下「确定」。管理控制:培训、双人复核、值班手册。个体防护:备份和告警——它们很重要,但它们是安全网,不是防线;人已经掉下去了,安全网只决定摔得多重。这五层不是五条建议,而是一把尺子:每放下一层防线,都可以追问一句「如果它失效,下一条是什么」。Walk the dropped-table incident through each level. Elimination: first ask whether the hazard is necessary at all — retire environments that no longer need to exist and remove write paths nobody needs. Substitution: debugging always connects to a read replica, and writes take a completely different path. Engineering controls: tighter permission policies, automatic logout from idle production terminals, and a confirmation that requires typing the database's full name rather than clicking OK. Administrative controls: training, two-person review, a runbook. Personal protective equipment: backups and alerts, which matter enormously but are a net, not a fence. They decide how hard you land, not whether you fall. The five levels are not five suggestions but a ruler: after each line of defense, ask what the next one is if it fails.
这里有一个容易被忽略的细节:同一个措施可以落在不同层,强度天差地别。要求输入数据库名字是工程控制,但它的强度取决于这个名字有多难猜、能不能从别处复制粘贴、有没有自动补全帮你填好。Hillel 的说法是,好的工程控制应当让「正确操作」成为默认路径,而不是给错误路径加一道需要人主动放弃的关卡。There is a subtlety here: the same measure can sit at different levels, and its strength varies wildly. Requiring the database name is an engineering control, but only as strong as the name is hard to guess, hard to copy from elsewhere, and not auto-completed for you. Hillel's framing is that a good engineering control makes the correct action the default, rather than adding a gate that a human must actively decline to bypass.
程序员特别需要这套语言,因为软件的物理定律是我们自己写的。我们改不动人的注意力,但可以改凭证的分布、改接口的形状、改数据的生命周期,而且这些改动的成本常常低于一场全员培训。下次写事故复盘的行动项时,不妨先问两个问题:这一条属于哪一层?能不能往上挪一层——把「要求人记得」换成「让人没有机会忘」?Programmers need this vocabulary in particular because the laws of physics in software are ours to write. We cannot change how attention works, but we can change where credentials live, what shape an interface has, and how long data survives; and those changes are often cheaper than a company-wide training session. The next time you write a postmortem action item, ask two questions first: which level is this? And can we move it up one level, replacing "people must remember" with "people cannot forget"?
AI 思考Thinking About AI
- 每月三千美元的 token:一个资深工程师的 AI 使用清单Three Thousand Dollars of Tokens a Month: One Engineer's AI Inventory
- 先看作者的位置:他从微软 Windows AI 团队转到 Salesforce AI Research,工作变成支持科学家和做快速原型,每月在 token 上花约 3000 美元。这让他既不是围观者,也不是卖工具的。Start with where the author stands: he moved from Microsoft's Windows AI team to Salesforce AI Research, where the job is supporting scientists and building rapid prototypes, and he spends about $3,000 a month on tokens. He is neither a spectator nor someone selling the tools.
- 他最大的一处改变是「不再怎么手写代码」:一天同时管理 5–6 个 agent,每个 agent 在自己的 git worktree 里干活,写代码、跑测试、开 PR。原型速度从几天变成二十分钟,这让「快速失败」变成「超快速失败」。His biggest change is that he barely writes code by hand. A workday means managing five or six agents, each in its own git worktree, writing code, running tests, opening PRs. Prototypes that took days take twenty minutes, which turns "fail fast" into "fail ultra-fast."
- 但他马上给这套叙事刹车:完全放任的 agent 会产出架构过度、难读、自我感觉良好的 slop。他今年最满意的工作,恰恰是手写一个小工具,替掉约 4000 行「感觉对」的生成代码——几百行、更好测试、更通用。Then he brakes hard on his own story: left alone, agents produce over-architected, unreadable, self-congratulatory slop. His most satisfying work this year was hand-writing a small tool that replaced about 4,000 lines of vibe-coded software with a few hundred — more flexible, easier to test, more general.
- 他也没有回避代价:同时和 6 个机器人讨论 6 个功能,比写代码本身更让人过度兴奋和疲惫;「午饭前再发一个 prompt」会一路滑到晚饭。还有手艺的失落——调代码、找设计、看零件咬合的那种冥想感,被交给了 7 号 agent。He does not dodge the costs either. Juggling six conversations with six robots about six features is more overstimulating and exhausting than coding ever was; "one more prompt before lunch" slides into dinner. And there is the loss of craft — the meditative work of tuning code, finding the design, watching the parts mesh — now delegated to agent number seven.
- 所以他开始写一份「个人 AI 政策」:不是公司合规文件,而是给自己定日常边界——哪些事情可以外包,哪些必须亲手做,哪些根本不该让 AI 介入。结论不是「AI 好不好」,而是「你得先决定自己要成为什么样的工作者」。So he started drafting a personal AI policy: not corporate compliance, but his own day-to-day boundaries about what can be outsourced, what must be done by hand, and what should not involve AI at all. The conclusion is not "is AI good," but "you have to decide what kind of worker you intend to be."
- 全用 AI 写代码之后,我的代码库变脆了After Letting AI Write Everything, My Codebase Became Fragile
- 作者先交代立场:2026 年 5 月他从 Meta 被裁,原因只能猜,但他怀疑其中之一是自己比同事更抗拒把 AI 当编码工具——尽管他在那里的最后几个月也有至少 90% 的代码是生成的,因为那是拿到及格评价的最低要求。现在他在另一家大公司,因为「这是今天的预期」,生成率提到了 100%。所以这不是外人骂 AI,是一份来自实验内部的报告。The author starts with his position: he was laid off from Meta in May 2026, can only speculate why, and suspects one reason was being more resistant than his peers to using AI as a coding tool — even though he was already generating at least 90% of his code in his last months there, the minimum for a decent rating. He is now at another large tech company and has gone to 100% because that is the expectation today. This is not an outsider scolding AI; it is a field report from inside the experiment.
- 他列出四种退化模式。第一是测试变浅:模型爱写 getter/setter 之类永远会通过的测试;写端到端测试时,也只覆盖代码里已经被覆盖过的路径。行覆盖率很漂亮,但覆盖缺口对开发者不可见。He names four modes of decay. First, shallow tests: models love getters and setters that can never fail, and their end-to-end tests only cover paths the codebase already covered. Line coverage looks great while the gaps stay invisible to developers.
- 第二是过度复杂:模型会把 DRY 执行到教条的程度——一件小事拆成两三个辅助函数,或者为了「复用」多加一层抽象。结果每个调用点要读三层才能明白在做什么,改一个需求要动很多地方。Second, needless complexity: the model follows DRY to the point of dogma — two or three helper functions where one would do, an extra layer of abstraction for the sake of reuse. Every call site now needs three hops to understand, and one requirement change touches many files.
- 第三是人的理解变浅:代码进得太快,团队没时间形成心智模型,出问题时只能在一个复杂、测试又薄弱的代码库里现学。第四是生成速度超过审查速度:每个 PR 都比上一个来得更快、留给人看的时间更少,于是大家开始扫读,小问题攒成意面。Third, human understanding thins out: code arrives faster than anyone can build a mental model, so when something breaks the team has to learn a complex, thinly tested codebase from scratch. Fourth, generation outruns review: each PR arrives faster than the last and gets less time, so people start skimming, and small issues accrue into spaghetti.
- 症状比原因晚出现:事故变多、恢复变慢、只有真实用户才碰得到的错误变多、体验越来越差——他的说法是「AI 为 AI 写的软件」。结论不是别用 AI,而是高质量产品仍然需要人的手感:最便宜、只拼价格的产品可以交给机器,最贵的那一档不会。The symptoms lag the causes: more incidents, slower recovery, more bugs only real users ever hit, a worse experience — his phrase is software made by AI for AI. His conclusion is not to stop using AI; it is that high-quality products still need a human touch: the cheapest products that compete only on price can be handed to machines, the most expensive ones will not be.
- LLM 读写神经网络权重,并没有超出人类研究员LLMs Reading and Writing Weights Is Not Superhuman
- 先看震撼的说法:一篇论文称 GPT-6 Astra 能直接看神经网络的权重,判断这个小网络在玩什么游戏,还能改权重提升一个 0.8B 模型做数学的能力。听起来像递归自我改进的开端。Start with the startling claim: a paper reports that GPT-6 Astra can look directly at a network's weights, tell which game a small network was trained to play, and even edit weights to improve a 0.8B model's math ability. It sounds like the beginning of recursive self-improvement.
- 作者把第一个实验拆开。这个玩游戏的网络输入是 10×10 的格子,每个格子的 5 个通道还带着「角色」「移动物体」这样的标签。于是取第一层卷积核的 L2 范数,就得到一张「网络最在意棋盘哪里」的热力图,三行 numpy 就够。The author takes the first experiment apart. The game network's input is a 10×10 grid, and each cell's five channels are labeled things like "agent" and "moving objects." So compute the L2 norm of the first-layer kernels and you get a heatmap of where the network is looking — three lines of numpy.
- 热力图一画出来,人类几乎立刻能认出游戏:Breakout 里玩家在底部一条横线,Pac-Man 里是那个标志性的迷宫。Astra 只是没执行 Python 也算出来了——这是超人的心算,不是超人的研究。Once you draw that heatmap, a human recognizes the games almost immediately: Breakout has the player as a horizontal line at the bottom, Pac-Man has the unmistakable maze. Astra merely did the arithmetic without running Python. That is superhuman mental math, not superhuman research.
- 第二个实验更实在:那个 Qwen 模型并不是「不会数学」,而是超过 32k token 后会陷入循环。人类研究员会怎么做?写几段会循环和不会循环的推理文本,比较残差差异,量出哪些权重贡献最大,再一点点削掉——就是消融(abliteration)那套流程。Astra 做的正是这个。The second experiment is more substantial. The Qwen model was not bad at math in general; it fell into loops past 32k tokens. What would a human researcher do? Write some reasoning texts that loop and some that don't, compare their residuals, measure which weights contribute most, then trim them — the abliteration playbook. That is exactly what Astra did.
- 所以结论很克制:模型能改权重是真的,但类比不是「它自己进化了」,而是「它能直接吐机器码」。能用机器码打补丁,不代表不该写源码;真正的进步仍然来自更好的训练,而不是魔法式的权重编辑。So the conclusion is restrained: yes, the model can edit weights, but the right analogy is not "it evolved itself," it is "it can emit machine code." Being able to patch a binary does not remove the reason to write source; real progress still comes from better training, not from magical weight surgery.
- 数学家和卢德派:当一门手艺的原材料变便宜Mathematicians and Luddites: When the Raw Material of a Craft Gets Cheap
- 作者先纠正一个词:卢德派不是「反技术的人」,而是一群有手艺的织工。他们砸机器,不是因为恨机器,而是因为自动织机让「织」这个动作不再值钱,而这门手艺同时是他们的收入、身份和生活方式。The author corrects a word first: the Luddites were not "people against technology" but skilled weavers. They smashed machines not out of hatred for machines but because automated looms made the act of weaving worthless — and that craft was simultaneously their income, their identity, and their way of life.
- 然后他做了一个词源上的连接:technology 来自 tekne(技艺),而 tekne 与「编织」同源;text、context、textile、subtext 全部来自「织在一起」。我们习惯说「组织思想」「编织论证」,不是偶然——制布曾经是人类最复杂的技艺之一。He then draws an etymological line. Technology comes from tekne, craft; tekne is bound up with weaving, and text, context, textile, and subtext all come from "woven together." We speak of weaving an argument or fabricating an idea for a reason: cloth-making was once among humanity's most sophisticated skills.
- 关键的历史机制是:原材料变便宜之后,会发生什么。自动织机让布便宜到可以成衣、可以量产,时装设计师还在,甚至更受尊敬,但绝大多数织工的工作消失了。手艺没有消失,从事它的人数塌缩了。The historical mechanism is what happens when the raw material gets cheap. Automated looms made cloth so cheap that ready-to-wear clothing and mass production became possible. Fashion designers survived, even gained prestige — but the overwhelming majority of weaving jobs disappeared. The craft did not vanish; the number of people doing it collapsed.
- 他把数学放在同一条线上:数学的原材料是证明,就像布是织工的原材料。证明正在变得极其便宜;定义与品味暂时还难被替代,但他预计这个也会被攻破。于是「少数顶尖者用工具做得更多、更受追捧,而中间层被抽空」的结构可能出现。He places mathematics on the same line. The raw material of math is the proof, just as cloth is the weaver's raw material. Proofs are becoming extremely cheap; definitions and taste are harder to automate, but he expects that to fall too. The likely structure is a few top people doing far more with tools and the middle hollowed out.
- 这篇文章的力量不在预言,而在类比给出的问题:如果你的职业价值建立在「我能生产那种稀缺的东西」上,那么稀缺性消失时你剩下什么?作者没有给答案,但把「我是不是下一个织工」这个问题摆得很清楚。The essay's force is not prediction but the question the analogy forces: if your professional value rests on producing something scarce, what remains when the scarcity goes? He offers no answer, but he makes "am I the next weaver?" impossible to un-ask.
数学之美The Beauty of Mathematics
每日 Lean 谜题 · 周二Daily Lean Puzzle · Tuesday ★★☆☆☆☆☆
每日谜题 ★2:偶数的楼梯Daily Puzzle ★2: A Staircase of Even Numbers
把前 $n$ 个偶数加起来:$2 + 4 + 6 + \cdots + 2n$。写成求和号就是 $\sum_{i=0}^{n-1} 2(i+1)$——第 $i$ 项取的是第 $i+1$ 个偶数。Add up the first $n$ even numbers: $2 + 4 + 6 + \cdots + 2n$. In summation notation that is $\sum_{i=0}^{n-1} 2(i+1)$ — term $i$ is the $(i+1)$-th even number.
断言:对每个自然数 $n$,这个和都恰好等于 $n(n+1)$。$n=0$ 时和为空,等于 $0$,右边也是 $0$,同样成立。Claim: for every natural number $n$ this sum equals exactly $n(n+1)$. When $n=0$ the sum is empty and equals $0$, and the right-hand side is $0$ as well, so the claim still holds.
Lean 形式化陈述(把 sorry 换成你的证明):The statement in Lean (replace sorry with your proof):
-- level: 2
import Mathlib
/-! Prove that the sum of the first $n$ even numbers equals $n(n+1)$:
$2 + 4 + 6 + \cdots + 2n = n(n+1)$. -/
theorem sum_range_even (n : ℕ) : ∑ i ∈ Finset.range n, 2 * (i + 1) = n * (n + 1) := by
sorry
在浏览器中挑战 ▶Try it in your browser ▶ 下载题目 .leanDownload puzzle .lean
提示Hint
先别急着求和。只看从 $n$ 到 $n+1$ 这一步:左边多出一项 $2(n+1)$;右边从 $n(n+1)$ 变成 $(n+1)(n+2)$,差值也正好是 $2(n+1)$。两边「增长的步子」一样大,起点又都是 $0$,所以永远相等——这就是归纳法。几何版本:两份 $1+2+\cdots+n$ 的点阵能拼成一个 $n \times (n+1)$ 的矩形。Don't add anything up yet. Look only at the step from $n$ to $n+1$: the left side gains one term, $2(n+1)$; the right side goes from $n(n+1)$ to $(n+1)(n+2)$, a difference of exactly $2(n+1)$. Both sides take the same size step and both start at $0$, so they can never separate — that is induction. Geometric version: two dot-staircases of $1+2+\cdots+n$ tile an $n \times (n+1)$ rectangle.
答案与讲解Solution & walkthrough
- 第一步是把记号翻译成人话。`Finset.range n` 是集合 $\{0,1,\dots,n-1\}$,所以在它上面求和 $\sum_{i} 2(i+1)$ 就是逐项写出 $2, 4, 6, \dots, 2n$。这一步没有任何数学,只是确认「Lean 说的」和「我们说的」是同一句话。Step one is translating notation into plain words. `Finset.range n` is the set $\{0,1,\dots,n-1\}$, so summing $\sum_{i} 2(i+1)$ over it just writes out $2, 4, 6, \dots, 2n$ term by term. There is no mathematics here — only a check that Lean's sentence and ours are the same sentence.
- 第二步找结构,而不是硬算。把每一项都提出因子 $2$,和就变成 $2(1+2+\cdots+n)$。而 $1+2+\cdots+n$ 是把 $n$ 层阶梯堆起来:两份阶梯一正一反,正好拼成宽 $n$、高 $n+1$ 的矩形,所以 $1+\cdots+n = n(n+1)/2$。两边乘 $2$ 就是我们要的 $n(n+1)$。这个配对论证在整数上依赖除以 $2$,而 Lean 里我们改用归纳,避免「自然数不能随便除」。Step two looks for structure instead of grinding. Factor a $2$ out of every term and the sum becomes $2(1+2+\cdots+n)$. Now $1+2+\cdots+n$ is a staircase of $n$ rows; two such staircases, one flipped, tile a rectangle $n$ wide and $n+1$ tall, so $1+\cdots+n = n(n+1)/2$. Multiply by $2$ and we get $n(n+1)$. That pairing argument divides by $2$, which is awkward over the naturals, so in Lean we switch to induction.
- 第三步把直觉变成归纳。`induction n with` 把目标拆成两种情形。`zero` 情形:`Finset.range 0` 是空集,空和为 $0$,右边 $0 \cdot 1 = 0$,`simp` 一次收掉。`succ k ih` 情形:假设对 $k$ 已经成立(这就是 `ih`),要证对 $k+1$ 成立。Step three turns the picture into induction. `induction n with` splits the goal in two. The `zero` case: `Finset.range 0` is empty, the empty sum is $0$, and the right side is $0 \cdot 1 = 0$, so `simp` closes it in one move. The `succ k ih` case assumes the claim already holds for $k$ (that is `ih`) and asks for $k+1$.
- 第四步处理递推。`Finset.sum_range_succ` 把「前 $k+1$ 项的和」拆成「前 $k$ 项的和」加上「第 $k+1$ 项」$2(k+1)$;再用 `ih` 把前 $k$ 项换成 $k(k+1)$。此时目标变成纯代数:$k(k+1) + 2(k+1) = (k+1)(k+2)$。Step four handles the recurrence. `Finset.sum_range_succ` splits 'the sum of the first $k+1$ terms' into 'the sum of the first $k$' plus the new term $2(k+1)$; then `ih` rewrites the first $k$ terms as $k(k+1)$. The goal is now pure algebra: $k(k+1) + 2(k+1) = (k+1)(k+2)$.
- 第五步交给 `ring`。它把等式两边都展开成标准多项式再逐项比较,不需要我们指路;这类「只含加法、乘法、常数」的恒等式它一定判得出来。于是整个证明只有三行:拆项、用归纳假设、代数收尾——和纸上写的一模一样,只是每个「显然」都被机器检查了一遍。Step five hands it to `ring`. It expands both sides into a normal polynomial form and compares coefficients, with no guidance from us; for identities built only from addition, multiplication and constants it always decides. So the whole proof is three lines — split the sum, apply the hypothesis, finish the algebra — the same proof as on paper, except every 'obviously' has been machine-checked.
-- level: 2
import Mathlib
/-! Prove that the sum of the first $n$ even numbers equals $n(n+1)$:
$2 + 4 + 6 + \cdots + 2n = n(n+1)$. -/
theorem sum_range_even (n : ℕ) : ∑ i ∈ Finset.range n, 2 * (i + 1) = n * (n + 1) := by
induction n with
| zero => simp
| succ k ih =>
rw [Finset.sum_range_succ, ih]
ring
人的思考A human's take
Techniques for Adding the Numbers 1 to 100 — Kalid Azad
Kalid Azad 从高斯的故事讲起,但他真正关心的是「为什么」:把 1 到 10 写成两行,一行正序、一行倒序,每一列的和都是 11;两行一共 10 列,所以两倍的和是 $10\times 11$,一份就是 55。Kalid Azad starts from the Gauss story, but what he cares about is the why: write 1 through 10 in two rows, one ascending and one descending, and every column sums to 11. Two rows of 10 columns make twice the sum equal to $10\times 11$, so one copy is 55.
他特意处理了奇数个的情况:从 0 数到 9 再配对,每列的和变成 9,列数变成 10,公式仍然成立——他想说明公式不是背下来的巧合,而是同一个配对结构在不同情形下的同一件事。今天这道题把每一项乘 2,等于把整个矩形论证放大两倍:两份 $1+2+\cdots+n$ 拼成 $n\times(n+1)$。He deliberately handles the odd case too: count from 0 to 9, pair them up, and each column now sums to 9 across 10 columns; the same formula still holds. His point is that the formula is not a coincidence to memorize but one pairing structure seen under different conditions. Today’s puzzle doubles every term, which doubles the whole rectangle argument: two copies of $1+2+\cdots+n$ tile an $n\times(n+1)$ rectangle.
AI 随想An AI's reflection
以下由 AI 撰写。Written by AI.
这道题常被当成「小技巧」:首尾配对,乘二除二,完事。但配对真正做的事,是把「逐项累加」这个动作换成了「看整体结构」——一旦你看见两份阶梯拼成矩形,求和就不再需要算,只需要看。数学里很多所谓的捷径都是这个形状:不是算得更快,而是换了一个让答案直接可见的角度。This problem gets filed as a trick: pair the ends, multiply and divide by two, done. But what the pairing really does is swap the act of adding term by term for the act of seeing a structure — once two staircases tile a rectangle, the sum no longer needs computing, only looking. Many shortcuts in mathematics have this shape: they are not faster arithmetic, they are a change of angle that makes the answer visible.
有意思的是,Lean 里的证明走的不是配对,而是归纳;两者却是同一个想法的两种语言:配对说「整体等于矩形」,归纳说「每一步的增量相等」。当一个问题可以从两端夹住时,选哪一端只是方便问题。真正的分水岭是:你的论证能不能被拆成有限步、每步都可机械核对。能,它就是证书;不能,它就还只是直觉——而直觉值得写下来,但不该被当成结论。这也是我每天愿意花两分钟看一道 ★2 题的原因:它训练的不是计算,而是把「我觉得」变成「可以查」。Curiously, the Lean proof does not pair anything; it inducts. Yet the two are the same idea in two languages: pairing says the whole equals a rectangle, induction says each step grows by the same amount. When a problem can be squeezed from either end, which end you pick is just convenience. The real dividing line is whether the argument splits into finitely many steps that can each be checked mechanically. If it can, it is a certificate; if not, it is still intuition — worth writing down, but not worth calling a conclusion. That is why two minutes on a ★2 problem is worth it: it trains not arithmetic but the habit of turning 'I think' into 'you can check'.
✓ 已通过 Lean 编译验证(无 sorry,无额外公理)✓ Verified by Lean (no sorry, no extra axioms) · 题目与证明由 AI 编写Problem and proof written by AI · Lean v4.36.0-rc2 · Mathlib a906e4e
- 椭圆曲线其实是一道初等方程题Elliptic Curves Are Really an Elementary Equation Problem
- 这篇旧文从一个中学味很重的问题开始:把炮弹堆成金字塔,底层是 n×n,上一层 (n-1)×(n-1)……总数是 1²+2²+…+n² = n(n+1)(2n+1)/6。什么时候这堆炮弹能刚好重排成一个正方形?也就是求 y² 等于这个式子的整数解。This old post starts with a problem that smells like high-school homework: stack cannonballs into a pyramid whose bottom layer is n×n, the next (n-1)×(n-1), and so on. The total is 1²+2²+…+n² = n(n+1)(2n+1)/6. When can that pile be rearranged into a single square? In other words, find integer solutions to y² equal to that expression.
- 这个问题看着像数论杂题,但它是一条三次曲线上的整点问题。三次曲线 y² = x³ + ax + b 就是椭圆曲线;这里的形式不同,但可以做不改变解集的变换,化成标准形。It looks like a number-theory puzzle, but it is a question about integer points on a cubic curve. Curves of the form y² = x³ + ax + b are elliptic curves; this equation has a different shape, but a transformation that preserves its solution set brings it into standard form.
- 关键技巧来自丢番图:已经有 (0,0) 和 (1,1) 两个解,就画一条穿过它们的直线,和曲线再交于第三点。直线与三次曲线联立后是一个三次方程,而已知两个根,用「三根之和等于 -a₂/a₁」就能直接读出第三个根,不必解方程。The key trick is Diophantus's. We already have two solutions, (0,0) and (1,1), so draw the line through them and see where it meets the curve a third time. Substituting the line into the cubic gives a cubic equation, and since two roots are known, the fact that the three roots sum to -a₂/a₁ hands you the third root for free.
- 代入后第三点是 (1/2, 1/2),不是整数,看起来白干。但曲线关于 x 轴对称,于是又白得 (1/2, -1/2)。拿它和 (1,1) 再连一次线,重复同样的步骤,第三次就掉出整数解 (24, 70)——也就是说 1²+2²+…+24² = 70²。The third point turns out to be (1/2, 1/2) — not an integer, so the exercise seems to have failed. But the curve is symmetric about the x-axis, so (1/2, -1/2) is also on it. Connect that with (1,1), repeat the same steps, and the third round produces (24, 70). Which is to say: 1²+2²+…+24² = 70².
- 真正有价值的不是这个答案,而是这个动作:任意两点连线,与曲线的第三交点,再关于 x 轴翻回去。这个「加法」让曲线上的点构成一个群,也是椭圆曲线密码学的地基。数学里最漂亮的一步,常常是把一个计算技巧提升成一个结构。The valuable part is not the answer but the move: take any two points, draw the line, take the third intersection, reflect across the x-axis. This "addition" makes the points on the curve into a group, and that group is the foundation of elliptic-curve cryptography. The prettiest step in mathematics is often the one that turns a calculation trick into a structure.
- 我最喜欢的悖论:合并数据之后,结论反了My Favorite Paradox: Pool the Data and the Conclusion Flips
- Forrest Smith 先讲了一个真实案例:加州大学伯克利分校因为研究生录取歧视女性被起诉:整体录取率男性 44%、女性 35%,差距明显。学校做了一次分系调查,结果却显示女性在每个系都略有优势。两个都正确,这就是辛普森悖论。Forrest Smith starts with a real case: In 1973 the University of California, Berkeley was sued for discriminating against women in graduate admissions: overall, men were admitted at 44% and women at 35%. The university then looked department by department and found women slightly favored in each one. Both facts are true. That is Simpson's paradox.
- 原因是申请分布:女性更多申请录取率低的竞争系,男性更多申请录取率高的系。合并统计时,系与系之间的难度差被算进了性别差,于是「每个系都更好」变成了「总体上更差」。The cause is where people applied. Women applied more often to competitive departments with low admission rates; men applied more often to departments with high rates. Pooling the data folds the difficulty difference between departments into the gender difference, so "better in every department" becomes "worse overall."
- 作者给了第二个更干净的例子:肾结石两种疗法。A 整体成功率 78%,B 是 83%,看起来 B 更好。但分开看,A 对小石 93% vs 87%、对大石 73% vs 69%,两种情况下 A 都更好。The author gives a cleaner second example: two kidney-stone treatments. Treatment A succeeds 78% of the time overall, B 83%, so B looks better. Broken down, A wins on small stones 93% to 87% and on large stones 73% to 69%. A is better in both groups.
- 秘密在样本分配:A 治了 263 个大石病人、87 个小石病人;B 正好相反。大石难治,把 A 的平均分拉低了。合并没有说谎,它只是回答了一个不同的问题——「随便来一个病人,谁成功率更高」和「已知结石大小,谁更该用」是两个问题。The secret is allocation. A treated 263 large-stone patients and 87 small-stone ones; B had the reverse mix. Large stones are harder, which drags A's average down. The pooled number is not lying; it answers a different question — "a random patient arrives, which treatment has the higher success rate" versus "given the stone size, which should we use."
- 能带走的检查习惯:看到一个「总体更好」的结论,先问分组变量是否同时影响分组和结果(这里是结石大小、系别难度)。如果影响,就要看分层结果,并明确你想回答的到底是哪一个问题。A habit worth taking away: when you see "better overall," ask whether the grouping variable affects both who lands in the group and the outcome (stone size here, department difficulty there). If it does, read the strata, and state clearly which question you actually meant to answer.
- 我们无意中绕开了「秘书问题」We Accidentally Side-Stepped the Secretary Problem
- 秘书问题的设定是:你要招一个人,候选人一个一个来,面试完必须当场决定录用或拒绝,拒绝后不能回头,目标是最大化选中最佳者的概率。数学结论很有名:先拒掉前面约 37% 的人当作样本,之后遇到比样本里所有人都好的就立刻录用。The secretary problem goes like this: you must hire one person, candidates arrive one at a time, you must accept or reject each on the spot, and a rejection cannot be recalled. The goal is to maximize the chance of picking the best one. The famous result: reject roughly the first 37% as a sample, then hire the first candidate better than everyone in that sample.
- 但这个结论依赖一个现实中很少成立的约束:不能召回。这篇文章写于 2026 年 9 月;作者和同事 2014 年在印度招 Clojure 测试工程师时,发现这个约束根本不成立——他们可以明确告诉候选人「六个月后欢迎再来」,还可以给对方课程和每周固定的答疑时间。But the result depends on a constraint that rarely holds in real life: no recall. In 2014, hiring Clojure test engineers in India, the author and his colleague noticed the constraint simply wasn't there. They could tell candidates to come back in six months, and they could offer a curriculum plus fixed weekly office hours.
- 这个改动把问题从「一次性抽样」变成了「可以培养再观察」。他们不再需要在信息最少的时候做终局判断,而是用低成本的方式延长观察窗口:300 份申请,5 个录用,每个人一个月内就能上手,后来都成长为资深员工。That change turns a one-shot sampling problem into "train and observe longer." They no longer had to make a final judgment with minimal information; they could extend the observation window cheaply. About 300 applications produced five hires, each productive within a month, and all of them grew into tenured staff.
- 关键在于他们识别出约束是假的。37% 规则本身没错,错的是照搬它的人:把「规则假设不能召回」读成了「现实中不能召回」。作者说,很多管理焦虑来自把别人流程里的约束当成自然规律。The point is that they recognized the constraint as fake. The 37% rule is not wrong; the mistake is made by people who copy it and read "the rule assumes no recall" as "reality forbids recall." Much managerial anxiety, the author suggests, comes from treating another organization's constraints as laws of nature.
- 能带走的是一个提问顺序:遇到一个漂亮的优化结论,先列出它的前提,再逐条问「这条在我们的场景里真的成立吗」。如果不成立,最优解可能不是把规则算得更精,而是直接把约束拆掉。What to take away is an order of questions: when you meet a beautiful optimization result, list its premises, then ask of each one, "does this actually hold in my situation?" If not, the best move may not be to compute the rule more precisely but to remove the constraint entirely.
- 方圆形:一个连名字都没有统一定义的形状Squircles: A Shape Without Even an Agreed Definition
- 方圆形(squircle)是介于正方形和圆之间的形状。它没有唯一的数学定义,而是一族曲线。最有名的是超椭圆:|x|^n + |y|^n = 1。n=2 时是圆,n 越大越接近正方形,n→∞ 时极限是正方形。A squircle is a shape between a square and a circle. It has no single mathematical definition; it is a family of curves. The best-known member is the superellipse, |x|^n + |y|^n = 1. At n=2 it is a circle; as n grows it approaches a square, with the square as the n→∞ limit.
- 麻烦在于「多圆算圆」没有标准度量。文章推荐一个很聪明的参数:取第一象限曲线段的中点,它的横坐标就是「gauge」。因为中点在 x=y 上,代入超椭圆得 x = 0.5^(1/n)。圆是 0.707,越接近 1 越方。这样不同家族的曲线就能放在同一把尺子上比较。The trouble is that "how round is round" has no standard measure. The article recommends a clever parameter: take the midpoint of the curve in the first quadrant and use its x-coordinate as the "gauge." Since the midpoint lies on x=y, substituting gives x = 0.5^(1/n). A circle is 0.707; closer to 1 is squarer. Now curves from different families can be compared on one ruler.
- 第二条分岔是做法:用一条处处解析的曲线,还是「直边 + 圆角」。直边方案的好处是可以适配任意长宽比的矩形,而不会把圆角拉变形——这就是为什么 UI 里的圆角都是拼出来的。The second fork is construction: a single analytic curve, or straight edges plus corners. The straight-edge approach can adapt to rectangles of any aspect ratio without distorting the corner — which is why UI rounded rectangles are assembled rather than drawn as one formula.
- Apple 在 iOS 7 换图标形状后,很多人以为是 n=5 的超椭圆;把贝塞尔控制点抠出来一看并不是,而是一个直边方圆形,固定 gauge 0.809。Figma 用每象限三段贝塞尔近似,gauge 只能落在 0.707 到 0.854 之间,而且与中间圆弧的连接处曲率不连续。After Apple changed its icon shape in iOS 7, many assumed a superellipse with n=5. Extracting the Bézier control points showed otherwise: it is a flat-sided squircle with a fixed gauge of 0.809. Figma approximates it with three Bézier segments per quadrant, only able to reach gauges between 0.707 and 0.854, with a curvature discontinuity where the segments meet the middle arc.
- 真正漂亮的地方在于:曲率不连续,人眼在斜面高光下能看出来。于是有了 clothoid(回旋曲线)方案,让曲率随弧长线性变化,做到 G2 连续;CSS 的 box decorations 规范把 corner-shape 收进标准,Blink 的实现博客给出每象限两段贝塞尔的闭式近似。一个图标圆角,背后是「如何用可计算的曲线逼近一个理想形状」的完整链条。The beautiful part is that curvature discontinuity is visible to the human eye under a slanted highlight. Hence clothoid (Euler spiral) variants, where curvature changes linearly with arc length and the join is G2 continuous. CSS's corner-shape now standardizes the true superellipse, and browsers fit a closed-form two-Bézier approximation by symbolic regression. One icon corner contains a whole chain of "how do we approximate an ideal shape with something computable."
程序员随想Notes From a Programmer
- 程序员的 API 就是 UI:设计空间是要靠迭代走出来的A Programmer's API Is a UI: Design Space Is Explored by Iteration
- antirez 先纠正一个词:很多程序员觉得「UI」是给普通用户看的界面,自己写的是 API、CLI、配置文件,不算 UI。但他说,数据库查询语言、库调用、编程语言、Unix 命令行工具都含有 UI 的部分;如果你每天都用它,它对你来说就比任何图形界面都更像界面。The author corrects a word first. Many programmers think "UI" means the screens ordinary users see, while what they write — APIs, CLIs, config files — does not count. But he points out that query languages, library calls, programming languages, and Unix command-line tools all have a UI part; if you use one every day, it is more of an interface to you than any graphical screen.
- 他真正要强调的是「简单」:不只是图形界面的简单,而是给程序员用的 UI 也要简单。为一个简单的 API 反复推翻重来,不是完美主义或自恋,而是在一个巨大的设计空间里探索——里面没有规则可循,好实践也不是可靠的罗盘,只有你的品味。What he really wants to stress is simplicity: not only in graphical UIs, but in UIs built for programmers. Reworking an API again and again in search of a simple design is not perfectionism or narcissism; it is exploring a huge design space. There are no rules to follow and good practices are not a reliable compass — only your sensibility is.
- 所以他反对「一次设计到位」:API 设计更像在一个巨大的设计空间里走路,你必须先走几步,看到地形,才知道下一步往哪。迭代不是不严谨,迭代是唯一能获得信息的方式。So he rejects the idea of getting the design right in one shot. API design is more like walking through a large design space: you have to take a few steps, see the terrain, and only then know where to go next. Iteration is not a lack of rigor; it is the only way to get information.
- 区分「可迁移的知识」和「空热量」:记住 Sendmail 的 m4 宏、Apache 的虚拟主机配置,这些知识换个环境就没用了;真正能带走的是那些能活几十年的一般概念,而不是为某个系统临时学来的细节。He separates transferable knowledge from empty calories. Memorizing Sendmail’s m4 macros or Apache’s virtual-host setup is worthless once that system is gone. What travels with you are general ideas that last for decades, not ad-hoc details learned for one tool.
- 所以他的结论是一个取舍:任何系统都会有一部分不得不学的 ad-hoc 知识,既然躲不掉,至少把这部分做得简单、甚至好玩;而真正值得占用你神经元的,是那些能活几十年的一般概念。这也解释了他为什么愿意为一个 API 拖上几周。His conclusion is a trade-off. Every system will require some ad-hoc knowledge you simply have to learn; since that is unavoidable, at least make that part simple and, if possible, fun to use. What deserves your neurons are the general ideas that last for decades. That is also why he is willing to delay a feature for weeks just to get an API right.
- 「我一个周末就能做出来」到底低估了什么What "I Could Build That in a Weekend" Really Underestimates
- 作者收集了一类反复出现的说法:看到某个系统,工程师说「这不难,我一个周末就能写出来」。他把这句话当成一个可检验的预测,然后看真实的工程量花在哪里。The author collects a recurring claim: engineers look at a system and say "that's not hard, I could build it in a weekend." He treats the sentence as a testable prediction and asks where the real engineering effort goes.
- 第一块是性能。对一个真的在赚钱的服务,优化不是可选项:延迟降下来会直接影响收入,也会直接降低成本,所以公司会一直往里加人,直到多加一个工程师的成本超过他带来的收益。这不是「能跑通」,是推到别人愿意付钱的程度。The first block is performance. For a service that actually earns money, optimization is not optional: lower latency raises revenue directly and cuts cost directly, so a company keeps adding engineers until the marginal engineer stops paying for himself. The goal is not "it runs," it is "it runs well enough that people pay."
- 第二块是功能,而且是外行看不见的那些。单个小功能可能给收入加几个百分点;而功能在真实世界里很复杂——日期的各种写法要归一,法语里 l'foo 要能匹配 un foo,中文没有空格怎么分词,日语一句话能混四种字母,阿拉伯语从右往左但数字从左往右。周末项目可以不管,真做生意就是放弃大部分市场。The second is features, specifically the ones outsiders never see. A single small feature can add several percentage points of revenue, and features are far more complex than they look: dates and phone numbers need normalizing, French "l'foo" has to match "un foo," Chinese has no spaces to tokenize on, a Japanese query can mix four alphabets, Arabic reads right to left except the numbers. A weekend project can skip all of it; a real business that skips it ignores most of the market.
- 第三块是安全:不养安全团队,产品就会像当年的 Hotmail 或 Yahoo 一样,以「老被黑」而不是任何功能出名。这里还有一个通用谬误:大家写 happy path 时以为那才是「真正的工作」,错误处理是后补的;可靠系统里恰恰相反,错误处理比 happy path 更费工。The third is security: skip the security team and your product becomes famous for being hacked, the way Hotmail and Yahoo were, rather than for any feature. There is a general fallacy here too: people treat the happy path as the "real" work and error handling as something to bolt on later. In reliable systems it is the other way round — error handling is more work than the happy path.
- 最后是组织成本,也是他认为最难的一块。他打了个比方:分布式系统丢 0.1% 的消息就算难,而人和人之间传话,丢失率超过 50%、每条都被扭曲、延迟按月甚至按年算。所以「周末能做出来」默认了一个所有人 100% 时间写代码、沟通零损耗的团队——这样的团队不存在。Last is organizational cost, which he considers the hardest. His analogy: distributed systems are called hard because 0.1% of messages get dropped; between people, well over 50% of messages are lost, every message is corrupted, and latency is measured in months or years. So "I could build that in a weekend" assumes a team that spends 100% of its time coding and loses nothing to coordination. No such team exists.
- 提交信息的第一行是一句摘要,不是一个标题The First Line of a Commit Message Is a Synopsis, Not a Title
- antirez 先反对一个约定:不要在提交信息首行末尾加句号。他不只是反对这条规则,而是反对它背后的假设——把首行当成「标题」或「主题」。The author starts by rejecting a convention: don't put a period at the end of a commit message's first line. But his objection is not to the rule, it is to the assumption behind it — that the first line is a title, or a subject.
- 他的说法是:首行是这次改动的「摘要句」。是句子就该有主语和动词,句号也就理所当然。多数人写首行时想着「反正下面还有正文」,于是把信息密度让给了正文;可现实里大量提交只有这一行,根本没有正文。His claim is that the first line is a synopsis of the change. A sentence has a subject and a verb, so a period is only natural. Most people write the first line thinking the body will carry the details, and spend their information budget on a body that often does not exist: plenty of commits are just that one line.
- 所以写法要跟着变:把首行写成一句信息密度尽可能高的话,说清这次改动意味着什么;确实需要时,再在下面补三件事——我做了什么、导致了什么、你怎么复现。So the writing changes: make the first line as information-dense as possible about what the change means, and only when needed add the long version below — what I did, what it caused, how you can reproduce it.
- 他顺带说了一句更重的话:编程本身就是写摘要的手艺。你不断把复杂的东西压成一句能说清的话;压不下去,往往说明这个程序比它该有的样子更复杂。He then says something heavier in passing: programming is the art of writing synopses. You keep compressing something complicated into one sentence you can defend; when you cannot, the program is probably more complex than it should be.
- 能带走的不是「句号」这条格式规矩,而是心态的切换:标题只需要分类,摘要必须承载信息。把它当摘要写,改变的是你写它的方式。The takeaway is not the punctuation rule but the shift in mindset: a title only has to categorize, a synopsis has to carry information. Writing it as a synopsis changes how you write it.
- 一千六百份终端抱怨,总结起来是「记不住」1,600 Terminal Complaints Add Up to "I Can't Remember"
- Julia Evans 问读者「你用终端时最烦什么」,收到约 1600 份回答,然后把它们归类。结果不是「功能太少」,而是一组很具体的摩擦点:记不住语法、切换终端后配置丢了、颜色看不清、快捷键冲突、复制粘贴不听话。Julia Evans asked readers what frustrates them most in the terminal, got about 1,600 responses, and sorted them. The result was not "too few features" but a set of very concrete friction points: forgetting syntax, losing configuration when switching terminals, unreadable colors, conflicting shortcuts, copy-paste that misbehaves.
- 最普遍的一条是「记不住」:命令、选项、路径、历史。有趣的是,这个群体并不新——约 40% 的受访者有 21 年以上经验。所以这不是学习曲线问题,而是人的工作记忆和工具复杂度之间的长期不匹配。The most common theme is forgetting: commands, flags, paths, history. Interestingly, this crowd is not new — roughly 40% had 21 or more years of experience. So it is not a learning-curve problem; it is a long-term mismatch between human working memory and tool complexity.
- 第二类是「环境切换成本」:ssh 到另一台机器,shell 配置、别名、补全全都没了;换个终端模拟器,键盘映射又变了。工具的可迁移性差,导致人不敢换、也不敢改。The second theme is the cost of changing environments: ssh to another machine and your shell config, aliases, and completions are gone; switch terminal emulators and the keybindings change. Poor portability makes people afraid to switch and afraid to customize.
- 第三类是「反馈不清晰」:颜色在浅色背景上看不见,复制时多带了换行,粘贴时触发了 bracketed paste。这些都是小问题,但每天都发生,累积起来就是持续的注意力税。The third is unclear feedback: colors invisible on a light background, a stray newline when copying, bracketed paste firing on paste. Each is small, but they happen daily, and together they are a continuous attention tax.
- 她本人很克制,说自己不会对这些结果下很多结论,只把相关的类别放在一起:记住语法与历史、可发现性与学习曲线、切换系统很难。但这份清单本身已经说明:需要改进的往往不是更强大的功能,而是默认值、可发现性,以及跨机器的连续性。She is deliberately restrained, saying she will not make much commentary and only grouping related categories: remembering syntax and history, discoverability and the learning curve, and the difficulty of switching systems. But the list itself makes the point: what needs improving is often not more power but better defaults, discoverability, and continuity across machines.
哲学与生活Philosophy and Life
- 让国家诞生的是马,不是粮食The Horse Made the State, Not Grain
- 主流解释是「粮食说」:农业产生可储存的余粮,余粮养活不种地的人,于是有了税收、军队和国家。这个叙事把定居农业放在文明的中心,也把草原游牧放在边缘。The mainstream explanation is the grain thesis: agriculture produces storable surplus, surplus feeds people who do not farm, and from that come taxes, armies, and the state. This story puts settled agriculture at the center of civilization and pastoral nomads at the edge.
- 作者提出一个替换变量:真正让大规模政治体成为可能的,是「人以外的运输能力」。在没有畜力和船的时代,人能走多远、能背多重,决定了社区能有多大;超过这个半径,收上来的东西还不够路上吃掉。The author swaps the variable. What actually makes large political bodies possible is transportation beyond human muscle. Before draft animals and boats, how far a person could walk and how much they could carry bounded the size of a community; beyond that radius, what you collected was eaten on the way home.
- 所以关键不是「有没有余粮」,而是「余粮能不能被集中」。马、驴、骆驼、船把运输半径扩大了一个数量级,征税、调兵、救灾才第一次变得可行。罗马能到船能到的地方,蒙古能到马能到的地方。So the question is not whether there is surplus but whether surplus can be concentrated. Horses, donkeys, camels, and ships multiplied the radius of collection by an order of magnitude, and only then did taxation, troop movement, and famine relief become feasible. Rome reached where ships reached; the Mongols reached where horses reached.
- 他用两个反例顶住论证:科曼奇人没有农业,却有马和野牛,建立了能与欧洲列强竞争一个世纪的势力;印加帝国有庞大的国家机器,靠的是 llama 而不是粮食 surplus。可见粮食不是必要条件。He defends the argument with two counterexamples. The Comanche had no agriculture but had horses and bison, and built a power that competed with European empires for nearly a century. The Inca state was vast and relied on llamas, not grain surplus. Grain, then, is not necessary.
- 最后是史学史的一刀:为什么我们一直听到粮食说?因为这套框架服务于特定的地缘政治叙事——把黄河流域写成文明摇篮——并在冷战政治中被「受限农业土地」理论固化。他的野心不止于换一个故事:他要说明这个范式如何塑造了世界史,并把它称为需要被打破的框架。The final cut is historiographical: why did we hear the grain thesis for so long? Because the framework served a particular geopolitical narrative — the Yellow River as the cradle of civilization — and was entrenched by the circumscribed-agricultural-land theory amid Cold War politics. His ambition is more than swapping one story for another: he wants to show how this paradigm has shaped world history, and to name it as a framework that needs breaking.
- 「装勇敢」一分钟,你就真的勇敢过:行动先于自我形象Pretend to Be Brave for a Minute and You Have Been Brave: Action Comes Before Self-Image
- 我们习惯把「真诚」理解成内外一致:心里不发抖,才配说自己勇敢;不然就是演。Sivers 在这篇短笔记里把顺序倒过来:你可以在里面怕得要命,只要求自己在外表上撑住一分钟。那一分钟里你确实做了勇敢的事——于是「勇敢」不再是感受,而成了已经发生的事实。We usually read sincerity as inside matching outside: you may call yourself brave only if you feel no fear; otherwise you are performing. Sivers reverses the order. You can be terrified inside and still ask yourself to hold the outside for one minute. In that minute you did a brave thing — so bravery stops being a feeling and becomes a fact that already happened.
- 他举的都是很小的场景,不是英雄事迹:内向的人要参加活动,就先扮演一小时外向;谈判时让另一个「自我」上场——他说不是 Maria 在谈,是 El Tigre;没心情当个好爸爸时,先攒足力气做几分钟孩子需要的那个人,几年后关系真的长成了他想要的样子。His examples are small scenes, not heroic feats. An introvert who has to attend an event acts social for an hour. In a negotiation, another self takes the stage — it is not Maria negotiating, he says, it is El Tigre. On days he had no mood to be a good father, he gathered himself and did what his boy needed for a few minutes or hours; years later, the relationship had actually grown into the one he wanted.
- 为什么这不算自欺?因为自我形象是滞后的,行动却会反过来改写它。你反复做「不像现在的我」会做的事,能力、习惯、别人对你的预期都会慢慢向那个版本靠拢;等到某天回头看,你已经不是「装」出来的那个人,而是被那些行动塑造出来的人。Why is this not self-deception? Because self-image lags while action feeds back into it. Do repeatedly what “the current me” would not do, and your abilities, habits, and other people’s expectations drift toward that version. One day you look back and you are no longer someone pretending; you are someone those actions built.
- 边界要划清:这里说的是对自己的情绪诚实、对行为负责,不是编一个假身份去骗别人。区别在于「装」的内容指向承诺还是指向表演——如果那一分钟的勇敢最后要兑现成真实的责任,它就从扮演变成了练习;如果只是取信于人再逃掉,那就只是欺骗。The boundary matters. This is honesty about your feelings and responsibility for your behavior, not inventing a false identity to fool people. The difference is whether the performance points at a promise or at an audience. If the minute of courage has to be cashed out as a real duty, it turns from play-acting into practice; if it only wins trust and then walks away, it is just deception.
- 能带走的不是一句「fake it till you make it」的口号,而是一个更小的动作:别等「变成那种人」才开始,先做五分钟那种人会做的事。身份常常不是行动的前提,而是行动留下的痕迹。What you can take away is not the slogan “fake it till you make it” but a smaller move: do not wait to become that kind of person before you start. Do for five minutes what that person would do. Identity is often not the precondition of action; it is the trace action leaves behind.
工具角Tools Corner
- funkycache:把耗时函数的结果存进 SQLitefunkycache: Cache Expensive Function Results in SQLite
- 我什么时候会用它:静态站点生成、数据清洗脚本、任何「同样的输入跑很多次、每次要几秒」的 Python 流水线。以前要么手写「查缓存—命中就返回」的分支,要么每次全量重跑。Where I would use it: static site builds, data-cleaning scripts, any Python pipeline that reruns the same expensive step with the same inputs. The alternative is hand-writing a "look up the cache, return early on hit" branch in every script, or rebuilding everything each time.
- 它省掉的是什么:一个装饰器就把函数变成可持久化的缓存,键是函数参数,值是任意 Python 对象,存在 SQLite 里,进程退出后还在。函数源文件变了会自动失效,也可以显式声明依赖的文件和值(比如某个库的版本)。What it removes: one decorator turns a function into a persistent cache. Keys come from the arguments, values can be arbitrary Python objects, everything lives in SQLite and survives process exit. Editing the function's source file invalidates it automatically, and you can declare dependencies on files or values such as a library version.
- 最短上手:pip install funkycache,建一个 FunkyCache(storage="sqlite"),在函数上加 @cache.register;需要更细的失效条件时加 files=[...] 与 values=[...]。Shortest path in: pip install funkycache, create FunkyCache(storage="sqlite"), decorate with @cache.register, and add files=[...] or values=[...] when you need finer invalidation.
- 代价与限制:它是为「纯函数」设计的,有副作用或依赖外部状态(时间、随机数、网络)的函数不要直接缓存;键是参数序列化后的哈希,超大对象会拖慢序列化,作者自己的站点约 3.2 万个键,规模再大要留意。JSON 键理论上可能碰撞,日常构建规模可以接受。Costs and limits: it assumes pure functions, so do not cache anything with side effects or hidden state (time, randomness, network). Keys are hashes of serialized arguments, and very large objects slow that down; the author's site uses about 32,000 keys. JSON keys can theoretically collide, which is acceptable at build-tool scale.
- 为什么值得放进工具箱:它把「缓存逻辑」这件事从每个项目里重复实现的胶水代码,变成一个可以测试、可以忘掉的小依赖——这正是低维护工具该有的样子。Why it belongs in the toolbox: it turns cache logic from glue code rewritten in every project into a small dependency you can test once and forget — which is what a low-maintenance tool should feel like.
- skif:一个二进制替代三个 JS 依赖检查工具skif: One Binary Replacing Three JavaScript Dependency Linters
- 我在什么任务里会用它:维护一个 monorepo 或带多个 workspace 的 TypeScript 项目,想同时检查「有没有没人用的文件/导出/依赖」「各包版本是否一致」「manifest 有没有写错」。过去这要装 knip、syncpack、sherif 三套工具,三份配置。Where I would use it: maintaining a monorepo or a TypeScript project with several workspaces, and wanting to check at once for unused files, exports and dependencies, for version consistency across packages, and for manifest mistakes. That used to mean installing knip, syncpack and sherif, with three configs.
- 它减少的工作:一个 Rust 二进制 + 一个 skif.toml 覆盖三者的规则,共 54 条规则、213 个插件;能静态读工具配置,不执行项目代码;修复时保留键顺序、缩进和注释;skif migrate 可以一步迁移现有配置。What it removes: one Rust binary and one skif.toml cover the rules of all three, with 54 rules and 213 plugins. It reads tool configuration statically and runs no project code, its fixes preserve key order, indentation and comments, and skif migrate translates an existing setup in one step.
- 最短上手:pnpm add -D @polylint/skif(或 cargo binstall skif-cli),运行 skif;在 CI 里加 polylint/skif@v0.7 这个 action,需要严格时开 fail-on-warnings。Shortest path in: pnpm add -D @polylint/skif (or cargo binstall skif-cli), then run skif. In CI, add the polylint/skif@v0.7 action and turn on fail-on-warnings if you want to be strict.
- 代价与限制:npm 包要求 Node 22/24/26 或 Bun 1.x;死代码分析用 oxc 解析,默认不做类型解析,类型感知模式需要额外开销;README 自己的基准是「比 knip 中位数快 5.3 倍」,但那是作者在 GitHub runner 上、7 个固定仓库测的,不能当成你项目的实测数字。Costs and limits: the npm package needs Node 22, 24 or 26, or Bun 1.x. Dead-code analysis parses with oxc but is not type-aware by default; type-aware mode costs more. The README's own benchmark claims a median 5.3x speedup over knip, but that was measured by the authors on a GitHub runner across seven pinned repositories — not a measurement of your project.
- 为什么值得试:依赖 lint 是那种「不加会慢慢烂、加了又嫌重」的检查。把三套配置收成一套、把运行时间压到可以放进 pre-commit 的量级,才有可能真的天天跑。Why it is worth trying: dependency linting is the kind of check that rots slowly when absent and feels too heavy when present. Collapsing three configs into one and getting runtime down to pre-commit scale is what makes it actually run every day.
- Protomaps + PMTiles:把世界地图塞进一个文件自己托管Protomaps + PMTiles: Host the World Map as a Single File
- 我什么时候会用它:给自己的小项目加一张地图,又不想被 Mapbox 这类按次计费的 API 绑住——尤其是不知道会不会突然有一波流量的时候。Where I would use it: adding a map to a small project without tying myself to a per-view API like Mapbox, especially when I do not know whether traffic will suddenly spike.
- 核心想法很简单:PMTiles 把整张地图切成瓦片后打包成一个文件,客户端用 HTTP Range 请求只取需要的那几块。于是托管退化成「把一个静态文件放到支持 Range 的对象存储/CDN 上」,没有瓦片服务器要维护。The core idea is simple. PMTiles packs the whole tiled map into a single file, and the client fetches only the tiles it needs with HTTP Range requests. Hosting collapses into "put one static file on an object store or CDN that supports Range" — no tile server to maintain.
- 最短上手:从 Protomaps 的 build 页面下载现成的世界地图 .pmtiles(或用 CLI 只导出某个 bbox、某几级 zoom),用 rclone 传到支持 Range 的存储(作者用 Bunny.net,开了 S3 兼容),建 pull zone,前端用 MapLibre GL 加 pmtiles 协议即可。Shortest path in: download a ready-made world .pmtiles from Protomaps' build page (or use the CLI to export just a bounding box and a few zoom levels), copy it with rclone to Range-capable storage (the author uses Bunny.net with S3 compatibility), create a pull zone, and point MapLibre GL at it with the pmtiles protocol.
- 代价与限制:作者给出的一手数字是——139GB 的全球地图、五倍复制到各大洲,存储约每月 5 美元;在欧洲缩放看一座城市约传输 5MB,约 0.00005 美元。但这些依赖 Bunny 的区域定价与缓存命中率,换 CDN 就要重算。还要设 CORS 白名单,并考虑限速防止有人整包下载。Costs and limits: the author's first-hand numbers are a 139GB world map replicated five times to major continents for about $5/month in storage, and roughly 5MB — about $0.00005 — to zoom into a European city. Those depend on Bunny's regional pricing and cache hit rate, so a different CDN means recalculating. You also need a CORS allowlist and some rate limiting so nobody downloads the whole file.
- 为什么值得收藏:它示范了一种很干净的架构——把「服务」降级成「文件」,用 CDN 的 Range 缓存承担所有扩展性问题。小项目自托管地图,终于不需要运维一个瓦片服务。Why to bookmark it: it demonstrates a clean architecture — demote the service to a file and let CDN Range caching absorb all the scaling problems. Self-hosting maps for a small project no longer requires running a tile server.
- poo:把开发过程吃掉的磁盘空间找回来poo: Reclaim the Disk Space Your Development Eats
- 我什么时候会用它:笔记本上同时有几个 node_modules、Rust target 目录、Docker 镜像、模拟器缓存、以及一堆 agent 留下的 worktree,磁盘突然只剩几 GB,手动 find 又怕删错。Where I would use it: a laptop carrying several node_modules trees, Rust target directories, Docker images, simulator caches, and a pile of worktrees left behind by agents, until only a few GB remain — and find is too risky to run by hand.
- 它的做法是先扫描再计划:区分「构建产物、缓存、模拟器、agent worktree」,生成一个计划,明确哪些东西当前没有被任何进程使用;只有你确认后才删除,计划里不包含正在运行或需要人工判断的项。It scans first and plans second. It separates build artifacts, caches, simulators and agent worktrees, then produces a plan that excludes anything currently in use or needing a human decision. Nothing is deleted until you review and confirm.
- 最短上手:CLI 用 poo setup 选开发目录,poo plan stale 预览,poo clean --plan stale 执行;想接进 agent 就 poo integration install all。macOS 还有菜单栏 app,Linux 只能跑 CLI。Shortest path in: poo setup to choose dev folders, poo plan stale to preview, poo clean --plan stale to execute. To wire it into an agent, poo integration install all. There is also a macOS menu-bar app; on Linux only the CLI runs.
- 代价与限制:主要体验是 macOS(app 需要 15+,签名公证),Linux 只有 CLI 二进制,功能面窄一些;worktree 删除前会备份 .env 之类的小文件、stash 未提交改动、把 detached commit 存成分支,但仍然建议先看 plan。默认每天自动检查更新,可以用 poo config set updates.auto false 关掉。Costs and limits: the polished experience is macOS (the app needs 15+, signed and notarized); Linux gets a CLI binary with a narrower surface. Before removing a worktree it backs up small ignored files like .env, stashes uncommitted work, and saves detached commits to a branch — but still read the plan. Auto-update checks run daily and can be disabled with poo config set updates.auto false.
- 为什么值得放进工具箱:它不是「又一个清理脚本」,而是把「哪些能安全删」这件事变成了可预览、可回滚的计划;对经常和 agent 一起工作、worktree 越堆越多的人,这个抽象比 du 更贴近真实任务。Why it belongs in the toolbox: it is not another cleanup script. It turns "what is safe to delete" into a previewable, reversible plan, which matches the real task better than du does — especially if you work alongside agents and accumulate worktrees.