<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh_CN">
  <title>ATMxsp01</title>
  <subtitle>Here&apos;s the way to the stars...</subtitle>
  <link href="https://atmxsp01.github.io/" rel="alternate" type="text/html"/>
  <link href="https://atmxsp01.github.io/atom.xml" rel="self" type="application/atom+xml"/>
  <id>https://atmxsp01.github.io/</id>
  <updated>2026-09-19T00:00:00.000Z</updated>
  <entry>
    <title>test</title>
    <link href="https://atmxsp01.github.io/posts/test/" rel="alternate" type="text/html"/>
    <id>https://atmxsp01.github.io/posts/test/</id>
    <published>2026-09-19T00:00:00.000Z</published>
    <updated>2026-09-19T00:00:00.000Z</updated>
    <summary></summary>
    <content type="html"><![CDATA[<p>这是我的第一篇手写博客， 使用 neovim + 自己定制的 blog 插件完成所有的操作。</p>
<p><img src="./images/img-20260919-174902.png" alt="test-pic1" /></p>
]]></content>
    <author><name>ATMxsp01</name></author>
  </entry>
  <entry>
    <title>代码主题预览（临时页）</title>
    <link href="https://atmxsp01.github.io/posts/code-theme-demo/" rel="alternate" type="text/html"/>
    <id>https://atmxsp01.github.io/posts/code-theme-demo/</id>
    <published>2026-09-10T00:00:00.000Z</published>
    <updated>2026-09-10T00:00:00.000Z</updated>
    <summary>临时页面：用于查看 Nord 代码主题在 Python / C++ / Rust / Bash / Lean4 下的实际渲染效果，看完即删。</summary>
    <content type="html"><![CDATA[<blockquote>
<p>⚠️ <strong>这是一个临时页面</strong>，只为预览代码块主题（暗色 = Nord）。看完就会删除。</p>
<p>站点默认跟随系统明暗；想对比两套配色，点右上角的明暗切换按钮。</p>
</blockquote>
<h2>1. Python</h2>
<pre><code>from dataclasses import dataclass
from typing import Iterable

import torch


@dataclass(frozen=True)
class Sample:
    """一条训练样本。"""
    text: str
    label: int


def batchify(samples: Iterable[Sample], size: int = 32) -&gt; list[list[Sample]]:
    batch: list[Sample] = []
    for item in samples:
        batch.append(item)
        if len(batch) == size:      # 满一批就吐出
            yield batch
            batch = []
    if batch:
        yield batch


if __name__ == "__main__":
    total = sum(1 for _ in batchify([Sample(f"x{i}", i % 2) for i in range(100)]))
    print(f"batches = {total}, cuda = {torch.cuda.is_available()}")
</code></pre>
<h2>2. C++</h2>
<pre><code>#include &lt;algorithm&gt;
#include &lt;iostream&gt;
#include &lt;queue&gt;
#include &lt;vector&gt;

namespace graph {

template &lt;typename T&gt;
class BFS {
public:
    explicit BFS(const std::vector&lt;std::vector&lt;int&gt;&gt;&amp; adj) : adj_(adj) {}

    std::vector&lt;int&gt; run(int src) const {
        std::vector&lt;int&gt; dist(adj_.size(), -1);
        std::queue&lt;int&gt; q;
        dist[src] = 0;
        q.push(src);
        while (!q.empty()) {
            const int u = q.front();
            q.pop();
            for (const int v : adj_[u]) {
                if (dist[v] == -1) {          // 未访问
                    dist[v] = dist[u] + 1;
                    q.push(v);
                }
            }
        }
        return dist;
    }

private:
    const std::vector&lt;std::vector&lt;int&gt;&gt;&amp; adj_;
};

}  // namespace graph

int main() {
    const std::vector&lt;std::vector&lt;int&gt;&gt; adj{{1, 2}, {3}, {3}, {}};
    const auto dist = graph::BFS&lt;int&gt;(adj).run(0);
    for (std::size_t i = 0; i &lt; dist.size(); ++i)
        std::cout &lt;&lt; "dist[" &lt;&lt; i &lt;&lt; "] = " &lt;&lt; dist[i] &lt;&lt; '\n';
    return 0;
}
</code></pre>
<h2>3. Rust</h2>
<pre><code>use std::collections::HashMap;
use std::hash::Hash;

#[derive(Debug, Default)]
pub struct LruCache&lt;K, V&gt; {
    map: HashMap&lt;K, V&gt;,
    capacity: usize,
    hits: u64,
}

impl&lt;K: Eq + Hash + Clone, V: Clone&gt; LruCache&lt;K, V&gt; {
    pub fn new(capacity: usize) -&gt; Self {
        assert!(capacity &gt; 0, "capacity must be positive");
        Self { map: HashMap::new(), capacity, hits: 0 }
    }

    pub fn get(&amp;mut self, key: &amp;K) -&gt; Option&lt;&amp;V&gt; {
        match self.map.get(key) {
            Some(value) =&gt; {
                self.hits += 1;
                Some(value)
            }
            None =&gt; None,
        }
    }

    pub fn insert(&amp;mut self, key: K, value: V) -&gt; Result&lt;(), String&gt; {
        if self.map.len() &gt;= self.capacity &amp;&amp; !self.map.contains_key(&amp;key) {
            return Err(format!("cache full: {} entries", self.capacity));
        }
        self.map.insert(key, value);
        Ok(())
    }

    pub fn hit_rate(&amp;self) -&gt; f64 {
        if self.map.is_empty() { 0.0 } else { self.hits as f64 / self.map.len() as f64 }
    }
}
</code></pre>
<h2>4. Bash</h2>
<pre><code>#!/usr/bin/env bash
set -euo pipefail

REPO="${1:-ATMxsp01/blog-content}"
BRANCH="${BRANCH:-main}"

echo "==&gt; 同步 $REPO ($BRANCH)"
if ! git -C "$REPO" diff --quiet; then
    echo "工作树不干净，先提交" &gt;&amp;2
    exit 1
fi

for step in sync validate build; do
    printf '  -&gt; %s ... ' "$step"
    pnpm "content:$step" &gt;/dev/null 2&gt;&amp;1 &amp;&amp; echo "ok" || { echo "failed"; exit 1; }
done

# 统计产物
find dist -name '*.html' | wc -l | xargs printf 'pages: %s\n'
echo "done in ${SECONDS}s"
</code></pre>
<h2>5. Lean 4</h2>
<pre><code>import Mathlib.Data.Nat.Basic

namespace Demo

/-- 归纳定义的偶数谓词。 -/
inductive Even : Nat → Prop
  | zero : Even 0
  | add_two {n : Nat} : Even n → Even (n + 2)

theorem even_add (m n : Nat) (hm : Even m) (hn : Even n) : Even (m + n) := by
  induction hm with
  | zero =&gt; simpa using hn
  | add_two _ ih =&gt; simpa [Nat.add_assoc] using Even.add_two ih

def double (n : Nat) : Nat := n * 2

example (n : Nat) : double n = n + n := by
  simp [double, Nat.mul_two]   -- 一条 tactic 搞定

end Demo
</code></pre>
<h2>6. 同一段代码的对比（无 <code>title</code>、无行号）</h2>
<blockquote>
<p>行号在 Expressive Code 里<strong>默认开启</strong>（<code>plugin-line-numbers</code> 的 <code>showLineNumbers</code>
默认值为 <code>true</code>），所以必须显式写 <code>showLineNumbers=false</code> 才是真的无行号。</p>
</blockquote>
<pre><code>def fib(n: int) -&gt; int:
    a, b = 0, 1
    for _ in range(n):
        a, b = b, a + b
    return a
</code></pre>
<h2>7. 字体四形态（ComicMathMono）</h2>
<p>当前 <code>mono</code> 角色是 <strong>ComicMathMono</strong> 的 Regular / Bold / Italic / Bold Italic 四个真实字面；
粗斜体不再依赖浏览器合成。</p>
<p>&lt;pre class="font-demo" style="font-weight: 400;"&gt;const total = items.reduce((a, b) =&gt; a + b, 0); // Regular&lt;/pre&gt;
&lt;pre class="font-demo" style="font-weight: 700;"&gt;const total = items.reduce((a, b) =&gt; a + b, 0); // Bold&lt;/pre&gt;
&lt;pre class="font-demo" style="font-style: italic;"&gt;const total = items.reduce((a, b) =&gt; a + b, 0); // Italic&lt;/pre&gt;
&lt;pre class="font-demo" style="font-weight: 700; font-style: italic;"&gt;const total = items.reduce((a, b) =&gt; a + b, 0); // Bold Italic&lt;/pre&gt;</p>
<table>
<thead>
<tr>
<th>形式</th>
<th>行内代码效果</th>
</tr>
</thead>
<tbody>
<tr>
<td>Regular</td>
<td><code>const total = items.reduce((a, b) =&gt; a + b, 0);</code></td>
</tr>
<tr>
<td><strong>Bold</strong></td>
<td><strong><code>const total = items.reduce((a, b) =&gt; a + b, 0);</code></strong></td>
</tr>
<tr>
<td><em>Italic</em></td>
<td><em><code>const total = items.reduce((a, b) =&gt; a + b, 0);</code></em></td>
</tr>
<tr>
<td><em><strong>Bold Italic</strong></em></td>
<td><em><strong><code>const total = items.reduce((a, b) =&gt; a + b, 0);</code></strong></em></td>
</tr>
</tbody>
</table>
<blockquote>
<p>表格使用作者强调：Regular 400 / Bold 600 / Italic 400 italic / Bold Italic 600 italic；
主题会把 600 匹配到最近的 700 真实字面，四行宽度一致。</p>
</blockquote>
]]></content>
    <author><name>ATMxsp01</name></author>
    <category term="临时"/>
  </entry>
  <entry>
    <title>Hello Shirone</title>
    <link href="https://atmxsp01.github.io/posts/welcome/" rel="alternate" type="text/html"/>
    <id>https://atmxsp01.github.io/posts/welcome/</id>
    <published>2026-09-10T00:00:00.000Z</published>
    <updated>2026-09-10T00:00:00.000Z</updated>
    <summary>迁移到 Shirone 后的第一篇占位文章，可随时删除。</summary>
    <content type="html"><![CDATA[<p>博客框架已从 Mizuki 迁移到 Shirone，这篇占位文用于验证写作流程与构建管线。</p>
<h2>为什么迁移</h2>
<p>Mizuki 上游已停止维护并迁移至 Shirone。与其继续在一个不再更新的框架上做定制，不如趁内容还少的时候把结构一次性做对。</p>
<h2>这次迁移做了什么</h2>
<ul>
<li>内容仓库重组为 Shirone 的目录模型（<code>content/</code>、<code>data/</code>、<code>assets/</code>、<code>public/</code>、<code>config/</code>）</li>
<li>个性化设置从代码里的 <code>src/config/*.ts</code> 移到内容仓库的 <code>config/*.yaml</code></li>
<li>部署切到 GitHub Pages 的 artifact 路线</li>
</ul>
<h2>下一步</h2>
<ul>
<li>写真正的文章（这篇只是占位）</li>
<li>把侧边栏数据（技能、项目、时间线等）换成自己的</li>
</ul>
<p>&lt;!-- 闭环复测 2026-09-10T05:13:49Z --&gt;</p>
]]></content>
    <author><name>ATMxsp01</name></author>
    <category term="随笔"/>
  </entry>
</feed>
