Compare commits

..

2 Commits

Author SHA1 Message Date
dichgrem
fc411e21d8 update:arch 2025-12-28 20:59:54 +08:00
dichgrem
e6869053fe style:highlight 2025-12-28 16:47:05 +08:00
41 changed files with 1124 additions and 946 deletions

View File

@@ -18,7 +18,7 @@ jobs:
- name: Install Zola
uses: taiki-e/install-action@v2
with:
tool: zola@0.21.0
tool: zola
- name: Install Pagefind
run: |

2
.gitignore vendored
View File

@@ -1,2 +0,0 @@
.idea/
public

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2026 Dichgrem
Copyright (c) 2025 Dichgrem
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

428
Terminimal.md Normal file
View File

@@ -0,0 +1,428 @@
# Terminimal
[![Build Status](https://github.com/pawroman/zola-theme-terminimal/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/pawroman/zola-theme-terminimal/actions/workflows/pages/pages-build-deployment)
![No JavaScript](https://img.shields.io/badge/JavaScript-none-brightgreen.svg)
![Screenshot](../master/screenshot.png?raw=true)
See the live demo (of the default configuration) here:
https://pawroman.github.io/zola-theme-terminimal/
Tested with Zola v0.17.2. Please note that earlier versions might not work because of breaking changes across Zola versions.
#### Fork disclaimer
This theme is a fork (not a port) of "Terminal" Hugo theme
by Radosław Kozieł (aka. panr):
https://github.com/panr/hugo-theme-terminal
Many thanks for that outstanding original theme, Radek!
For more information about this fork and the differences to the original theme, please see:
[Changes compared to the original theme](#changes-compared-to-the-original-theme) below.
## Versioning
This theme used to be non-versioned, e.g. you'd pull the master branch, and occasionally new features or fixes would
be released.
Starting from version v1.0.0, the project adopted [Semantic Versioning](https://semver.org/).
Please check the [GitHub releases](https://github.com/pawroman/zola-theme-terminimal/releases) to see a change log
and work out if there's any breaking changes.
## How to start
Option A: clone the theme directly into your Zola site folder:
```
$ git clone https://github.com/pawroman/zola-theme-terminimal.git themes/terminimal
```
Option B: include it as a git submodule (it's better if you plan to use CI builders):
```
$ git submodule add https://github.com/pawroman/zola-theme-terminimal.git themes/terminimal
```
Then in your `config.toml` set:
```toml
theme = "terminimal"
# Sass compilation is required
compile_sass = true
```
Also see the Zola documentation on using themes:
https://www.getzola.org/documentation/themes/installing-and-using-themes/
## Shortcodes
The theme adds two custom shortcodes related to image handling.
### `image`
Used to show images.
Required arguments:
- **`src`**
Optional arguments:
- **`alt`**
- **`position`** (center \[default\] | left | right)
- **`style`**
Example:
```
{{ image(src="/img/hello.png", alt="Hello Friend",
position="left", style="border-radius: 8px;") }}
```
### `figure`
Same as `image`, but with a few extra optional arguments:
- **`caption`** (supports markdown)
- **`caption_position`** (center \[default\] | left | right)
- **`caption_style`**
Example:
```
{{ figure(src="http://rustacean.net/assets/rustacean-flat-gesture.png",
style="width: 25%;",
position="right",
caption_position="left",
caption="**Ferris**, the (unofficial) Rust mascot",
caption_style="font-style: italic;") }}
```
## OpenGraph
To add an image to a post, set the `og_image` extra option to the desired image
in the same directory of the markdown file:
```toml
[extra]
og_image = "colocated_image.png"
```
Additionally, for the section pages and for posts to have a fallback image, add
`default_og_image` to the `[extra]` section:
```toml
[extra]
default_og_image = "static/ocean.jpg"
```
## Configuration
### Only show the post's description
On each post you can specify the following:
```toml
description = "test description"
[extra]
show_only_description = true
```
This will render `test description` under this
particular post on the homepage instead of a summary.
### Colors
Both the accent colors and background colors are
configurable.
By default, both accent and background are set
to `blue`.
To configure menu, add this in `[extra]` section
of your `config.toml`:
```toml
[extra]
# One of: blue, green, orange, pink, red.
# Defaults to blue.
# Append -light for light themes, e.g. blue-light
# Or append -auto, e.g. blue-auto
accent_color = "green"
# One of: blue, dark, green, orange, pink, red, light, auto
# Enabling dark background will also modify primary font color to be darker.
# Defaults to accent color (or, if not accent color specified, to blue).
background_color = "dark"
```
### Logo text and link
You can set the "logo" text and what it links to,
by modifying `config.toml` like so:
```toml
[extra]
# The logo text - defaults to "Terminimal theme"
logo_text = "My blog"
# The logo link - defaults to base_url.
logo_home_link = "/take/me/away!"
```
### Author and copyright
You can set the footer's copyright author name like this:
```toml
[extra]
# Author name: when specified, modifies the default
# copyright text. Apart from author, it will
# contain current year and a link to the theme.
author = "My Name"
```
If you don't like the default copyright text,
you can set it to completely custom HTML:
```toml
[extra]
# Copyright text in HTML format. If specified,
# entirely replaces default copyright and author.
copyright_html = "My custom&nbsp;<b>copyright</b>"
```
### Menu
The menu is optional, static (all items are always shown,
no matter what the screen size) and fully user-configurable.
To configure menu, add this in `[extra]` section
of your `config.toml`:
```toml
[extra]
# menu is enabled by adding menu_items (optional)
menu_items = [
# each of these is optional, name and url are required
# $BASE_URL is going to be substituted by base_url from configuration
{name = "blog", url = "$BASE_URL"},
# tags should only be enabled if you have "tags" taxonomy
# see documentation below for more details
{name = "tags", url = "$BASE_URL/tags"},
{name = "archive", url = "$BASE_URL/archive"},
{name = "about me", url = "$BASE_URL/about"},
# set newtab to true to make the link open in new tab
{name = "github", url = "url-to-your-github", newtab = true},
]
```
### Tags
The theme optionally supports tags. To enable them, create
a "tags" taxonomy in your `config.toml`:
```toml
taxonomies = [
{name = "tags"},
]
```
Enabling tags will create a new `/tags` page, and
cause them to show up in `archive` section. Note
that you still need to create a menu link to the tags
page manually.
### Pagination
Pagination is fully supported for post list (main site)
and intra-post (you can navigate to earlier and later posts).
To make sure pagination works properly, you must first configure
it in `content/_index.md`:
```
+++
# number of pages to paginate by
paginate_by = 2
# sorting order for pagination
sort_by = "date"
+++
```
Then, tweak the theme's pagination config in `config.toml`:
```toml
[extra]
# Whether to show links to earlier and later posts
# on each post page (defaults to true).
enable_post_view_navigation = true
# The text shown at the bottom of a post,
# before earlier/later post links.
# Defaults to "Thanks for reading! Read other posts?"
post_view_navigation_prompt = "Read more"
```
### Language code
Internationalization / translation is not supported
but you can set the HTML language code for your
site:
```toml
default_language = "en"
```
### Hack font subset
By default, the theme uses a mixed subset of the Hack font.
Normal weight font uses full character set
(for Unicode icons and special symbols), but all others
(bold, italic etc) use a limited subset.
This results in much smaller transfer sizes, but the subset
might not contain all the Unicode characters you need.
You can enable full unicode support in `config.toml`:
```toml
[extra]
# Use full Hack character set, not just a subset.
# Switch this to true if you need full unicode support.
# Defaults to false.
use_full_hack_font = true
```
Also see [Hack's docs](https://github.com/source-foundry/Hack/blob/master/docs/WEBFONT_USAGE.md).
### Favicon
The theme supports adding a global favicon (applies to
all pages) to the site:
```toml
# Optional: Global favicon URL and mimetype.
# Mimetype defaults to "image/x-icon".
# The URL should point at a file located
# in your site's "static" directory.
favicon = "/favicon.png"
favicon_mimetype = "image/png"
```
### Page titles
The theme allows you to configure how the page titles (the `<title>` elements) are rendered.
Use `"combined"` to render titles as `"Page title | Main title"`.
```toml
# Optional: Set how <title> elements are rendered.
# Values:
# - "main_only" -- only the main title (`config.title`) is rendered.
# - "page_only" -- only the page title (if defined) is rendered,
# falling back to `config.title` if not defined or empty.
# - "combined" -- combine like so: "page_title | main_title",
# or if page_title is not defined or empty, fall back to `main_title`
#
# Note that the main (index) page only has the main title.
page_titles = "combined"
```
All the configuration options are also described in
[`config.toml`](../master/config.toml).
## Extending
Each of the templates defines named blocks, so
it should be quite easy to customize the most common things.
For example, if you want to add extra `<meta>` tags to the
base template, `index.html`, create file like this in `templates/index.html`:
```html
{% extends "terminimal/templates/index.html" %}
{% block extra_head %}
<meta name="description" content="My awesome website"/>
<meta name="keywords" content="Hacking,Programming,Ranting"/>
{% endblock %}
```
## How to contribute
If you spot any bugs or wish to contribute new features, please create a new
[Pull Request](https://github.com/pawroman/zola-theme-terminimal/pulls).
## Changes compared to the original theme
This theme has been forked from https://github.com/panr/hugo-theme-terminal
- Slight changes in the layout and styling.
- Content has been centered (instead of left-aligned).
- The header stripes have been spaced out.
- Tweaks to pagination, especially on mobile (small screens).
- The post title underline is dashed instead of doubly-dotted.
- All links are underlined, as per
[Brutalist Web Design Guidelines](https://www.brutalist-web.design/).
- Tweaks to header font sizes.
- Minor footer tweaks.
- Absolutely **no JavaScript**.
- No JavaScript needed to pre-process anything.
Zola with its Sass pre-processor is the only dependency.
- There's no menu trigger.
- Things load crazy fast, as it's all static content.
- Prism.js syntax highlighting is not supported (you can use
[Zola's](https://www.getzola.org/documentation/content/syntax-highlighting/)).
- All references to social media (e.g. Twitter) have been removed.
- All references to external URLs (e.g. Google CDN) have been removed.
This theme's static assets are meant to be served from where it's hosted.
- [Hack](https://github.com/source-foundry/Hack) is the default font.
- The default color theme is blue (original uses orange).
### New features
- You can pick the accent color as well as background color.
There's a new `dark` background. See [Configuration](#configuration)
below for details.
- Active "section" links will change color indicating the
active section. This is all static, done at template level.
### Features retained from the original
- 5 color themes, depending on your preference:
blue (default), green, orange, pink, red.
- The shortcodes `image` and `figure` (See [Shortcodes](#shortcodes)).
- Fully responsive.
## License
Copyright © 2019 Paweł Romanowski (pawroman)
Original theme: Copyright © 2019 Radosław Kozieł ([@panr](https://twitter.com/panr))
The theme is released under the MIT License.
Check the [license file](../master/LICENSE.md)
for more information.
The license for Hack fonts used is included in
[LICENSE-Hack.md](../master/LICENSE-Hack.md).

View File

@@ -22,22 +22,6 @@ taxonomies = [
[markdown]
highlight_code = true
highlight_theme = "boron"
render_emoji = false
external_links_target_blank = true
external_links_no_follow = true
external_links_no_referrer = true
smart_punctuation = false
bottom_footnotes = true
table_of_contents = { start_level = 2, end_level = 4 }
[markdown.highlight_themes]
light = "boron"
dark = "dracula"
[slugify]
paths = "on"
taxonomies = "on"
anchors = "on"
[extra]

View File

@@ -33,13 +33,12 @@ Aria2 有以下几个特点:
### Windows
首先在Github下载aria2[aria2-1.37.0-win-64bit-build1.zip](https://github.com/aria2/aria2/releases/tag/release-1.37.0),将下载好的文件解压并放到你喜欢的目录下,这里放到``D:\Software\aria2\aria2c.exe``
然后在同一个目录下创建一个配置文件``aria2.conf``,内容如下:
首先下载[aria2-1.37.0-win-64bit-build1.zip](https://github.com/aria2/aria2/releases/tag/release-1.37.0),将下载好的文件解压并放到你喜欢的目录下,设置系统环境变量,类似``D:\DATA\Data\AriaNg-1.3.10-AllInOne``,随后即可在 CMD 中使用``aria2c -v``查看Aria2 。
然后创建一个配置文件``C:\Users\<你>\.aria2\aria2.conf``,内容如下:
```conf
# 下载目录
dir=C:/Users/<你的用户名>/Downloads
dir=C:/Users/<你>/Downloads
# 断点续传
continue=true
@@ -50,31 +49,20 @@ enable-rpc=true
rpc-listen-all=true
rpc-allow-origin-all=true
rpc-listen-port=6800
rpc-secret=<设置一个密码>
rpc-secret=<你的密码>
```
随后在这个项目中[winsw](https://github.com/winsw/winsw)下载 WinSW-x64.exe到一个目录并重命名为 aria2-service.exe并在同目录下创建``aria2-service.xml``,内容如下:
随后使用winfet安装servyservy是一个将任何应用变成原生 Windows 服务的软件可以让aria2服务开机自启动类似linux上的systemctl.
```xml
<service>
<id>aria2</id>
<name>Aria2 Service</name>
<description>Aria2 Download Manager</description>
<executable>C:\Users\<你>\scoop\apps\aria2\current\aria2c.exe</executable>
<arguments>--conf-path=C:\Users\<你>\.aria2\aria2.conf</arguments>
</service>
```
winget install servy
```
安装完成后打开管理员权限的powershell运行以下命令注意路径要和你实际的路径相同
```bash
servy-cli install `
--name aria2 `
--displayName "aria2 download service" `
--description "aria2 background download daemon" `
--path D:\Software\aria2\aria2c.exe `
--params="--conf-path=D:\Software\aria2\aria2.conf" `
--startupDir D:\Software\aria2 `
--startupType Automatic `
--recoveryAction RestartProcess `
--stdout D:\Software\aria2\stdout.log `
--stderr D:\Software\aria2\stderr.log
```
随后使用``servy-cli start --name aria2``开启服务,并使用``servy-cli status --name aria2``查看服务在running中则一切正常现在可以到本文的末尾安装浏览器插件并连接使用。
随后使用``.\aria2-service.exe install``安装服务,并使用``.\aria2-service.exe start``启动服务类似linux上的systemctl.
> 注意修改用户名!
@@ -131,8 +119,6 @@ systemctl --user start aria2.service
```bash
systemctl --user status aria2.service
```
现在可以到本文的末尾安装浏览器插件并连接使用。
### Nixos
```nix
@@ -165,7 +151,6 @@ systemctl --user status aria2.service
};
}
```
现在可以到本文的末尾安装浏览器插件并连接使用。
## 命令行用法

255
content/Network-cdn.md Normal file
View File

@@ -0,0 +1,255 @@
+++
title = "网络艺术:CDN技术与应用"
date = 2024-02-16
[taxonomies]
tags = ["Network"]
+++
前言 内容分发网络CDN是一组分布在不同地理位置的服务器网络,使用户能够就近获取内容,从而降低延迟并缓解源站压力​.
<!-- more -->
## 什么是CDN
内容分发网络CDN是一组分布在不同地理位置的服务器网络旨在将网站或应用的静态资源如HTML、图片、视频等缓存到距离用户更近的节点以缩短传输路径、降低带宽成本并提高访问速度.CDN通过“缓存”机制在全球多个数据中心临时存储内容副本用户发起请求时无需回源到主服务器就能从最近的缓存节点获取数据从而显著改善页面加载时间和整体用户体验.相比传统的单点源站访问CDN在用户和源站之间增加了分层缓存通过负载均衡技术和智能路由将访问请求定向到最优节点既减轻了源站压力又提升了网络抗拥塞能力和可用性.
在现代互联网中内容分发网络CDN和域名系统DNS相互配合共同提升了网页和多媒体内容的访问速度与可靠性.CDN通过在全球分布的缓存节点上存储静态资源使用户能够就近获取内容从而降低延迟并缓解源站压力.而DNS则负责将用户的域名请求导向适当的CDN节点通过CNAME重定向、全局负载均衡GSLB、Anycast及EDNS扩展等技术实现智能化的流量调度和最优路径选择.
**CDN的核心功能与优势**
- 加速访问:将内容存储于距离用户更近的节点,减少传输延迟,常见于视频点播、大文件下载等场景​.
- 减轻源站压力缓存请求可直接由CDN节点响应降低源站带宽和计算资源消耗有助于应对突发流量和DDoS攻击.
- 高可用与弹性扩展:全球分布的节点架构,使内容分发具备冗余能力,单点故障不会影响整体服务,且可动态扩容以应对业务增长.
## CDN与DNS的结合方式
1. **通过CNAME实现权威DNS指向CDN**
当用户在浏览器中输入域名发起请求时首先触发本地DNS解析过程如果该域名已开通CDN服务其DNS解析记录通常配置为一条CNAME别名记录指向CDN运营商提供的专用域名本地DNS服务器再将解析权交给CDN的权威DNS服务器从而实现对CDN网络的接入.
CDN的权威DNS服务器根据用户请求的域名返回一个“全局负载均衡设备”的IP地址该IP并非最终缓存节点而是GSLB层用于智能调度的入口地址浏览器接收到该IP后向GSLB层发起实际内容请求.
2. **全局负载均衡GSLB与智能DNS**
GSLBGlobal Server Load Balancing是CDN架构中最核心的部分负责根据多种因素用户IP地理位置、节点健康状态、节点负载情况等动态选择最优区域负载均衡节点或缓存服务器向用户提供最低延迟和最佳性能的服务.
这一过程通常也基于DNS解析完成当GSLB层接到DNS查询请求时智能DNS服务器会返回针对该用户最优的缓存节点IP从而实现“DNS级”的流量调度和负载均衡.
3. **Anycast与EDNS扩展**
Anycast路由部分CDN运营商在全球部署相同IP的多个节点利用BGP Anycast技术使得用户请求自动路由到网络拓扑上“最近”的节点增强访问的网络路径效率与容灾能力.
EDNS Client SubnetEDNS-CS传统DNS仅看到发起查询的递归DNS服务器IP难以准确判断终端用户位置EDNS-CS协议在DNS请求中携带部分客户端IP前缀使权威DNS能更细粒度地进行地理定位与节点选取大幅提升了基于DNS的智能调度精度.
## 为什么加了CDN之后网站的自签名证书也被信任了
> 在启用 CDN 后终端用户看到的并不是您在源站origin上配置的自签名证书而是 CDN 边缘节点edge所出示的、由受信任 CA 签发的“边缘证书”.也就是说,浏览器与 CDN 边缘之间的 TLS 握手完全独立于您源站和自签名证书的存在,源站的自签名证书仅用于 CDN 与源站之间的“后端”加密连接,不会暴露给最终用户浏览器​.
**CDN 模式下的 TLS 终止**
- **DNS/CNAME 指向**
当您为域名启用 CDN 后,通常会在 DNS 中将该域名的 CNAME 记录指向 CDN 运营商提供的专用域名,本地递归 DNS 随后会将解析权交给 CDN 供应商的权威 DNS实现请求切入 CDN 网络​.
- **边缘节点出示证书**
用户发起 HTTPS 请求时,浏览器直接与就近的 CDN 边缘节点建立 TLS 连接,边缘节点会出示由受信任 CA如 Let's Encrypt、DigiCert 等)签发的“边缘证书”,而非您源站的自签名证书​.
- **源站连接加密**
在边缘节点接收并缓存用户流量后CDN 再以 HTTPS或 HTTP根据配置向源站发起请求.此时,您可以在源站使用自签名证书(或 Cloudflare Origin CA 自签名证书),仅保证 CDN 与源站之间的加密传输,且该证书对终端用户浏览器不可见​.
### SSL/TLS 加密模式对自签名证书的影响
以 Cloudflare 为例,常见的四种 SSL/TLS 模式对自签名证书的处理策略如下:
- **Flexible**:浏览器 ↔ CDN 边缘 使用 HTTPSCDN 边缘 ↔ 源站 使用 HTTP不接触证书验证.
- **Full**:浏览器 ↔ CDN 边缘 使用 HTTPSCDN 边缘 ↔ 源站 使用 HTTPS但不验证源站证书的 CA 链和域名匹配,可使用自签名证书​.
Cloudflare Docs
- **Full (strict)**:浏览器 ↔ CDN 边缘 使用 HTTPSCDN 边缘 ↔ 源站 使用 HTTPS严格验证源站证书是否由受信任 CA 签发且域名匹配,不支持自签名证书​.
Cloudflare Docs
- **Off**:关闭 HTTPS加密支持完全关闭.
若您选择 Full 或 Flexible 模式即使源站使用自签名证书CDN 也不会在边缘层对其进行验证,仍会正常转发和缓存内容;而用户浏览器只会看到 CDN 边缘提供的受信任证书,因此不会出现“不受信任”警告​.
> 为什么浏览器会信任? 浏览器内置了受信任的根证书列表CDN 边缘出示的证书链会完整地链接到某个系统信任根,而您的自签名证书则不在此列表内,因而只有源站连接可被 CDN 信任,而非终端浏览器​.CDN 则作为“可信中间人”,它信任自签名证书以加密与源站的通信,而浏览器仅信任 CDN 边缘的 CA 签发证书,二者互不干扰,有效隔离了自签名的风险.
### 如何开启Full (Strict)模式?
​要在 Cloudflare 上启用 Full (Strict) 模式,以确保 CDN 与源站之间的通信既加密又验证证书的有效性,请按照以下步骤操作:​
✅ 步骤 1确保源站配置了有效的 SSL/TLS 证书
在启用 Full (Strict) 模式之前,您的源站必须安装一个有效且受信任的 SSL/TLS 证书.​您可以选择以下方式之一:​
使用公共 CA 颁发的证书:如 Let's Encrypt、DigiCert、GlobalSign 等.
使用 Cloudflare Origin CA 证书:这是 Cloudflare 提供的免费证书,专为与其边缘节点通信设计.
确保证书未过期,且域名匹配正确.如果使用 Cloudflare Origin CA 证书,请在源站服务器上正确安装,并配置服务器(如 Nginx、Apache以使用该证书.
✅ 步骤 2在 Cloudflare 仪表板中启用 Full (Strict) 模式
```
登录到您的 Cloudflare 仪表板.
选择您要配置的站点.
在左侧菜单中,点击 “SSL/TLS”.
在 “概览Overview” 标签下,找到 “SSL/TLS 加密模式SSL/TLS encryption mode”.
选择 “Full (Strict)” 模式.
```
更改后Cloudflare 会立即应用此设置.​建议等待几分钟,然后通过浏览器访问您的网站,确保一切正常运行.
🔗 注意事项
如果源站使用的是自签名证书或过期的证书,启用 Full (Strict) 模式后Cloudflare 将无法建立连接,用户可能会看到 526 错误.
确保源站服务器的时间设置正确,以避免因时间不一致导致的证书验证失败.
## DNSSEC是什么
DNSSECDomain Name System Security Extensions域名系统安全扩展是一组为 DNS 协议设计的安全机制,旨在通过数字签名验证 DNS 数据的真实性和完整性,防止域名解析过程中的数据篡改和伪造.
1. DNSSEC 的工作原理
DNSSEC 通过引入以下关键机制来增强 DNS 的安全性:​
- 数字签名RRSIG 记录):​每个 DNS 记录集(如 A、MX、CNAME 等)都会生成一个对应的数字签名,确保记录在传输过程中未被篡改.
- 公钥发布DNSKEY 记录):​用于存储验证数字签名所需的公钥.​这些公钥本身也通过上级域的签名进行验证,形成信任链.
- 委派签名者DS 记录):上级域使用 DS 记录存储下级域的 DNSKEY 记录的摘要,确保公钥的真实性.
- 不存在性证明NSEC/NSEC3 记录):用于明确指示某个 DNS 记录不存在,防止攻击者伪造不存在的记录.
通过这些机制DNSSEC 建立了一条从根域开始的信任链,逐级验证每个域的 DNS 数据,确保其未被篡改且来源可信.
2. DNSSEC 的局限性
- 不加密数据内容DNSSEC 仅对 DNS 数据进行签名验证,并不加密查询和响应内容,因此无法防止数据被监听.
- 部署复杂性:​实施 DNSSEC 需要域名注册商、DNS 服务提供商和客户端解析器的共同支持,部署和维护相对复杂.
- 性能影响由于引入了额外的签名验证过程DNSSEC 可能会增加 DNS 查询的响应时间和系统资源消耗.
3. DNSSEC 的优势
- 防止 DNS 欺骗和缓存投毒:​通过验证 DNS 数据的真实性DNSSEC 能有效防止攻击者伪造 DNS 响应,将用户引导至恶意网站.
- 增强互联网基础设施安全性作为互联网信任体系的一部分DNSSEC 为其他安全协议(如 DANE提供基础支持.
## CDN的位置选择
Netlify在考虑到CDN成本以及可用性的情况下选择了以下这些地区以保证全球大部分访客访问他们的服务都能有不错的连接性和访问速度。
```
欧洲中部(德国法兰克福)
南美(巴西圣保罗)
美东(美国弗吉尼亚)
美西(美国旧金山)
亚洲(新加坡)
大洋洲(澳大利亚悉尼)
```
那么Netlify为什么会选择把CDN节点放到这些地区呢
1.弗吉尼亚,美东的弗吉尼亚被誉为“全球数据中心之都",美国政府对这个地区的网络投入非常大,使得弗吉尼亚的全球互联(美国本土、欧洲以及到南美洲)优秀。
2.旧金山,面向亚太和美西的访客。需要注意的是美西对亚太的网络连接比较优秀,但是到南美不太理想,甚至还有丢包的情况。
3.法兰克福,面向欧洲用户,德国法兰克福或者荷兰阿姆斯特丹都是不错的选择。
4.新加坡,亚太地区数据中心的枢纽,到印度、日本、越南、香港、中国移动的联通性都不错。
5.悉尼,土澳出了名的国际互联不太好,悉尼节点主要是服务本地和周边。
6.圣保罗,南美市场。
## 常见CDN的IP列表
> 需要注意的是有些CDN的回源IP并不用作节点IP比如Cloudflare的回源IP仅作回源IP使用如果要获取Cloudflare的节点IP可前往https://bgp.tools/as/13335#prefixes。而有些CDN的回源IP同时被用作CDN节点比如BunnyCDN和Gcore CDN。
Cloudflare
```bash
# https://www.cloudflare.com/ips-v4
103.21.244.0/22
103.22.200.0/22
103.31.4.0/22
104.16.0.0/13
104.24.0.0/14
108.162.192.0/18
131.0.72.0/22
141.101.64.0/18
162.158.0.0/15
172.64.0.0/13
173.245.48.0/20
188.114.96.0/20
190.93.240.0/20
197.234.240.0/22
198.41.128.0/17
# https://www.cloudflare.com/ips-v6
2400:cb00::/32
2405:8100::/32
2405:b500::/32
2606:4700::/32
2803:f800::/32
2a06:98c0::/29
2c0f:f248::/32
```
Gcore
```bash
https://api.gcore.com/cdn/public-ip-list
```
BunnyCDN
```bash
https://api.bunny.net/system/edgeserverlist
https://api.bunny.net/system/edgeserverlist/plain
```
Cloudfront
```bash
https://d7uri8nf7uskq.cloudfront.net/tools/list-cloudfront-ips
https://files.imunify360.com/static/whitelist/v2/cloudfront-cdn.txt
```
CDN77
```bash
https://files.imunify360.com/static/whitelist/v2/cdn77.txt
```
Fastly
```bash
https://api.fastly.com/public-ip-list
```
Keycdn
```bash
https://www.keycdn.com/shield-prefixes.json
```
quic.cloud
```bash
https://quic.cloud/ips
```
Google CDN
```bash
https://files.imunify360.com/static/whitelist/v2/google-cdn.txt
```
CacheFly
```bash
https://cachefly.cachefly.net/ips/cdn.txt
```
Akaima
```bash
https://techdocs.akamai.com/origin-ip-acl/docs/update-your-origin-server
```
---
**Done.**

103
content/Network-ssl.md Normal file
View File

@@ -0,0 +1,103 @@
+++
title = "网络艺术:SSL/TLS证书"
date = 2024-02-15
[taxonomies]
tags = ["Network"]
+++
前言 什么是SSL/TLS证书它有什么作用如何部署
<!-- more -->
## 什么是SSL/TLS证书
SSL 的全称是 ``Secure Sockets Layer``(安全套接字层),而 TLS 的全称是 ``Transport Layer Security``(传输层安全协议)。最初由 Netscape 开发的 SSL 协议用于保护网络通信,但由于其存在的安全漏洞,后来被更新、更安全的 TLS 协议所取代。
如今当我们谈论“SSL 证书”时,实际上指的是支持 TLS 协议的数字证书,``两者在功能上没有本质区别,只是在命名上沿用了历史传统``。该证书是由受信任的数字证书颁发机构 CA在验证服务器身份后颁发且具有服务器身份验证和数据传输加密功能。简单来说就是``HTTP+SSL/TLS证书=HTTPS.``
## SSL证书是如何工作的
- 当我们点击一个超链接HTTP浏览器帮我们跳转到新标签页
- 通过DNSDomain name system查询找到该域名地址栏中的如www.xxx.com之类的字符对应的IP地址可能是某个CDN的地址
- 服务器上已经配置好certificate.crt公钥和private.key私钥
- CDN随后与真正的服务器建立连接服务器上的反向代理可能是nginx或者caddy检测连接并用配置好的证书将连接升级为HTTPS
- HTTPS握手并将内容显示在浏览器上。
## SSL/TLS证书的握手过程
- 客户端发送"ClientHello"消息包含支持的加密算法和TLS版本
- 服务器回应"ServerHello"消息选择加密算法并发送SSL/TLS证书
- 客户端验证证书的有效性(通过内置的CA根证书)
- 客户端使用服务器公钥加密一个"预主密钥"并发送给服务器;
- 双方根据预主密钥生成会话密钥;
- 使用会话密钥进行加密通信;
- 加密通信:握手完成后,所有数据传输都使用协商好的对称密钥加密。
> 使用公钥加密的数据只能用对应的私钥解密,使用私钥加密(签名)的数据可以用对应的公钥验证。
> 客户端和服务器都支持非常多的密码套件比如“ECDHE-RSA-AES256-GCM-SHA384”。格式是“密钥交换算法 + 签名算法 + 对称加密算法 + 摘要算法”,这个密码套件的意思就是:“握手时使用 ECDHE 算法进行密钥交换,用 RSA 签名和身份认证,握手后的通信使用 AES 对称算法,密钥长度 256 位,分组模式是 GCM摘要算法 SHA384 用于消息认证和产生随机数。”
## CA证书
可以看到验证证书的有效性需要通过CA证书由CA机构如DigiCert
Let's Encrypt等颁布CA证书的层级结构如下
- 根CA证书最高级别的证书自签名是整个信任链的起点.
- 中间CA证书由根CA签发可以签发终端实体证书或其他中间CA证书.
- 终端实体证书由根CA或中间CA签发给网站、服务器等实体使用.
操作系统和浏览器``内置了受信任的根CA证书列表``,当验证网站证书时系统会沿着证书链向上追溯至根CA;如果能找到一个受信任的根CA且证书链上所有签名有效则验证通过.这就是保护我们上网安全的``信任链``的基础。
当我们访问网页时,往往会看到左上角的``锁``图标,里面是``Google Trust Services``或者``DigiCert Inc``等等代表证书的颁发来源。如果锁提示不安全可能是证书过期或者找不到CA证书即有可能是自签名证书。``什么是自签名证书?``
## 证书颁发
我们先来看证书颁发的流程。
- 证书申请:网站所有者向证书颁发机构(CA)申请SSL/TLS证书提供域名和组织信息。
- 身份验证CA验证申请者的身份和域名所有权。验证方式包括域名验证(DV)、组织验证(OV)或扩展验证(EV)。
- 证书签发验证通过后CA使用其私钥为申请者签发数字证书包含公钥、域名信息、颁发者信息和有效期等。
- 安装部署网站管理员将证书安装到Web服务器上。
可以看到过程有点麻烦,个人建站的话往往使用自签名证书,即``ssh-keygen``生成的公钥和私钥由于没有CA所以会显示不安全。
## 申请证书
- [sslforfree](https://www.sslforfree.com/)由 ZeroSSL 支持颁发的免费SSL证书.
- 通过[AMH](https://amh.sh/ssl.htm)提供的自助在线申请服务申请SSL通配符证书.需要注册AMH账号.
- [letsencrypt](https://letsencrypt.osfipin.com/)支持申请多渠道SSL证书.
- 借助[Punchsalad](https://punchsalad.com/ssl-certificate-generator/)提供的在线服务申请SSL证书无需登录仅需邮箱即可完成SSL通配符证书申请和签发.
## DV/OV/EV SSL证书的区别
以下是三种主要SSL证书验证类型的对比
| 特性 | 域名型SSL (DV SSL) | 企业型SSL (OV SSL) | 增强型SSL (EV SSL) |
|------|-------------------|-------------------|-------------------|
| **验证级别** | 最低 | 中等 | 最高 |
| **验证内容** | 仅验证域名所有权 | 验证域名所有权和组织信息 | 最严格的验证,包括法律、物理和运营存在的全面验证 |
| **验证流程** | 自动化验证邮件、DNS记录等 | 半自动验证 | 人工审核为主 |
| **签发时间** | 几分钟到数小时 | 1-3个工作日 | 5-7个工作日 |
| **浏览器显示** | 普通锁图标 | 普通锁图标 | 地址栏绿色显示(部分浏览器已取消) |
| **适用场景** | 个人博客、信息网站 | 企业网站、电子商务 | 银行、金融机构、大型电商 |
| **成本** | 低 | 中等 | 高 |
| **信任度** | 基本 | 中等 | 最高 |
| **证书信息** | 只包含域名信息 | 包含组织名称和域名 | 包含完整的组织详细信息 |
| **安全加密强度** | 相同 | 相同 | 相同 |
## 证书类型
有时候可以购买如``*.xxx.com``的通配符证书即一个证书通用与所有子域名。以及还有其他如多域名证书和上面提到的DV/OV/EV证书的类型。
| 证书类型 | 覆盖范围 | 安全级别 | 验证过程 | 适用场景 | 价格范围 |
|---------|---------|---------|---------|---------|---------|
| 单域名证书 | 仅一个特定域名 | 基本到高 | DV/OV/EV | 个人网站或小型企业 | 低到高 |
| 通配符证书 | 主域名及其所有一级子域名 | 基本到中等 | DV/OV | 拥有多个子域名的网站 | 中等到高 |
| 多域名证书(SAN) | 多个不同域名 | 基本到高 | DV/OV/EV | 管理多个不相关域名的企业 | 中等到高 |
| 自签名证书 | 任意 | 低 | 无需验证 | 测试环境、内部网络 | 免费 |
---
**Done.**

View File

@@ -1,112 +0,0 @@
+++
title = "网络艺术:Syncthing 使用指南"
date = 2025-04-17
[taxonomies]
tags = ["Network"]
+++
前言 在多设备使用的时代我们常常需要在电脑、服务器、笔记本之间同步文件。常见方案包括网盘、WebDAV、rsync 等,但这些方案要么依赖中心服务器、要么配置复杂、要么对实时性不友好。
<!-- more -->
## 介绍
**Syncthing** 是一款开源、去中心化、点对点P2P的文件同步工具主打 **安全、私有、实时同步**。与传统网盘不同Syncthing 不依赖任何中心服务器,所有数据直接在你的设备之间传输。
Syncthing 具有以下特点:
- ``去中心化``:设备之间点对点同步,不依赖第三方服务器;
- ``安全``:所有通信均使用 TLS 加密,并基于设备 ID 认证;
- ``跨平台``:支持 Windows、Linux、macOS、Android 等;
- ``实时同步``:文件变化可实时同步到其他设备;
- ``Web 管理界面``:通过浏览器即可完成绝大多数配置;
- ``开源``:代码完全开源,社区活跃。
## Windows
Windows 下推荐直接使用[SyncthingWindowsSetup](https://github.com/Bill-Stewart/SyncthingWindowsSetup)安装,会自动下载最新的syncthing二进制并设置系统服务。
- Web UI 默认地址:
```bash
http://127.0.0.1:8384
```
## Arch Linux
- 使用paru包管理器安装
```bash
paru -S syncthing
```
- 创建 systemd 用户服务
```bash
sudo systemctl enable --now syncthing@<你的用户名>.service
```
- 查看状态:
```bash
systemctl --user status syncthing.service
```
- Web UI 默认地址:
```bash
http://127.0.0.1:8384
```
## NixOS
NixOS 自带 Syncthing 模块,配置非常优雅。
```nix
{ lib, pkgs, username, ... }:
{
services.syncthing = {
enable = true;
user = username;
dataDir = "/home/${username}/Sync";
configDir = "/home/${username}/.config/syncthing";
guiAddress = "127.0.0.1:8384";
};
}
```
- 服务状态查看:
```bash
systemctl status syncthing.service
```
## 基本使用
Syncthing 的所有核心操作都可以通过 Web UI 完成,进入 Web UI 后先设置用户名和密码:
```bash
http://127.0.0.1:8384
```
### 添加设备
- 在本机和另一台设备上启动 Syncthing
- 分别设置同步文件夹注意ID要相同
- 复制对方的 **设备 ID**
- 在 Web UI 中点击「添加远程设备」;
- 双方确认后即可开始同步。
### 文件夹同步模式
Syncthing 支持多种同步模式:
* **Send & Receive**:双向同步(默认)
* **Send Only**:只向外同步
* **Receive Only**:只接收更改
---
**Done.**

View File

@@ -0,0 +1,78 @@
+++
title = "乱七八糟:常见发音错误术语集合"
date = 2023-08-25
[taxonomies]
tags = ["乱七八糟"]
+++
前言 中文和英语发音习惯不同,容易引起误解。本文旨在帮助您准确发音常见的科技术语,欢迎随时补充。
<!-- more -->
**常见发音错误指南:公司/产品名**
- Youtube: 正确念法是 "You-tube" [tju:b],而不是 "优吐毙",应该是 "优tiu啵"。
- Skype: 应该念为 [ˈskaɪp],而不是 "死盖屁",应该是 "死盖破"。
- Adobe: 正确的发音是 [əˈdəʊbi],不是 "阿斗伯",而是 "阿兜笔"。
- C#: 应该念为 "C Sharp",即"C煞破"。
- GNU: 正确的发音是 [(g)nuː] 即"哥怒"。
- GUI: 应该念为 [ˈɡui],即"故意"。
- JAVA: 正确的发音是 [ˈɑːvə],而不是 "夹蛙",应该是 "扎蛙"。
- AJAX: 应该念为 [ˈeɪdʒæks],而不是 "阿贾克斯",应该是 "诶(ei) 贾克斯"。
- Ubuntu: 正确的发音是 [uˈbuntuː],而不是 "友邦兔",应该是 "巫不恩兔"。
- Debian: 应该念为 [ˈdɛbiən],即"得(dei)变"。
- Linux: 正确的发音有两种,[ˈlɪnəks] 或 [ˈlɪnʊks]"丽娜克斯" 或 "李扭克斯"都可以。
- LaTeX: 正确的发音是 [ˈleɪtɛk] 或 [ˈleɪtɛx] 或 [ˈlɑːtɛx] 或 [ˈlɑːtɛk],即"雷泰克" 或 "拉泰克"。
- GNOME: 念法可以是 [ɡˈnoʊm] 或 [noʊm],即"格弄姆" 或 "弄姆"。
- App: 应该念为 [ˈæp],即 "阿破"。
- null: 正确的发音是 [nʌl],即"闹"。
- jpg: 应该念为 [ˈdʒeɪɡ],而不是 "勾屁记",应该是 "zhei派个"。
- WiFi: 正确的发音是 [ˈwaɪfaɪ],即"歪fai"。
- mobile: 念法可以是 [moˈbil] 或 [ˈmoˌbil] 或 [ˈməubail],即"膜拜哦" 或 "牟bou"。
- integer: 正确的发音是 [ˈɪntɪdʒə],而不是 "阴太阁儿",应该是 "音剃摺儿"。
- cache: 应该念为 [kæʃ],而不是 "卡尺",即"喀什"。
- @: 应该念为 "at"。
- Tumblr: 应该念为 "Tumbler",而不是 "贪不勒"。
- nginx: 正确的发音是 "Engine X",应该是 "恩静 爱克斯"。
- Apache: 应该念为 [əˈpætʃiː],即"阿趴气"。
- Lucene: 正确的发音是 [ˈluːsin],即"鲁信"。
- MySQL: 应该念为 [maɪ ˌɛskjuːˈɛl] 或 [maɪ ˈsiːkwəl],可以是 "买S奎儿" 或 "买 吸扣"。
- Exposé: 念法可以是 [ɛksˈpəʊzeɪ]重音在Z上。
- RFID: 官方念法是四个字母分开读 "R F I D"。
- JSON: 应该念为 "jason",即"zhei森"。
- Processing: 重音在 "Pro" 上。
- avatar: 正确的发音是 [ˌævə'tɑr],即"艾瓦塌儿"。
## 后记
虽然许多的词汇常常被错误发音但在中国遵守拼音原则是入乡随俗的一种表现且往往并没有所谓的官方读法不必太过于纠结100%纯正的读法。

View File

@@ -146,60 +146,6 @@ git gc --aggressive --prune=now
# 重新推送到github
git push --force --mirror
```
当然这样还是不够智能因此现在的方法是写一个GitHub Actions
```bash
name: Blog CI (Zola)
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Zola
uses: taiki-e/install-action@v2
with:
tool: zola
- name: Install Pagefind
run: |
wget https://github.com/Pagefind/pagefind/releases/download/v1.4.0/pagefind-v1.4.0-x86_64-unknown-linux-musl.tar.gz
tar xvf pagefind-v1.4.0-x86_64-unknown-linux-musl.tar.gz
sudo mv pagefind /usr/local/bin/
- name: Build Zola
run: zola build
- name: Build Pagefind
run: pagefind --site public --root-selector body
- name: Push public to dist
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: dist
force_orphan: true
```
这个action会自动在每次commit之后运行下载zola并使用zola对仓库进行构建随后构建出public文件夹在dist分支中并且dist分支只保留一次commit这样做的好处有
- 自动云端构建无须本地再安装zola
- 构建Public在dist分支git仓库大小不会膨胀
- 灵活可修改支持各种框架包括Hugo/Hexo等等.
> 注意需要在GitHub的仓库设置中的``Actions-General-Workflow permissions``中打开``Read and write permissions``否则actions无法对仓库进行读写.
## 🔗

View File

@@ -50,16 +50,18 @@ Enter file in which to save the key (/home/dich/.ssh/id_rsa): /home/dich/.ssh/Gi
```bash
# GitHub
Host github github.com
Host github
HostName github.com
User git
IdentityFile ~/.ssh/github
IdentityFile ~/.ssh/Github
# Gitee
Host gitee gitee.com
Host gitee
HostName gitee.com
User git
IdentityFile ~/.ssh/gitee
IdentityFile ~/.ssh/Gitee
```
> 这边的IdentityFile是你的私钥位置即为不带pub后缀的文件。如果你不想将私钥放在~/.ssh/下,可以查看我的另一篇[博客](https://blog.dich.bid/network-ssh/)

View File

@@ -1,124 +0,0 @@
+++
title = "乱七八糟:Github的使用"
date = 2025-08-24
[taxonomies]
tags = ["乱七八糟"]
+++
前言 对于GitHub相信我们都不陌生。本文介绍GitHub上许多好用的服务和资源。
<!-- more -->
## Github Gist
GitHub Gist 是 GitHub 提供的代码片段服务,用来``存放单个或少量文件的代码/文本``(如示例代码、配置片段、日志、临时笔记等)。
官方说明是
```
Instantly share code, notes, and snippets.
```
和 repo 相同的是gist 也分为``public``和``private``
我们可以从一个简单的书签同步服务来实践:
1. 创建一个gist权限为 private; 随后可以看到类似``Dichgrem / gist:37f2ebad89923d49d8854c368d7f5c91``gist后面这一串就是GistID
2. 在这个[界面](https://github.com/settings/tokens)创建一个token选择开启gist权限
3. 安装这个书签同步[浏览器扩展](https://www.github.com/dudor/BookmarkHub)
3. 将tokens 和 前面的 GistID 复制到这个浏览器扩展中;
4. 随后可以使用这个插件进行书签同步。
> 原理使用浏览器api提取出书签向 gist 仓库进行上传gist仓库验证 tokens 后保存,在另一个浏览器中用同样的插件进行下载,即可同步.
## GitHub Pages
GitHub Pages 是 GitHub 提供的静态托管服务,常常用于快速部署纯前端网站。
比如你有一个 Vue 写的网站仓库,在该仓库的``设置-Build and deployment``下选择source选择分支并将public目录部署到GitHub Pages随后会得到一个类似dichgrem.github.io 的域名,即可看到网站。
当然你也可以绑定自己的域名在custom dommain下添加并在你的dns解析处添加对应的CNAME记录。
> 具体流程可以参考Hexo的[文档](https://hexo.io/zh-cn/docs/github-pages)
> GitHub Pages 的限制
- 不能运行后端代码
- 站点大小有限制
- 构建和发布有时间限制
- 私有仓库 Pages 需要付费计划
## Github actions
GitHub Actions 是 GitHub 提供的 CI/CD 与自动化平台,用于``在代码仓库中自动执行任务,比如测试、构建、发布、部署``等。
听起来有点抽象实际上就是在仓库的这个位置放入一个yml文件 ``.github/workflows/*.yml``,比如
```bash
name: C Build
on:
push:
pull_request:
workflow_dispatch:
jobs:
build-and-run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Show compiler version
run: gcc --version
- name: Build
run: gcc -O2 -Wall -Wextra -std=c11 -o app main.c
- name: Run
run: ./app
```
这个文件的意思就是
- 触发条件push / pull_request / 手动触发
- actions/checkout@v4:拉取仓库代码
- gcc ... main.c将main.c编译成产物 app
- ./app运行确保编译出来的程序能执行
把本地的环境迁移到github的runner中这样做有几个好处
- 统一了编译环境,不用考虑开发成员之间的环境区别;
- 将构建自动化,开发者可以专注于代码,新人也可以快速上手;
- 自动发布到release极大方便了项目管理;
- GitHub Actions提供许多现有的steps类似乐高积木的体验;
> GitHub Actions的限制
- public仓库通常没有限制
- privat仓库为2,000 分钟500 MB
## GitHub Copilot
从11月起GitHub首页增加了AI对话功能调用的就是 [GitHub Copilot](https://github.com/features/copilot)。
GitHub Copilot 是一个 AI 驱动的 智能编码助手,由 GitHub 和 OpenAI 联合开发。可以调用GPT/gemini/Claude等多家模型.
你可以在vscode中下载copilot插件并使用它会给你带来自动补全以及按照上下文生成整段代码的功能.
> 现在copilot已经开源并且在vscode中自带直接登录就可以使用无须手动下载.
> GitHub Copilot的限制
- 免费版本约 2,000 次代码自动完成completions —— 即 Copilot 在 IDE 里根据你的输入生成代码的次数。
- 约 50 次 Copilot Chat 消息 / 会话请求 —— 即和 Copilot Chat 对话或高级问答次数。
---
**Done.**

View File

@@ -22,17 +22,6 @@ tags = ["乱七八糟"]
- **cn 域名有被停用的风险**。2008 年,有人以跳水奥运冠军吴敏霞拼音注册了 wuminxia.cn[结果被中国互联网络信息中心CNNIC回收了域名](https://www.cnbeta.com/articles/tech/62209.htm),并转交给国家体育总局。此域名在 2021 年 2 月 28 日被优视科技[注册](https://whois.cnnic.cn/WhoisServlet?queryType=Domain&domain=wuminxia.cn)呵呵。2009 年,牛博网被域名注册商万网停止解析。
## VPS
- 名称格式
```
日本-GreenCloud-2C-4G-22G-SSD-1.5Tb@10Gbps-$60-3year
## 国家-公司-CPU-内存-硬盘-硬盘类型-流量@端口速度-价格-付费周期
```
- 初始化
```bash
# 更新系统
apt update && apt upgrade -y

View File

@@ -1,29 +1,95 @@
+++
title = "乱七八糟:VScode那些事"
title = "乱七八糟:常用实用快捷键"
date = 2024-05-23
[taxonomies]
tags = ["乱七八糟"]
+++
前言 VScode 素有世界最强IDE之称有着丰富的插件系统优秀的图形界面和极快的响应速度本文介绍VSCode的一些使用技巧
前言 在日常使用浏览器时,掌握一些快捷键和技巧可以节省大量时间,提高工作和学习效率。通过学习和实践,能够更加轻松地应对各种网页浏览场景,让浏览器成为工作和学习的得力助手
<!-- more -->
## AI 插件
## 浏览器快捷键
| 插件名 | 免费 | 付费 | 单模型 | 多模型 | 说明 |
| ---------------------------------------------------------------------------------------- | :-----------: | :--------: | :-: | :-: | ------------------------------------------------------- |
| **[GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot)** | ✔️(试用 / 学生优惠) | ✔️ | | ✔️ | 主流 AI 编码助手,支持代码补全和聊天建议。([Visual Studio Marketplace][1]) |
| **[GPT (ChatGPT)](https://open-vsx.org/extension/openai/chatgpt)** | ✔️ | ✔API 模型) | ❌ | ✔️ | 基于 OpenAI 的 ChatGPT可做代码解释/对话生成 |
| **[Gemini Code Assist](https://open-vsx.org/extension/Google/geminicodeassist)** | ✔️ | | ❌ | ✔️ | Google Gemini 驱动的智能编码助手 |
| **[Claude Code](https://open-vsx.org/extension/Anthropic/claude-code)** | ❓(账户权限) | ✔️ | ❌ | ✔️ | Anthropic Claude 驱动的编码助手 |
| **[Cline (claude-dev)](https://open-vsx.org/extension/saoudrizwan/claude-dev)** | ✔️ | | ❌ | ✔️ | 社区版 Claude 型 AI 编码插件 |
| **[CodeGeeX](https://open-vsx.org/extension/AMiner/codegeex)** | ✔️ | ❌ | ❌ | ✔️ | 开源多模型 AI код助手 |
| **[OpenCode](https://open-vsx.org/extension/sst-dev/opencode)** | ✔️ | ❌ | ❌ | ✔️ | 多模型聚合,可接多种后端 |
| **[Windsurf (Codeium)](https://open-vsx.org/extension/Codeium/codeium)** | ✔️ | ❌ | ❌ | ✔️ | 轻量级 AI 代码补全助手Codeium 改名) |
### 常用
| 快捷键 | 描述 |
|----------------------|------------------|
| Ctrl + A | 全选 |
| Ctrl + C | 复制 |
| Ctrl + X | 剪切 |
| Ctrl + V | 粘贴 |
| Ctrl + F | 查找 |
| Ctrl + Q | 退出 |
| Ctrl + T | 新建标签页 |
| Ctrl + W | 关闭标签页 |
| Ctrl + N | 新建窗口 |
| Ctrl + Shift + P | 新建隐私浏览窗口 |
### 历史
| 快捷键 | 描述 |
|-------------------------|----------------------------|
| Ctrl + H | 历史侧栏 |
| Ctrl + Shift + H | 我的足迹窗口(历史) |
| Ctrl + Shift + Del | 清除最近历史记录 |
### 书签
| 快捷键 | 描述 |
|-------------------------------|------------------------------------|
| Ctrl + D | 将此页加为书签 |
| Ctrl + I | 页面信息 |
| Ctrl + Shift + O | 显示全部书签(我的足迹窗口) |
| Ctrl + B / Ctrl + Shift + B | 书签侧栏 / 顶栏 |
### 下载与插件
| 快捷键 | 描述 |
|----------------------|----------------|
| Ctrl + Shift + Y | 下载 |
| Ctrl + Shift + A | 附加组件 / 插件 |
### 控制台与开发
| 快捷键 | 描述 |
|----------------------|------------------|
| Ctrl + Shift + K | Web 控制台 |
| Ctrl + Shift + C | 查看器 |
| Shift + F7 | 样式编辑器 |
| Shift + F5 | 分析器 |
| Ctrl + Shift + E | 网络 |
| Ctrl + U | 页面源码 |
| Ctrl + Shift + J | 浏览器控制台 |
### 标签页与界面
| 快捷键 | 描述 |
|-------------------------------|--------------------------|
| Ctrl + S | 界面保存 |
| Ctrl + + | 放大 |
| Ctrl + - | 缩小 |
| Ctrl + 0 | 重置缩放 |
| Ctrl + K / J | 搜索 |
| Ctrl + Home / End | 到文件头 / 尾 |
| Ctrl + Page Up | 切换到左边标签页 |
| Ctrl + Page Down | 切换到右边标签页 |
| Ctrl + Shift + Page Up | 当前标签页左移 |
| Ctrl + Shift + Page Down | 当前标签页右移 |
### 其他操作
| 快捷键 | 描述 |
|--------------------|------------------|
| Alt + Space | KDE 搜索栏 |
| Alt + → / ← | 前进 / 后退 |
| Alt + 数字键 | 选择标签页18|
| Alt + M | 静音 |
| End | 到达页尾 |
| Home | 到达页首 |
| F6 | 地址栏 |
[1]: https://marketplace.visualstudio.com/items?itemName=GitHub.copilot&utm_source=chatgpt.com "GitHub Copilot"
## VS Code 快捷键
@@ -236,87 +302,5 @@ tags = ["乱七八糟"]
- **函数提示**
- 在悬停窗口上按下 `cmd`:提示函数的实现
## 浏览器快捷键
### 常用
| 快捷键 | 描述 |
|----------------------|------------------|
| Ctrl + A | 全选 |
| Ctrl + C | 复制 |
| Ctrl + X | 剪切 |
| Ctrl + V | 粘贴 |
| Ctrl + F | 查找 |
| Ctrl + Q | 退出 |
| Ctrl + T | 新建标签页 |
| Ctrl + W | 关闭标签页 |
| Ctrl + N | 新建窗口 |
| Ctrl + Shift + P | 新建隐私浏览窗口 |
### 历史
| 快捷键 | 描述 |
|-------------------------|----------------------------|
| Ctrl + H | 历史侧栏 |
| Ctrl + Shift + H | 我的足迹窗口(历史) |
| Ctrl + Shift + Del | 清除最近历史记录 |
### 书签
| 快捷键 | 描述 |
|-------------------------------|------------------------------------|
| Ctrl + D | 将此页加为书签 |
| Ctrl + I | 页面信息 |
| Ctrl + Shift + O | 显示全部书签(我的足迹窗口) |
| Ctrl + B / Ctrl + Shift + B | 书签侧栏 / 顶栏 |
### 下载与插件
| 快捷键 | 描述 |
|----------------------|----------------|
| Ctrl + Shift + Y | 下载 |
| Ctrl + Shift + A | 附加组件 / 插件 |
### 控制台与开发
| 快捷键 | 描述 |
|----------------------|------------------|
| Ctrl + Shift + K | Web 控制台 |
| Ctrl + Shift + C | 查看器 |
| Shift + F7 | 样式编辑器 |
| Shift + F5 | 分析器 |
| Ctrl + Shift + E | 网络 |
| Ctrl + U | 页面源码 |
| Ctrl + Shift + J | 浏览器控制台 |
### 标签页与界面
| 快捷键 | 描述 |
|-------------------------------|--------------------------|
| Ctrl + S | 界面保存 |
| Ctrl + + | 放大 |
| Ctrl + - | 缩小 |
| Ctrl + 0 | 重置缩放 |
| Ctrl + K / J | 搜索 |
| Ctrl + Home / End | 到文件头 / 尾 |
| Ctrl + Page Up | 切换到左边标签页 |
| Ctrl + Page Down | 切换到右边标签页 |
| Ctrl + Shift + Page Up | 当前标签页左移 |
| Ctrl + Shift + Page Down | 当前标签页右移 |
### 其他操作
| 快捷键 | 描述 |
|--------------------|------------------|
| Alt + Space | KDE 搜索栏 |
| Alt + → / ← | 前进 / 后退 |
| Alt + 数字键 | 选择标签页18|
| Alt + M | 静音 |
| End | 到达页尾 |
| Home | 到达页首 |
| F6 | 地址栏 |
---
**Done.**

View File

@@ -29,40 +29,47 @@ tags = ["综合工程"]
## 安装软件
随后安装常用开源软件,KDE环境和Wayland+WM环境安装的包不同
随后安装常用开源软件(KDE环境省略file和wayland)
```bash
# gui
paru -S floorp-bin keepassxc qemu-full virt-manager materialgram-bin legcord-bin onlyoffice-bin localsend-bin kazumi-bin foliate vlc krita qtscrcpy strawberry oculante obs-studio scx-manager
paru -S floorp-bin keepassxc qemu-full virt-manager materialgram-bin legcord-bin onlyoffice-bin localsend-bin kazumi-bin foliate vlc krita qtscrcpy strawberry oculante obs-studio scx-manager daed
# tui
paru -S neovim yazi lazygit btop zellij termshark
# cli
paru -S alacritty fastfetch onefetch starship atuin bat fzf fd ripgrep eza tree android-tools payload-dumper-go-bin nexttrace-bin syncthing aria2
# fish
fish tealdeer expac fish-autopair fish-pure-prompt fisher
paru -S alacritty fish fastfetch tealdeer expac fish-autopair fish-pure-prompt fisher onefetch starship atuin bat fzf fd ripgrep eza tree android-tools payload-dumper-go-bin nexttrace-bin syncthing aria2
# file
paru -S gvfs gvfs-mtp gvfs-afc gvfs-nfs nemo
# zip
paru -S peazip
# Type
paru -S fcitx5-configtool fcitx5-skin-material fcitx5-rime fcitx5-gtk
# ttf
paru -S ttf-jetbrains-mono-nerd ttf-sarasa-gothic-sc
```
# Blog
paru -S zola npm pnpm just go
# ttf
paru -S ttf-jetbrains-mono-nerd ttf-sarasa-gothic-sc
如果使用Wayland+WM方案需要额外安装以下这些
```bash
# Wayland
paru -S hyprland waybar network-manager-applet swww wl-gammarelay-rs brightnessctl easyeffects wireplumber pipewire blueman bluez-utils wl-clipboard-rs wl-clip-persist swaync swayosd swappy grim wlogout hyprlock hyprpolkitagent
# file
paru -S gvfs gvfs-mtp gvfs-afc gvfs-nfs nemo
```
| 分类 | 软件列表 |
| ------------ | ------------------------------------------------ |
| **窗口管理器** | hyprland |
@@ -192,47 +199,6 @@ menuentry "Windows 11 (Manual)" {
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
```
## 制服华硕VMD
华硕的BIOS有一个VMD选项它的机制是这样的如果你想安linux得先关闭VMD但如果你的windows是出厂自带的没有重装过那又得开启VMD否则无法进入windows这里记录在不关闭VMD的情况下如何让linux支持它(以arch linux为例)
先使用这个命令查看磁盘:
```
> lsblk -f
nvme1n1
├─nvme1n1p1 vfat FAT32 SYSTEM xxxx-xxxx
├─nvme1n1p2 ntfs OS
├─nvme1n1p3 ntfs 新加卷
├─nvme1n1p4 ntfs 新加卷
├─nvme1n1p5 ntfs 新加卷
├─nvme1n1p6 ntfs 新加卷
nvme0n1
├─nvme0n1p1
├─nvme0n1p2 ntfs 新加卷
└─nvme0n1p3 xfs xxxxxxxxxxxxxx
```
随后使用以下方法将VMD支持加入initramfs
```
## 挂载linux根分区
mount /dev/nvme0n1p3 /mnt
## 创建boot目录
mkdir -p /mnt/boot
## 挂载EFI
mkdir -p /mnt/boot/EFI
mount /dev/nvme1n1p1 /mnt/boot/EFI
## Chroot进入已经安装的系统
arch-chroot /mnt
## 重新生成 initramfs
nano /etc/mkinitcpio.conf
MODULES=(vmd nvme)
mkinitcpio -P
## 退出重启
exit
reboot
```
## Arch中安装QEMU虚拟机
前面我们已经安装了Qemu高性能虚拟机平台和virt-manager用来管理虚拟机的图形界面随后配置virt-manager并安装Ubuntu-server
@@ -333,12 +299,12 @@ Description=Aria2c - lightweight multi-protocol & multi-source command-line down
After=network.target
[Service]
User=<username>
Group=<groupname>
WorkingDirectory=/home/<username>
Environment=HOME=/home/<username>
Environment=USER=<username>
ExecStart=/usr/bin/aria2c --conf-path=/home/<username>/.config/aria2/aria2.conf
User=dich
Group=dich
WorkingDirectory=/home/dich
Environment=HOME=/home/dich
Environment=USER=dich
ExecStart=/usr/bin/aria2c --conf-path=/home/dich/.config/aria2/aria2.conf
Restart=always
NoNewPrivileges=true
PrivateTmp=true
@@ -383,21 +349,24 @@ net.ipv4.tcp_congestion_control = bbr
```
## 性能模式切换
需要安装``tlp-git tlp-pd-git tlp-rdw-git``
需要安装``power-profiles-daemon``
```bash
# 查看当前状态
tlp-stat -s
# 查看可用的电源配置文件profiles
powerprofilesctl list
# 查看当前正在使用的 profile
powerprofilesctl get
# 切换到“性能”模式
sudo tlp performance
sudo powerprofilesctl set performance
# 切换到“平衡”模式
sudo tlp balanced
sudo powerprofilesctl set balanced
# 切换到“省电”模式
sudo tlp power-saver
sudo powerprofilesctl set power-saver
```
## 其他可选性能优化
## 其他性能优化
```bash
Profilesyncdaemon

View File

@@ -578,17 +578,6 @@ nft list table ip mangle
- 关闭防火墙的禁止转发规则,全部允许;
- 将X86主路由的网线插到AP的任意一个LAN口。
## 更新所有包
```
opkg update
opkg list-upgradable \
| awk '{print $1}' \
| grep -vE '^(base-files|busybox|libc|libgcc|libstdc\+\+|procd|netifd|ubus|uci|kernel|kmod-|fstools|mtd|fwtool)$' \
| xargs -r opkg upgrade
```
## 🔗
- [Openwrt wiki](https://openwrt.org/zh/docs/start)

View File

@@ -1,5 +1,5 @@
+++
title = "Windows系列(0):系统安装与设置"
title = "Windows系列(1):系统安装与设置"
date = 2024-05-24
[taxonomies]
@@ -12,7 +12,7 @@ tags = ["Windows"]
## 总纲
安装Windows有两种情况:1.在一台全新的电脑上安装2.想为现有的系统更换版本。本文主要介绍这两种情况。如果只想对现有的系统进行优化,推荐看下一篇的``"Windows系列(1):常用操作与配置"``.
安装Windows有两种情况:1.在一台全新的电脑上安装2.想为现有的系统更换版本。本文主要介绍这两种情况。如果只想对现有的系统进行优化,推荐看下一篇的``"Windows系列(2):常用操作与配置"``.
**全新安装**
- 获得一个Windows的ISO镜像
@@ -178,7 +178,7 @@ tags = ["Windows"]
- **抓包**: [Wireshark](https://www.wireshark.org/download.html)
- **启动器**: [Flow.Launcher](https://github.com/Flow-Launcher/Flow.Launcher)
- **输入法**: [Rime](https://rime.im/download/)
- **浏览器**: [Floorp](https://github.com/Floorp-Projects/Floorp) / [Chrome](https://dl.google.com/tag/s/installdataindex/update2/installers/ChromeStandaloneSetup64.exe)
- **浏览器**: [Floorp](https://github.com/Floorp-Projects/Floorp) / [Chrome](https://www.google.com/chrome/)
- **编辑器**: [VSCodium](https://github.com/VSCodium/vscodium)
- **虚拟机**: HyperV
- **科学上网**: [GFS](https://github.com/GUI-for-Cores/GUI.for.SingBox)

View File

@@ -1,5 +1,5 @@
+++
title = "Windows系列(1):常用操作与配置"
title = "Windows系列(2):常用操作与配置"
date = 2024-05-25
[taxonomies]

View File

@@ -1,5 +1,5 @@
+++
title = "Windows系列(2):分类与激活"
title = "Windows系列(3):分类与激活"
date = 2024-05-26
[taxonomies]

View File

@@ -1,6 +1,6 @@
+++
title = "Windows系列(3):封装与全自动安装"
date = 2024-05-27
title = "Windows系列(4):封装与全自动安装"
date = 2024-05-29
[taxonomies]
tags = ["Windows"]

View File

@@ -1,177 +0,0 @@
+++
title = "Windows系列(4):高效操作与强化"
date = 2024-05-28
[taxonomies]
tags = ["Windows"]
+++
前言 本文记载windows下的常用快捷键与PowerShell强化配置.
<!-- more -->
## 快捷键
高效使用 Windows 的第一步,就是**减少鼠标依赖**。
Windows 自身已经内置了大量非常实用的快捷键,只是很多人并没有系统地使用过。
- **Alt + Tab**
在**已打开的窗口之间切换**(经典快捷键)
- **Win + Tab**
打开**任务视图**,可查看所有窗口与虚拟桌面
- **Alt + F4**
关闭当前窗口
> 在桌面下使用时可弹出关机 / 重启菜单
- **Win + D**
显示桌面 / 恢复窗口
- **Win + ↑ / ↓ / ← / →**
窗口最大化 / 最小化 / 左右分屏
- **Win + Shift + ← / →**
将当前窗口移动到另一个显示器
---
### 虚拟桌面
- **Win + Ctrl + D**
新建虚拟桌面
- **Win + Ctrl + ← / →**
在虚拟桌面之间切换
- **Win + Ctrl + F4**
关闭当前虚拟桌面
---
### 应用启动与系统
- **Win**
打开开始菜单,直接输入搜索应用
- **Win + R**
打开“运行”窗口
- **Win + E**
打开资源管理器
- **Win + I**
打开系统设置
- **Win + L**
锁屏
---
### 截图与录屏
- **Win + Shift + S**
截图(区域 / 窗口 / 全屏)
- **Win + PrtSc**
全屏截图并自动保存
- **Win + G**
打开 Xbox Game Bar可用于屏幕录制
---
### 常用编辑操作
- **Ctrl + C / V / X**
复制 / 粘贴 / 剪切
- **Ctrl + Z / Y**
撤销 / 重做
- **Ctrl + A**
全选
- **Ctrl + S**
保存
- **Ctrl + F**
查找
- **Ctrl + Shift + Esc**
直接打开任务管理器
## 启动器
有了窗口切换和关闭,还需要打开,这里推荐这两个:
- [Flow.Launcher](https://github.com/Flow-Launcher/Flow.Launcher)
- [ZeroLaunch-rs](https://github.com/ghost-him/ZeroLaunch-rs)
现在我们就可以使用``Win+Tab``切换窗口,使用``Alt+F4``关闭窗口,使用``Alt+Space``启动软件.
## Powershell强化
要达到类似Linux下``oh-myzsh+atuin+fzf+zoxide+starship``的效果,可以使用以下方法增强:
- 安装模块
```bash
winget install junegunn.fzf
fzf --version
winget install JanDeDobbeleer.OhMyPosh
oh-my-posh version
winget install ajeetdsouza.zoxide
zoxide --version
```
- 导入模块
```bash
Install-Module PSReadLine -Scope CurrentUser -Force
Install-Module posh-git -Scope CurrentUser -Force
Install-Module PSFzf -Scope CurrentUser -Force
```
- 写入配置
首先执行这个命令:
```bash
notepad $PROFILE
```
在打开的窗口中写入:
```bash
# ---------- PSReadLine ----------
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle InlineView
# ---------- Git ----------
Import-Module posh-git
# ---------- fzf ----------
Import-Module PSFzf
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
# ---------- zoxide ----------
Invoke-Expression (& { (zoxide init powershell | Out-String) })
# ---------- oh-my-posh ----------
oh-my-posh init pwsh | Invoke-Expression
# ---------- Bash-style line editing ----------
# Ctrl+A → 行首
Set-PSReadLineKeyHandler -Key Ctrl+a -Function BeginningOfLine
# Ctrl+E → 行尾
Set-PSReadLineKeyHandler -Key Ctrl+e -Function EndOfLine
# Ctrl+U → 删除从光标到行首
Set-PSReadLineKeyHandler -Key Ctrl+u -Function BackwardDeleteLine
# Ctrl+K → 删除从光标到行尾
Set-PSReadLineKeyHandler -Key Ctrl+k -Function ForwardDeleteLine
```
随后新开启一个PowerShell可以看到有Git提示ctrl+R唤起历史右方向键透明补全的效果.
---
**Done.**

View File

@@ -1,6 +1,6 @@
+++
title = "Windows系列(5):Python开发配置"
date = 2024-05-30
date = 2024-05-31
[taxonomies]
tags = ["Windows"]

View File

@@ -1,6 +1,6 @@
+++
title = "Windows系列(6):C/C++开发配置"
date = 2024-05-31
date = 2024-05-30
[taxonomies]
tags = ["Windows"]

View File

@@ -1,3 +1,4 @@
#!/usr/bin/env -S just --justfile
build:
zola build && pagefind --site public --root-selector body

View File

@@ -1,32 +0,0 @@
.copy-button {
position: absolute;
top: 8px;
right: 8px;
padding: 4px 10px;
font-size: 0.8rem;
font-family: DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
background: var(--accent);
color: var(--background);
border: none;
border-radius: 3px;
cursor: pointer;
opacity: 0;
transition: opacity 0.2s ease;
z-index: 1;
&:hover {
opacity: 1;
}
&.copied {
background: #4caf50;
}
}
pre:hover .copy-button {
opacity: 0.8;
}
pre:hover .copy-button:hover {
opacity: 1;
}

View File

@@ -7,7 +7,7 @@
@font-face {
font-family: 'Hack';
/* Use full version (not a subset) for unicode icon support */
src: url('fonts/hack-regular.woff2') format('woff2'), url('fonts/hack-regular.woff') format('woff');
src: url('fonts/hack-regular.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-regular.woff?sha=3114f1256') format('woff');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -15,7 +15,7 @@
@font-face {
font-family: 'Hack';
src: url('fonts/hack-bold-subset.woff2') format('woff2'), url('fonts/hack-bold-subset.woff') format('woff');
src: url('fonts/hack-bold-subset.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-bold-subset.woff?sha=3114f1256') format('woff');
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -23,7 +23,7 @@
@font-face {
font-family: 'Hack';
src: url('fonts/hack-italic-subset.woff2') format('woff2'), url('fonts/hack-italic-webfont.woff') format('woff');
src: url('fonts/hack-italic-subset.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-italic-webfont.woff?sha=3114f1256') format('woff');
font-weight: 400;
font-style: italic;
font-display: swap;
@@ -31,7 +31,7 @@
@font-face {
font-family: 'Hack';
src: url('fonts/hack-bolditalic-subset.woff2') format('woff2'), url('fonts/hack-bolditalic-subset.woff') format('woff');
src: url('fonts/hack-bolditalic-subset.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-bolditalic-subset.woff?sha=3114f1256') format('woff');
font-weight: 700;
font-style: italic;
font-display: swap;

View File

@@ -6,7 +6,7 @@
* -------------------------- */
@font-face {
font-family: 'Hack';
src: url('fonts/hack-regular.woff2') format('woff2'), url('fonts/hack-regular.woff') format('woff');
src: url('fonts/hack-regular.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-regular.woff?sha=3114f1256') format('woff');
font-weight: 400;
font-style: normal;
font-display: swap;
@@ -14,7 +14,7 @@
@font-face {
font-family: 'Hack';
src: url('fonts/hack-bold.woff2') format('woff2'), url('fonts/hack-bold.woff') format('woff');
src: url('fonts/hack-bold.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-bold.woff?sha=3114f1256') format('woff');
font-weight: 700;
font-style: normal;
font-display: swap;
@@ -22,7 +22,7 @@
@font-face {
font-family: 'Hack';
src: url('fonts/hack-italic.woff2') format('woff2'), url('fonts/hack-italic.woff') format('woff');
src: url('fonts/hack-italic.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-italic.woff?sha=3114f1256') format('woff');
font-weight: 400;
font-style: italic;
font-display: swap;
@@ -30,7 +30,7 @@
@font-face {
font-family: 'Hack';
src: url('fonts/hack-bolditalic.woff2') format('woff2'), url('fonts/hack-bolditalic.woff') format('woff');
src: url('fonts/hack-bolditalic.woff2?sha=3114f1256') format('woff2'), url('fonts/hack-bolditalic.woff?sha=3114f1256') format('woff');
font-weight: 700;
font-style: italic;
font-display: swap;

View File

@@ -13,7 +13,7 @@ html {
body {
margin: 0;
padding: 0;
font-family: DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
font-family: Hack, DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
font-size: 1rem;
line-height: 1.54;
background-color: var(--background);
@@ -118,7 +118,7 @@ figure {
}
code {
font-family: DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
font-family: Hack, DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
font-feature-settings: normal;
background: var(--accent-alpha-20);
padding: 1px 6px;
@@ -127,13 +127,12 @@ code {
}
pre {
font-family: DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
font-family: Hack, DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
padding: 20px;
font-size: .95rem;
overflow: auto;
border-top: 1px solid rgba(255, 255, 255, .1);
border-bottom: 1px solid rgba(255, 255, 255, .1);
position: relative;
@media (max-width: $phone-max-width) {
white-space: pre-wrap;

View File

@@ -4,7 +4,5 @@
@import 'logo';
@import 'main';
@import 'post';
@import 'toc';
@import 'copy';
@import 'pagination';
@import 'footer';

View File

@@ -1,88 +0,0 @@
html {
scroll-behavior: smooth;
}
.toc-container {
position: fixed;
right: 150px;
top: 180px;
width: 250px;
max-height: calc(100vh - 200px);
overflow-y: auto;
z-index: 10;
display: none;
@media (min-width: 1400px) {
display: block;
}
}
.toc {
padding: 15px 0;
&-title {
font-weight: bold;
font-size: 1.1rem;
margin-bottom: 12px;
color: var(--color);
}
ul {
list-style: none;
padding-left: 0;
margin: 0;
}
li {
margin: 4px 0;
}
ul ul {
padding-left: 20px;
margin-top: 4px;
}
a {
display: block;
text-decoration: none;
color: var(--color);
font-size: 0.9rem;
padding: 2px 0;
transition: color 0.2s ease;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&:hover {
color: var(--accent);
}
&:target {
color: var(--accent);
font-weight: bold;
}
}
.toc-level-1 {
font-size: 0.95rem;
font-weight: 600;
}
.toc-level-2 {
font-size: 0.9rem;
}
.toc-level-3 {
font-size: 0.85rem;
}
.toc-level-4,
.toc-level-5,
.toc-level-6 {
font-size: 0.8rem;
}
}
.post-content {
scroll-margin-top: 80px;
}

8
shortcodes/figure.html Normal file
View File

@@ -0,0 +1,8 @@
{% if src %}
<figure class="{% if position %}{{ position }}{% else -%} center {%- endif %}" >
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %}{% if style %} style="{{ style }}"{% endif %} decoding="async" loading="lazy"/>
{% if caption %}
<figcaption class="{% if caption_position %}{{ caption_position }}{% else -%} center {%- endif %}"{% if caption_style %} style="{{ caption_style | safe }}"{% endif %}>{{ caption | markdown() | safe }}</figcaption>
{% endif %}
</figure>
{% endif %}

8
shortcodes/image.html Normal file
View File

@@ -0,0 +1,8 @@
{% if src %}
{# If the image's URL is internal to the site... #}
{% if src is not starting_with("http") %}
{# ... then prepend the site's base URL to the image's URL. #}
{% set src = config.base_url ~ src %}
{% endif %}
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %} class="{% if position %}{{ position }}{% else -%} center {%- endif %}" {%- if style %} style="{{ style | safe }}" {%- endif %} decoding="async" loading="lazy"/>
{% endif %}

View File

@@ -1,34 +0,0 @@
(function() {
document.querySelectorAll('pre code').forEach((codeBlock) => {
const pre = codeBlock.parentElement;
if (pre.querySelector('.copy-button')) {
return;
}
const copyButton = document.createElement('button');
copyButton.className = 'copy-button';
copyButton.textContent = '复制';
copyButton.setAttribute('aria-label', '复制代码');
copyButton.setAttribute('type', 'button');
copyButton.addEventListener('click', () => {
navigator.clipboard.writeText(codeBlock.textContent.trimEnd()).then(() => {
copyButton.textContent = '已复制!';
copyButton.classList.add('copied');
setTimeout(() => {
copyButton.textContent = '复制';
copyButton.classList.remove('copied');
}, 2000);
}).catch((err) => {
copyButton.textContent = '失败';
setTimeout(() => {
copyButton.textContent = '复制';
}, 2000);
});
});
pre.appendChild(copyButton);
});
})();

21
tags/list.html Normal file
View File

@@ -0,0 +1,21 @@
{% extends "index.html" %}
{%- block title -%}
{{ title_macros::title(page_title="Tags", main_title=config.title) }}
{%- endblock -%}
{% block content %}
<div class="post">
<h1 class="post-title">all tags</h1>
<ul>
{% for term in terms %}
<li class="tag-list">
<a href="{{ term.permalink | safe }}">
{{ term.name }} ({{ term.pages | length }} post{{ term.pages | length | pluralize }})
</a>
</li>
{% endfor %}
</ul>
</div>
{% endblock content %}

21
tags/single.html Normal file
View File

@@ -0,0 +1,21 @@
{% extends "index.html" %}
{%- block title -%}
{% set title = "Tag: " ~ term.name %}
{{ title_macros::title(page_title=title, main_title=config.title) }}
{%- endblock -%}
{% block content %}
<div class="post">
<h1 class="post-title">
tag: #{{ term.name }}
({{ term.pages | length }} post{{ term.pages | length | pluralize }})
</h1>
<a href="{{ config.base_url | safe }}/tags/">
Show all tags
</a>
{{ post_macros::list_posts(pages=term.pages) }}
</div>
{% endblock content %}

View File

@@ -10,22 +10,6 @@
{% set section = get_section(path="_index.md") %}
{% set pages_by_year = section.pages | group_by(attribute="year") %}
{%- for year, pages_in_year in pages_by_year %}
<h2 class="year-divider">{{ year }}</h2>
<ul>
{%- for page in pages_in_year %}
{%- if page.draft %}
{% continue %}
{% endif -%}
<li class="post-list">
<a href="{{ page.permalink | safe }}">
<span class="post-date">{{ page.date }}</span>
:: <span class="post-list-title">{{ page.title }}</span></a>
{{ post_macros::tags(page=page, short=true) }}
</li>
{%- endfor %}
</ul>
{%- endfor %}
{{ post_macros::list_posts(pages=section.pages) }}
</div>
{% endblock content %}

View File

@@ -84,7 +84,6 @@
</header>
{% endblock header %}
<main>
<div class="content">
{% block content %}
<div class="posts">
@@ -124,9 +123,9 @@
</div>
{% endblock content %}
</div>
</main>
{% block footer %} <footer class="footer">
{% block footer %}
<footer class="footer">
<div class="footer__inner">
{%- if config.extra.copyright_html %}
<div class="copyright copyright--user">{{ config.extra.copyright_html | safe }}</div>

View File

@@ -4,6 +4,11 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noodp"/>
<!-- 字体预加载 - 减少布局偏移 CLS -->
<link rel="preload" href="{{ get_url(path='fonts/hack-regular.woff2?sha=3114f1256') }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ get_url(path='fonts/hack-bold.woff2?sha=3114f1256') }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ get_url(path='fonts/hack-italic.woff2?sha=3114f1256') }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ get_url(path='fonts/hack-bolditalic.woff2?sha=3114f1256') }}" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="{{ get_url(path="style.css", trailing_slash=false) | safe }}">
@@ -19,6 +24,15 @@
{% endif -%}
{% endif -%}
{%- if config.extra.use_full_hack_font == "exo2" %}
<link rel="stylesheet" href="{{ get_url(path="font-exo2.css", trailing_slash=false) | safe }}">
<link rel="stylesheet" href="{{ get_url(path="font-hack.css", trailing_slash=false) | safe }}">
{%- elif config.extra.use_full_hack_font %}
<link rel="stylesheet" href="{{ get_url(path="font-hack.css", trailing_slash=false) | safe }}">
{% else %}
<link rel="stylesheet" href="{{ get_url(path="font-hack-subset.css", trailing_slash=false) | safe }}">
{% endif -%}
{% endmacro head %}

View File

@@ -10,41 +10,5 @@
{{ post_macros::content(page=page, summary=false, show_only_description=false) }}
{{ post_macros::earlier_later(page=page) }}
</div>
{% if page.toc %}
<div class="toc-container">
<div class="toc">
<div class="toc-title">目录</div>
<ul>
{% for h in page.toc %}
<li class="toc-level-{{ h.level }}">
<a href="#{{ h.id | safe }}">{{ h.title }}</a>
{% if h.children %}
<ul>
{% for h2 in h.children %}
<li class="toc-level-{{ h2.level }}">
<a href="#{{ h2.id | safe }}">{{ h2.title }}</a>
{% if h2.children %}
<ul>
{% for h3 in h2.children %}
<li class="toc-level-{{ h3.level }}">
<a href="#{{ h3.id | safe }}">{{ h3.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% endblock content %}
{% block extra_body %}
<script src="{{ get_url(path='copy.js', trailing_slash=false) | safe }}"></script>
{% endblock extra_body %}

View File

@@ -4,7 +4,25 @@ license = "MIT"
homepage = "https://github.com/pawroman/zola-theme-terminimal"
min_version = "0.11.0"
# An optional live demo URL
#demo = "https://pawroman.github.io/zola-theme-terminimal/"
[author]
name = "Dichgrem"
homepage = "https://github.com/Dichgrem"
# The original theme this one's been forked off.
[original]
author = "Dichgrem"
homepage = "https://github.com/Dichgrem"
#repo = "https://github.com/panr/hugo-theme-terminal"
[extra]
# Author name: when specified, modifies the default
# copyright text. Apart from author, it will
# contain current year and a link to the theme.
author = "Dichgrem"
# One of: blue, green, orange, pink, red.
# Defaults to blue.
# Append -light for light themes, e.g. blue-light