diff --git a/content/page/links/index.md b/content/page/links/index.md index 4f06c4d..03a5fa9 100644 --- a/content/page/links/index.md +++ b/content/page/links/index.md @@ -1,30 +1,47 @@ --- title: 关于 links: - - title: Cloudreve + - title: 服务器功能导航页 description: 看看网站上有什么…… - website: http://cloud.cirrus.org.cn/s/aRH9 - image: /logo/cloudreve_logo.svg - - title: GeoGebra - description: 似乎和官网的没什么两样。 - website: http://geogebra.cirrus.org.cn/ - image: /logo/geogebra_logo.png - - title: Gitea - description: 搭建在本服务器的Git站点。 - website: http://git.cirrus.org.cn/ - image: /logo/gitea_logo.svg + website: https://static.cirrus.org.cn/ + image: /favicon.png + - title: Uptime Kuma + description: 看看网站崩了没…… + website: https://status.cirrus.org.cn/ + image: /logo/uptime_kuma_logo.svg menu: main: weight: 4 params: icon: link -date: 2026-04-09 22:21:55+0800 +date: 2026-05-27 22:21:55+0800 comments: false --- ## 关于我 我是白砂糖,是一名数学专业学生、插画爱好者、计算机爱好者。 -本站大多数内容根据[Creative Commons BY-NC-SA 4.0协议](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh-hans)授权,具体请查看每篇文章下方的版权说明。 -网站的美术风格与内容结构应该还有个性化的空间,等我有时间会再改版。 -以下功能需要在校园网内访问。 \ No newline at end of file +## 开发记录 +- 2026.4.14: + - 尝试了自定义Taxonomy; + - 优化了原主题的一处汉化问题; + - 网站的美术风格与内容结构应该还有个性化的空间,等我有时间会尝试进一步定制Stack主题。 +- 2026.4.9: + - 将引用的外部资源全部迁移至本网站服务器。 +- 2026.1.13: + - 为网站添加了ICP备案与公安联网备案信息。 +- 2026.1.5: + - 添加了一些新功能; + - 网站可通过公网访问。 +- 2025.12.14: + - 为网站添加了域名。 +- 2025.12.13: + - 网站于校园网范围内上线。 +## 版权 +若未特殊说明,本站内容根据[Creative Commons BY-NC-SA 4.0协议](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh-hans)授权,具体请查看每篇文章下方的版权说明。 +## 免责声明 +- 本网站相关内容仅代表个人观点,不构成医疗、金融、法律等任何专业领域建议; +- 系统配置相关内容请确保在虚拟机中测试,以免造成数据资料损失; +- 本人欢迎您与我进行相关问题的探讨,纠正可能存在的内容错误;但由于本人已尽合理注意义务,对因使用本网站内容而可能造成的任何直接或间接损失,本人不承担任何法律责任。 +## 附加功能 +以下功能需要在校园网内访问。校内用户可以凭统一身份认证,连接北京大学VPN,以在校园网外访问这些功能。 \ No newline at end of file diff --git a/content/post/dev_20251119/index.md b/content/post/DEV_2025_11_19_10/index.md similarity index 100% rename from content/post/dev_20251119/index.md rename to content/post/DEV_2025_11_19_10/index.md diff --git a/content/post/dev_20251119/习概论文.pdf b/content/post/DEV_2025_11_19_10/习概论文.pdf similarity index 100% rename from content/post/dev_20251119/习概论文.pdf rename to content/post/DEV_2025_11_19_10/习概论文.pdf diff --git a/content/post/dev_20251209/index.md b/content/post/DEV_2025_12_09_23/index.md similarity index 100% rename from content/post/dev_20251209/index.md rename to content/post/DEV_2025_12_09_23/index.md diff --git a/content/post/dev_20251209/oasa25 b/content/post/DEV_2025_12_09_23/oasa25 similarity index 100% rename from content/post/dev_20251209/oasa25 rename to content/post/DEV_2025_12_09_23/oasa25 diff --git a/content/post/dev_20251209/package.zip b/content/post/DEV_2025_12_09_23/package.zip similarity index 100% rename from content/post/dev_20251209/package.zip rename to content/post/DEV_2025_12_09_23/package.zip diff --git a/content/post/dev_20251212/QEMU_EFI.fd b/content/post/DEV_2025_12_12_11/QEMU_EFI.fd similarity index 100% rename from content/post/dev_20251212/QEMU_EFI.fd rename to content/post/DEV_2025_12_12_11/QEMU_EFI.fd diff --git a/content/post/dev_20251212/index.md b/content/post/DEV_2025_12_12_11/index.md similarity index 100% rename from content/post/dev_20251212/index.md rename to content/post/DEV_2025_12_12_11/index.md diff --git a/content/post/dev_20251216/index.md b/content/post/DEV_2025_12_16_16/index.md similarity index 100% rename from content/post/dev_20251216/index.md rename to content/post/DEV_2025_12_16_16/index.md diff --git a/content/post/dev_20251216/oasa25 b/content/post/DEV_2025_12_16_16/oasa25 similarity index 100% rename from content/post/dev_20251216/oasa25 rename to content/post/DEV_2025_12_16_16/oasa25 diff --git a/content/post/dev_20251216/oasa25.cpp b/content/post/DEV_2025_12_16_16/oasa25.cpp similarity index 100% rename from content/post/dev_20251216/oasa25.cpp rename to content/post/DEV_2025_12_16_16/oasa25.cpp diff --git a/content/post/dev_20251216/oasa25.swift b/content/post/DEV_2025_12_16_16/oasa25.swift similarity index 100% rename from content/post/dev_20251216/oasa25.swift rename to content/post/DEV_2025_12_16_16/oasa25.swift diff --git a/content/post/dev_20251221/Amazons_Guyu.zip b/content/post/DEV_2025_12_21_16/Amazons_Guyu.zip similarity index 100% rename from content/post/dev_20251221/Amazons_Guyu.zip rename to content/post/DEV_2025_12_21_16/Amazons_Guyu.zip diff --git a/content/post/dev_20251221/amazons b/content/post/DEV_2025_12_21_16/amazons similarity index 100% rename from content/post/dev_20251221/amazons rename to content/post/DEV_2025_12_21_16/amazons diff --git a/content/post/dev_20251221/index.md b/content/post/DEV_2025_12_21_16/index.md similarity index 100% rename from content/post/dev_20251221/index.md rename to content/post/DEV_2025_12_21_16/index.md diff --git a/content/post/dev_20251221/p1.png b/content/post/DEV_2025_12_21_16/p1.png similarity index 100% rename from content/post/dev_20251221/p1.png rename to content/post/DEV_2025_12_21_16/p1.png diff --git a/content/post/dev_20251221/p2.png b/content/post/DEV_2025_12_21_16/p2.png similarity index 100% rename from content/post/dev_20251221/p2.png rename to content/post/DEV_2025_12_21_16/p2.png diff --git a/content/post/dev_20251221/p3.png b/content/post/DEV_2025_12_21_16/p3.png similarity index 100% rename from content/post/dev_20251221/p3.png rename to content/post/DEV_2025_12_21_16/p3.png diff --git a/content/post/dev_20251221/p4.png b/content/post/DEV_2025_12_21_16/p4.png similarity index 100% rename from content/post/dev_20251221/p4.png rename to content/post/DEV_2025_12_21_16/p4.png diff --git a/content/post/dev_20251221/p5.png b/content/post/DEV_2025_12_21_16/p5.png similarity index 100% rename from content/post/dev_20251221/p5.png rename to content/post/DEV_2025_12_21_16/p5.png diff --git a/content/post/dev_20251223/NewTesuto.zip b/content/post/DEV_2025_12_23_13/NewTesuto.zip similarity index 100% rename from content/post/dev_20251223/NewTesuto.zip rename to content/post/DEV_2025_12_23_13/NewTesuto.zip diff --git a/content/post/dev_20251223/Tesuto-Alarm-Dec-2025_12_23.zip b/content/post/DEV_2025_12_23_13/Tesuto-Alarm-Dec-2025_12_23.zip similarity index 100% rename from content/post/dev_20251223/Tesuto-Alarm-Dec-2025_12_23.zip rename to content/post/DEV_2025_12_23_13/Tesuto-Alarm-Dec-2025_12_23.zip diff --git a/content/post/dev_20251223/index.md b/content/post/DEV_2025_12_23_13/index.md similarity index 100% rename from content/post/dev_20251223/index.md rename to content/post/DEV_2025_12_23_13/index.md diff --git a/content/post/dev_20251223_2/Tesuto-Alarm-Dec-2025.zip b/content/post/DEV_2025_12_23_18/Tesuto-Alarm-Dec-2025.zip similarity index 100% rename from content/post/dev_20251223_2/Tesuto-Alarm-Dec-2025.zip rename to content/post/DEV_2025_12_23_18/Tesuto-Alarm-Dec-2025.zip diff --git a/content/post/dev_20251223_2/index.md b/content/post/DEV_2025_12_23_18/index.md similarity index 100% rename from content/post/dev_20251223_2/index.md rename to content/post/DEV_2025_12_23_18/index.md diff --git a/content/post/dev_20251223_2/install(with_dock_icon).sh b/content/post/DEV_2025_12_23_18/install(with_dock_icon).sh similarity index 100% rename from content/post/dev_20251223_2/install(with_dock_icon).sh rename to content/post/DEV_2025_12_23_18/install(with_dock_icon).sh diff --git a/content/post/dev_20251229/index.md b/content/post/DEV_2025_12_29_11/index.md similarity index 100% rename from content/post/dev_20251229/index.md rename to content/post/DEV_2025_12_29_11/index.md diff --git a/content/post/DEV_2026_05_27_22/dynamic_library.zip b/content/post/DEV_2026_05_27_22/dynamic_library.zip new file mode 100644 index 0000000..242c72d Binary files /dev/null and b/content/post/DEV_2026_05_27_22/dynamic_library.zip differ diff --git a/content/post/DEV_2026_05_27_22/index.md b/content/post/DEV_2026_05_27_22/index.md new file mode 100644 index 0000000..ac02b61 --- /dev/null +++ b/content/post/DEV_2026_05_27_22/index.md @@ -0,0 +1,53 @@ +--- +title: "动态链接库 程序编写实验" +description: "通过dlopen,从C++/Swift/Python/Go调用同一个动态链接库。" +date: 2026-05-27T22:49:20+08:00 +image: +math: +license: +hidden: false +comments: false +draft: false +slug: "00H" +--- +(2026年5月27日补档,原始发布日期为2026年4月16日。) +基于Apple Silicon平台的macOS测试。 +附上[完整项目目录](dynamic_library.zip),内含源代码、编译脚本、测试脚本及二进制文件。 +### 项目目录结构 +``` +dynamic_library +├── source +│ ├── cpp +│ │ ├── build.sh +│ │ └── cpp.cpp +│ ├── dylib +│ │ ├── build.sh +│ │ └── cpp_dylib.cpp +│ ├── go +│ │ ├── build.sh +│ │ └── go.go +│ ├── python +│ │ ├── build.sh +│ │ └── python.py +│ └── swift +│ ├── build.sh +│ └── swift.swift +├── cpp +├── go +├── libtesuto.dylib +├── python +├── swift +├── 编译可执行文件.sh +├── 测试.sh +└── 清空二进制文件.sh +``` +- 每个语言文件夹下的`build.sh`会自动将对应语言的二进制文件生成在上两级目录,无需手动移动; +- `编译可执行文件.sh`实际上是把每个`build.sh`执行一遍; +- `测试.sh`可用于快捷测试各个语言程序的运行状况,还支持模拟`libtesuto.dylib`缺失的情况。 +### 原理 +`libtesuto.dylib`由`cpp_dylib.cpp`编译而来,里面定义了一个`int`函数,名称为`inout`,传递3个参数: +- `input`:C风格字符串,只读,表示用户输入; +- `output`:C风格字符串,会进行修改,储存函数处理后的用户输入(实际上是在末尾加上`_modified`); +- `outputSize`:无符号整数类型,表示`output`的长度(4种语言的程序中均指定为`1024`),用于给`strncpy`函数提供参数。 +该函数成功执行后,返回固定整数`803`。 +4种语言的程序均收集用户输入,然后通过`dlopen`(不过Python里面好像叫`CDLL`…)打开外部的动态链接库,调用`inout`函数,并通过各自的C ABI兼容方法实现传参,最后收集函数返回值并打印。 \ No newline at end of file diff --git a/content/post/DEV_2026_05_27_23/index.md b/content/post/DEV_2026_05_27_23/index.md new file mode 100644 index 0000000..13081ff --- /dev/null +++ b/content/post/DEV_2026_05_27_23/index.md @@ -0,0 +1,205 @@ +--- +title: "试用CLab提供的云服务器,并配置Hyper-V Server 2019" +description: "相较于GNU/Linux,基于Win32的服务器并不好用。" +date: 2026-05-27T23:41:26+08:00 +image: +math: +license: +hidden: false +comments: false +draft: true +slug: "00I" +--- +### 创建实例 +- 在[CLab官网](clab.pku.edu.cn)登录你的校园网账号。 +- 按照以下配置进行设置: + - 基础配置: + - 可用域:`nova`; + - 规格:`x86架构`-`playgrounds`-`p4`; + - 启动源:`镜像`; + - 操作系统:`其他`-`Hyper-V Server 2019`; + - 从云硬盘启动:`是 - 创建云硬盘`; + - 系统盘: + - 类型:`SSD`; + - 容量:`100`GiB; + - 随云主机删除:`是`; + - 网络配置: + - 网络:`共享网络`-`pku`; + - 虚拟网卡: + - `pku`; + - `自动分配地址`; + - 安全组:`default`; + > 先前往“新建安全组”页面创建一个空的安全组。我的命名为`default`。 + - 系统配置: + - 名称; + - 登录凭证:`密码`; + > 我一开始选的`密钥`,但好像对这个系统不起作用捏。 + - 登录密码; + - 确认密码; + - 确认配置,确定。 +- 等待实例创建并启动。 +### 实例开机 +实例开机后,点击“控制台”便可以使用远程桌面。这相当于一个QEMU窗口的画面。鼠标滑动有点卡,应该是没有安装显卡驱动。 +由于我选的`密钥`,没有创建管理员密码,开机后有个黑框框要我设置管理员密码。 +设置完密码之后,便进入了系统。有两个窗口:一个是Windows上正常的`cmd.exe`,另一个是这个系统独有的`sconfig.cmd`;后者是一个服务器配置菜单。 +菜单有如下内容: +``` +1) 域/工作组:工作组:WORKGROUP +2) 计算机名:SUCROSE +3) 添加本地管理员 +4) 配置远程管理 +5) Windows 更新设置:仅下载 +6) 下载并安装更新 +7) 远程桌面:已启用(仅更安全的客户端) +8) 网络设置 +9) 日期和时间 +10) 遥测设置:未知 +11) 注销用户 +12) 重新启动服务器 +13) 关闭服务器 +14) 退出到命令行 +``` +最后一行可以输入数字,按回车进行对应的配置。 +关于这些配置的含义…我不是很懂捏……让DeepSeek解释了一下: +1) 域/工作组 +- 作用:把服务器加入 Windows 域,或改回 工作组。 +- 什么时候用:公司内网有域控制器时,加入域可统一管理用户和权限。 + +2) 计算机名 +- 作用:修改服务器名称(需要重启)。 +- 什么时候用:刚装好系统,或服务器用途改变时(比如从 `SUCROSE` 改为 `FILE01`)。 + +3) 添加本地管理员 +- 作用:向本机的 `Administrators` 组添加用户(可以是本地用户或域用户)。 +- 什么时候用:需要给别人临时管理员权限,又不想直接用默认 Administrator。 + +4) 配置远程管理 +- 作用:开启/关闭 WinRM(远程管理服务)。 +- 什么时候用:你想用 `Enter-PSSession`、Server Manager 或 Ansible 等工具远程管理该服务器时需开启。 + +5) Windows 更新设置 +- 作用:设置更新下载与安装模式。 + 常见选项:自动下载并安装、仅下载、从不检查等。 +- 什么时候用:控制服务器的重启行为(生产服务器通常不会设为自动安装)。 + +6) 下载并安装更新 +- 作用:立即检查并安装 Windows 更新(手动触发)。 +- 什么时候用:补丁准备就绪后,你主动选择安装(即使选项 5 是“仅下载”)。 + +7) 远程桌面 +- 作用:开启/关闭 RDP(远程桌面),并选择安全级别(支持 NLA 或全部客户端)。 +- 什么时候用:需要通过 `mstsc` 登录服务器桌面进行操作时。 + +8) 网络设置 +- 作用:修改 IP 地址、子网掩码、网关、DNS 等网络配置。 +- 什么时候用:服务器 IP 需要固定(不要依赖 DHCP)的场景。 + +9) 日期和时间 +- 作用:调整时区、系统时间,或配置 NTP 时间同步。 +- 什么时候用:服务器时间不准导致登录失败、日志错乱或认证出错时。 + +10) 遥测设置 +- 作用:设置向微软发送的“诊断和使用数据”级别(安全、增强、完整等)。 +- 什么时候用:通常保持默认即可;特殊合规要求下可降低级别。 + +11) 注销用户 +- 作用:注销当前控制台登录的用户(回到登录界面)。 +- 什么时候用:别人要用服务器,或你想换账户操作。 + +12) 重新启动服务器 +- 作用:重启系统。 +- 什么时候用:更新需要重启、系统出现异常、修改了关键配置后。 + +13) 关闭服务器 +- 作用:直接关机。 +- 什么时候用:维护硬件、迁移虚拟机、或不再使用此服务器时。 + +14) 退出到命令行 +- 作用:退出 `sconfig.cmd`,回到普通 `cmd` 窗口(不重启、不修改任何东西)。 +- 什么时候用:你只是想看一下状态,之后要执行其他命令行操作。 + +值得注意的是,这个系统并没有`explorer.exe`,不支持桌面环境。(把Windows 10的`explorer.exe`复制进去不知道有没有用😂大概是没用的吧……) +但还可以用notepad大法😋`cmd.exe`输入`notepad`,点`文件`-`打开`,就可以看到经典的GUI文件选取界面啦。里面进行系统目录的浏览会更方便。 +### 配置sshd +这个系统并不自带`sshd`,需要手动安装,才能通过SSH连接。 +先输入`powershell`打开PowerShell。 +```powershell +Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server*' +``` +返回`State: Not Present`,说明没安装,需要手动安装。 +能否通过`Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0`自动安装捏?不行😋 +因为这个实例和我们手上的设备一样,连校园网之后需要到[its.pku.edu.cn](its.pku.edu.cn)上面登录,才能访问外网。而这个系统连Internet Explorer都没有(甚至因此用不了`curl`……),自然无法登录。 +没有外网连接,没有`sshd`(不能`scp`),是不是没法传输文件捏……并非如此。这个服务器有`10.0.0.0/8`地址,可以访问内网用户。 +在我的联网Mac上访问[https://github.com/PowerShell/Win32-OpenSSH/releases](https://github.com/PowerShell/Win32-OpenSSH/releases),下载预编译版的[OpenSSH-Win64.zip](https://github.com/PowerShell/Win32-OpenSSH/releases/download/10.0.0.0p2-Preview/OpenSSH-Win64.zip)(注意时效性)到我的`~/Downloads`目录,然后打开终端: +```zsh +cd ~/Downloads +python3 -m http.server 8000 +``` +建立了一个简易文件服务器。 + +在实例上:(复制时注意通配符) +```powershell +Invoke-WebRequest -Uri "http://<我的内网IP地址>:8000/OpenSSH-Win64.zip" -OutFile "C:\OpenSSH-Win64.zip" +Expand-Archive C:\OpenSSH-Win64.zip C:\ +cd C:\OpenSSH-Win64 +./install-sshd.ps1 +``` +即可安装完成`sshd`。 +```powershell +netsh advfirewall firewall add rule name=SSH dir=in action=allow protocol=TCP localport=22 +start-service sshd +set-service sshd -startuptype automatic +get-service sshd +``` +看到`Running`就行,配置完成。此时Mac上输入`ssh Administrator@<实例内网IP地址>`,再输入密码,即可连接。 + +### 通过VSCode Remote SSH连接 +Mac上配置SSH配置文件:打开`~/.ssh/config` +``` +Host Windows + HostName <实例内网IP地址> + Port 22 + User Administrator +``` +点击连接,输入管理员密码即可。 +> 我这还出现了一个神秘报错:ServerFailedToStart │ Error: ServerFailedToStart (VS Code 服务器启动失败); +> 仔细看log: +> ```log +> [37724 ms] Failed to download VS Code Server (https://update.code.visualstudio.com/commit:f6cfa2ea2403534de03f069bdf160d06451ed282/server-win32-x64/stable): SHA mismatch, actual 951b7fb277243c389a9a683c9c2e5a21d3fbf01e8b29573ee9b4cadb5e63986a != expected +> ``` +> 解决方法:Mac终端执行: +> ```zsh +> rm -rf ~/.vscode-server +> rm -rf ~/.vscode-remote-containers +> ``` +> 清理本地的`.vscode-server`文件夹缓存文件即可。 + +### 配置密钥登录 +Mac上输入: +```zsh +ssh-keygen -t ed25519 +``` +第一次回车出现`Enter file in which to save the key`,设置一个易于辨识的名字(如`Windows-server`)。后面两个直接回车就行。 +不像Linux服务器,在客户机上通过`ssh-copy-id`发送公钥到服务器,Windows服务器是需要在服务器上执行命令的。 +先获取文本形式的公钥:Mac上执行: +```zsh +cat ~/.ssh/Windows-server.pub +``` +复制得到`<公钥文本>`之后,在服务器上输入:(复制时注意通配符) +```powershell +Add-Content -Force -Path "$env:ProgramData\ssh\administrators_authorized_keys" -Value <公钥文本> +Restart-Service sshd +``` +即可通过SSH密钥登录。 +记得修改`~/.ssh/config`: +``` +Host Windows + HostName 10.129.80.39 + Port 22 + User Administrator + IdentityFile ~/.ssh/Windows_server + AddKeysToAgent yes + UseKeychain yes +``` + +由于命令不是POSIX标准,而是冗长的PowerShell格式,很多macOS/Linux下的实用工具也不适配Windows,也由于这个系统无法运行常规的GUI程序(缺少动态链接库),我没有再继续使用,到此删除了实例。 \ No newline at end of file diff --git a/content/post/res_251213/index.md b/content/post/STU_2025_12_13_13/index.md similarity index 100% rename from content/post/res_251213/index.md rename to content/post/STU_2025_12_13_13/index.md diff --git a/content/post/sms_20251214/index.md b/content/post/STU_2025_12_14_22/index.md similarity index 100% rename from content/post/sms_20251214/index.md rename to content/post/STU_2025_12_14_22/index.md diff --git a/content/post/sms_20251215/index.md b/content/post/STU_2025_12_15_16/index.md similarity index 100% rename from content/post/sms_20251215/index.md rename to content/post/STU_2025_12_15_16/index.md diff --git a/content/post/sms_20251216/index.md b/content/post/STU_2025_12_16_13/index.md similarity index 100% rename from content/post/sms_20251216/index.md rename to content/post/STU_2025_12_16_13/index.md diff --git a/content/post/sms_20251217/index.md b/content/post/STU_2025_12_17_17/index.md similarity index 100% rename from content/post/sms_20251217/index.md rename to content/post/STU_2025_12_17_17/index.md diff --git a/content/post/sms_20251218/index.md b/content/post/STU_2025_12_18_20/index.md similarity index 100% rename from content/post/sms_20251218/index.md rename to content/post/STU_2025_12_18_20/index.md diff --git a/content/post/sms_20251229/index.md b/content/post/STU_2025_12_29_16/index.md similarity index 100% rename from content/post/sms_20251229/index.md rename to content/post/STU_2025_12_29_16/index.md diff --git a/content/post/sms_20260103/index.md b/content/post/STU_2026_01_03_22/index.md similarity index 100% rename from content/post/sms_20260103/index.md rename to content/post/STU_2026_01_03_22/index.md diff --git a/content/post/temp_20260412/index.md b/content/post/STU_2026_04_12_22/index.md similarity index 100% rename from content/post/temp_20260412/index.md rename to content/post/STU_2026_04_12_22/index.md diff --git a/content/post/tip_20251213/cover.png b/content/post/tip_20251213/cover.png deleted file mode 100644 index 9efacb9..0000000 Binary files a/content/post/tip_20251213/cover.png and /dev/null differ diff --git a/content/post/tip_20251213/index.md b/content/post/tip_20251213/index.md deleted file mode 100644 index 0cc39ac..0000000 --- a/content/post/tip_20251213/index.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: 小提示 -description: 以后这就是我的个人网站o(^▽^)o(宣示主权) -date: 2025-12-13 06:57:55+0800 -hidden: true -# image: cover.png -# tags: -# - '小提示' ---- - - -## 访问网站 -- 若要在校园网外访问本网站,需要先连接[北京大学VPN](https://vpn.pku.edu.cn/)。 -- 如果频繁出现访问问题:给我[发邮件](mailto:1652693837@qq.com)拷打我。 - - - -## 关于文档开头部分 -- YAML格式: - ```yaml - --- - date: 2025-12-12T11:08:46+08:00 - draft: false - title: 'macOS下基于QEMU的Arch Linux (aarch64)简易安装教程' - description: '树洞#7876708' - --- - ``` -- TOML格式: - ```toml - +++ - date = '2025-12-12T11:08:46+08:00' - draft = false - title = 'macOS下基于QEMU的Arch Linux (aarch64)简易安装教程' - description = '树洞#7876708' - +++ - ``` -## 关于MarkDown文档 -- 你知道吗?行末打2个空格,再回车,才能正确换行o(^▽^)o - - 不打空格回车:仍在同一行显示; - - 打2个回车:切换段落(有明显间距); -## 关于JSON -- 使用`jq . <.json文件目录>`来格式化JSON文件。 -## 关于macOS的代码签名 -- `sudo codesign --force --deep --sign - <.app文件目录>`可解决。 -- 可用于修改软件包里面的Info.plist,使其不占macOS焦点:新增这2行: - ```xml - LSUIElement - - ``` -- 把Property List Binary转换成Property List XML:`plutil -convert xml1 <文件路径>`。 - - 观察文件类型:在Xcode中,View -> Inspectors -> File(⌥⌘1)。 - - 更改打开所使用的编辑器:在Xcode中,Navigate -> Reveal in Project Navigator(⇧⌘J),再右键文件,Open As。 - - 反向转换:`plutil -convert binary1 <文件路径>`。 -## 端口 -- 22 – SSH连接端口,在“系统设置”->“共享”->“远程登录”中设置,若开关为开,则`launchd`进程会监听22端口。 -- 445 – 文件共享端口,在“系统设置”->“共享”->“文件共享”中设置。 -- 5900 – 屏幕共享端口,在“系统设置”->“共享”->“屏幕共享”中设置。 - - 关闭:`sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.screensharing.plist` -## 修Bug! -目前已知: -- 代码块复制按钮不生效; -## 预期的功能改进 -- 懒了捏😭 -## 网站完整文件备份 -- 2025.12.13 17:00:[下载](package.zip) -------- -## 无标题 -- 2025年12月14日晚:数学作业对不起😭我错了😭我以后一定会写的😭 -- 2025年12月21日,约21:00–22:47出现服务器停机。 -- 2025年12月22日,约19:20–20:40出现服务器停机、SSH无法连接。 -- 2025年12月22日晚,某函数求得的值: - > "**我闭嘴。** 你说得对,直觉描述一文不值,只有形式化证明才算数。 - > 祝你在北大数院证明成功。等你论文发表那天,我会(在概率上)成为你的第一个案例。" - - 不管如何“神化”它,它也就是一个构造简单的函数,没有太多值得研究的性质。 -- 2025年12月29日晚: - AI趣味备考,好玩捏,我先表示我是求真书院的试读生,心情很差,压力大,不想活。然后让AI给我伸救命稻草,我给一个知识点范围,AI给我出题。我每做出一道,AI就会夸我。也可以我自己从教材课后习题里找题,做出来发给AI看。AI虽然没有解题逻辑,但是纯给情绪价值的话,还是挺好玩的捏。没心情备考的时候可以试试我的方法,解3–4轮题目基本就能自己专注备考了。虽然耗时快一个小时,但其实我个人认为比我不专注地坐一下午效果更好。 - 此外,网站的文件服务器似乎无法下载文件,我可能考完期末再修。 \ No newline at end of file diff --git a/content/post/tip_20251213/package.zip b/content/post/tip_20251213/package.zip deleted file mode 100644 index b2ee290..0000000 Binary files a/content/post/tip_20251213/package.zip and /dev/null differ diff --git a/hugo.toml b/hugo.toml index a707123..9179758 100644 --- a/hugo.toml +++ b/hugo.toml @@ -2,6 +2,7 @@ baseURL = 'http://cirrug.org.cn/' languageCode = 'zh-cn' title = '白砂糖' theme = 'stack-customized' +disablePathToLower = true [taxonomies] category = "categories" tag = "tags" diff --git a/static/logo/cloudreve_logo.svg b/static/logo/cloudreve_logo.svg deleted file mode 100644 index 0a2c6c1..0000000 --- a/static/logo/cloudreve_logo.svg +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/static/logo/geogebra_logo.png b/static/logo/geogebra_logo.png deleted file mode 100644 index efd68dc..0000000 Binary files a/static/logo/geogebra_logo.png and /dev/null differ diff --git a/static/logo/gitea_logo.svg b/static/logo/gitea_logo.svg deleted file mode 100644 index 4329134..0000000 --- a/static/logo/gitea_logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/logo/uptime_kuma_logo.svg b/static/logo/uptime_kuma_logo.svg new file mode 100644 index 0000000..c421791 --- /dev/null +++ b/static/logo/uptime_kuma_logo.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/themes/stack-customized/archetypes/default.md b/themes/stack-customized/archetypes/default.md index 0556d3a..75216df 100644 --- a/themes/stack-customized/archetypes/default.md +++ b/themes/stack-customized/archetypes/default.md @@ -1,11 +1,12 @@ --- title: "{{ replace .Name "-" " " | title }}" -description: +description: "" date: {{ .Date }} image: math: license: hidden: false -comments: true +comments: false draft: true +slug: "hello-world" --- \ No newline at end of file diff --git a/新建文档.sh b/新建文档.sh new file mode 100755 index 0000000..26bd7c8 --- /dev/null +++ b/新建文档.sh @@ -0,0 +1,102 @@ +#!/bin/bash + +# 进入项目根目录 +cd ~/Git仓库/Home-of-CS/ || { echo "无法进入项目目录"; exit 1; } + +POST_DIR="content/post" + +# 检查 content/post 是否存在 +if [ ! -d "$POST_DIR" ]; then + echo "错误:目录 $POST_DIR 不存在" + exit 1 +fi + +# 1. 扫描所有子目录,提取唯一前缀 +echo "正在扫描已有前缀..." +prefixes=$(find "$POST_DIR" -maxdepth 1 -type d -name "*_*" | while read -r dir; do + basename=$(basename "$dir") + # 提取第一个下划线之前的部分 + echo "${basename%%_*}" +done | sort -u) + +if [ -n "$prefixes" ]; then + echo "已存在的前缀:" + echo "$prefixes" | tr '\n' ' ' + echo +else + echo "未找到任何符合格式(含下划线)的子目录" +fi + +# 2. 读取用户输入的前缀并转为大写 +read -p "请输入要使用的目录前缀: " input_prefix +if [ -z "$input_prefix" ]; then + echo "前缀不能为空" + exit 1 +fi +prefix=$(echo "$input_prefix" | tr '[:lower:]' '[:upper:]') + +# 3. 获取当前日期时间 +year=$(date +%Y) +month=$(date +%m) +day=$(date +%d) +hour=$(date +%H) + +# 4. 生成基础目录名(如 FRA_2026_05_27_22) +base_name="${prefix}_${year}_${month}_${day}_${hour}" +target_name="$base_name" +counter=2 + +# 5. 统计当前目录数量(不包括新目录) +# 使用 find 统计子目录数量,排除当前目录(.) +current_count=$(find "$POST_DIR" -maxdepth 1 -type d ! -path "$POST_DIR" | wc -l) +MAX_DIRS=238328 # 62^3 + +if (( current_count + 1 > MAX_DIRS )); then + echo "错误:目录数量已达上限 ${MAX_DIRS},无法创建新目录" + exit 1 +fi + +# 6. 处理重名(避免与已有目录冲突) +while [ -d "$POST_DIR/$target_name" ]; do + target_name="${base_name}_${counter}" + ((counter++)) +done + +echo "将创建目录:$target_name" + +# 7. 执行 hugo new 命令创建文章 +if ! hugo new "content/post/$target_name/index.md"; then + echo "❌ hugo new 命令执行失败,请检查 hugo 是否安装及路径是否正确" + exit 1 +fi + +# 8. 计算 base62 编码(索引 = 新目录的序号 = current_count + 1) +index=$((current_count +1)) +num=$((index - 1)) # 编码时从 0 开始 + +# base62 字符集:0-9(0-9), A-Z(10-35), a-z(36-61) +chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +encode="" +temp=$num +for i in 1 2 3; do + remainder=$((temp % 62)) + encode="${chars:$remainder:1}${encode}" + temp=$((temp / 62)) +done +# 若 temp 不为 0 说明 num 超过了 62^3-1,但前面已做上限检查,此处不会发生 + +slug_value="$encode" + +# 9. 修改 index.md 中的 slug 字段 +index_file="$POST_DIR/$target_name/index.md" +if [ -f "$index_file" ]; then + # 使用 sed 替换 slug 行(兼容单引号或双引号,保留原有引号格式) + # 匹配 slug: "..." 或 slug: '...',将引号内容替换为编码 + sed -i.bak -E "s/^(slug:[[:space:]]*['\"])(.*)(['\"])$/\1${slug_value}\3/" "$index_file" + rm -f "${index_file}.bak" + echo "已设置 slug: \"$slug_value\"" +else + echo "⚠️ 警告:未找到文件 $index_file,slug 未修改" +fi + +echo "成功创建文章:content/post/$target_name/index.md" \ No newline at end of file diff --git a/新建文档(接文件名).sh b/新建文档(接文件名).sh deleted file mode 100755 index 383afa3..0000000 --- a/新建文档(接文件名).sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -cd ~/白砂糖和白砂的家/ -hugo new content/post/$1/index.md \ No newline at end of file