From 728a3db9574938075a024b3e5021122b1b044c39 Mon Sep 17 00:00:00 2001 From: yuudi Date: Sun, 10 Aug 2025 11:04:12 +0000 Subject: [PATCH] init --- .devcontainer/devcontainer.json | 7 ++ .github/workflows/build.yml | 51 ++++++++++ .gitignore | 2 + .gitmodules | 3 + archetypes/default.md | 5 + content/_index.md | 6 ++ content/markdown/_index.md | 4 + content/markdown/markdown-extensions.md | 112 +++++++++++++++++++++ content/markdown/mermaid.md | 62 ++++++++++++ content/ssh/_index.md | 4 + content/ssh/port-forwarding.md | 24 +++++ content/ssh/ssh-via-gpg.md | 23 +++++ content/ssh/sshd.md | 15 +++ content/util/regex.md | 39 ++++++++ content/util/tar.md | 30 ++++++ content/vm/_index.md | 4 + content/vm/bbr.md | 10 ++ hugo.toml | 124 ++++++++++++++++++++++++ layouts/partials/head/custom.html | 1 + themes/hugo-geekdoc | 1 + 20 files changed, 527 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/build.yml create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 archetypes/default.md create mode 100644 content/_index.md create mode 100644 content/markdown/_index.md create mode 100644 content/markdown/markdown-extensions.md create mode 100644 content/markdown/mermaid.md create mode 100644 content/ssh/_index.md create mode 100644 content/ssh/port-forwarding.md create mode 100644 content/ssh/ssh-via-gpg.md create mode 100644 content/ssh/sshd.md create mode 100644 content/util/regex.md create mode 100644 content/util/tar.md create mode 100644 content/vm/_index.md create mode 100644 content/vm/bbr.md create mode 100644 hugo.toml create mode 100644 layouts/partials/head/custom.html create mode 160000 themes/hugo-geekdoc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..867b8c4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,7 @@ +{ + "name": "Cheatsheet-hugo", + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "features": { + "ghcr.io/devcontainers/features/hugo:1": {} + } +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..018a4e3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,51 @@ +name: Build + +on: + push: {} + workflow_dispatch: {} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Cache npm + uses: actions/cache@v4 + with: + path: ~/.npm + key: Cheatsheet-${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + Cheatsheet-${{ runner.os }}-node- + + - name: Build Theme + working-directory: themes/hugo-geekdoc + run: | + npm clean-install + npm run build + + - name: Build Site + uses: docker://docker.io/hugomods/hugo:base + with: + args: "--minify" + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./public + + - name: Deploy to Github-Pages + uses: actions/deploy-pages@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68b5206 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/public +.hugo_build.lock \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f3da2c4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "themes/hugo-geekdoc"] + path = themes/hugo-geekdoc + url = git@github.com:thegeeklab/hugo-geekdoc.git diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..25b6752 --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,5 @@ ++++ +date = '{{ .Date }}' +draft = true +title = '{{ replace .File.ContentBaseName "-" " " | title }}' ++++ diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..ffacb93 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,6 @@ ++++ +date = '2025-08-10T11:26:53Z' +title = 'Cheatsheet' ++++ + +Cheatsheet for useful Linux commands diff --git a/content/markdown/_index.md b/content/markdown/_index.md new file mode 100644 index 0000000..042d107 --- /dev/null +++ b/content/markdown/_index.md @@ -0,0 +1,4 @@ ++++ +date = '2025-08-10T12:20:42Z' +title = 'Markdown' ++++ diff --git a/content/markdown/markdown-extensions.md b/content/markdown/markdown-extensions.md new file mode 100644 index 0000000..e97d9f8 --- /dev/null +++ b/content/markdown/markdown-extensions.md @@ -0,0 +1,112 @@ ++++ +date = '2025-08-10T11:50:12Z' +title = 'Markdown Extensions' ++++ + +## 表格 + +```markdown +| 表头1 | 表头2 | 表头3 | +|---|---|---| +| 单元格1 | 单元格2 | 单元格3 | +| 单元格4 | 单元格5 | 单元格6 | +``` + +| 表头1 | 表头2 | 表头3 | +|---|---|---| +| 单元格1 | 单元格2 | 单元格3 | +| 单元格4 | 单元格5 | 单元格6 | + +## 分割线 + +```markdown +___ +--- +*** +``` + +--- + +## 定义 + +术语1 +: 这是术语1的定义。 + +术语2 +: 这是术语2的第一个定义。 +: 这是术语2的第二个定义。 + +```markdown +术语1 +: 这是术语1的定义。 + +术语2 +: 这是术语2的第一个定义。 +: 这是术语2的第二个定义。 +``` + +## 语法 + +```markdown +### Header-with {#custom-id} + +~~delete~~ + +==highlight== + +H~2~O + +X^2^ + +$(x+y)^2=x^2+y^2+2xy$ + +:joy: +``` + +### Header-with {#custom-id} + +~~delete~~ + +==highlight== + +H~2~O + +X^2^ + +$(x+y)^2=x^2+y^2+2xy$ + +:joy: + +## 脚注 + +```markdown +这是一个有脚注的句子[^1]。 + +[^1]: 这是脚注的内容。 + +Here's a simple footnote and here's a longer one.[^note] + +[^note]: Here's one with multiple paragraphs and code. +``` + +这是一个有脚注的句子[^1]。 + +[^1]: 这是脚注的内容。 + +Here's a simple footnote and here's a longer one.[^note] + +[^note]: Here's one with multiple paragraphs and code. + +## mermaid + +[mermaid](./mermaid.md) + +```mermaid +graph LR + A[Start] --> B(Process 1) + B --> C{Condition}; + C -- Yes --> D(Result A) + C -- No --> E(Result B) + D --> F(End) + E --> F +``` diff --git a/content/markdown/mermaid.md b/content/markdown/mermaid.md new file mode 100644 index 0000000..6fc0d35 --- /dev/null +++ b/content/markdown/mermaid.md @@ -0,0 +1,62 @@ ++++ +date = '2025-08-10T11:51:03Z' +title = 'Mermaid' ++++ + + + +``` +graph LR + A --> B --> C + A & B --> D + D --text--> E + D -.- F + D ==> G +``` + +```mermaid +graph LR + A --> B --> C + A & B --> D + D --text--> E + D -.- F + D ==> G +``` + +``` +graph LR + 默认 + 圆角矩形(圆角矩形) + 矩形[矩形] + 棱形{棱形} + 胶囊([胶囊]) + 子程序[[子程序]] + 圆柱[(圆柱)] + 圆形((圆形)) + 六边形{{六边形}} + 平行四边形[/平行四边形/] + 反平行四边形[\反平行四边形\] + 正梯形[/正梯形\] + 反梯形[\反梯形/] + 非对称的矩形>非对称的矩形] + 双圆(((双圆))) +``` + +```mermaid +graph LR + 默认 + 圆角矩形(圆角矩形) + 矩形[矩形] + 棱形{棱形} + 胶囊([胶囊]) + 子程序[[子程序]] + 圆柱[(圆柱)] + 圆形((圆形)) + 六边形{{六边形}} + 平行四边形[/平行四边形/] + 反平行四边形[\反平行四边形\] + 正梯形[/正梯形\] + 反梯形[\反梯形/] + 非对称的矩形>非对称的矩形] + 双圆(((双圆))) +``` diff --git a/content/ssh/_index.md b/content/ssh/_index.md new file mode 100644 index 0000000..a3d3bf3 --- /dev/null +++ b/content/ssh/_index.md @@ -0,0 +1,4 @@ ++++ +date = '2025-08-10T11:30:43Z' +title = 'SSH' ++++ diff --git a/content/ssh/port-forwarding.md b/content/ssh/port-forwarding.md new file mode 100644 index 0000000..0ece882 --- /dev/null +++ b/content/ssh/port-forwarding.md @@ -0,0 +1,24 @@ ++++ +date = '2025-08-10T11:55:59Z' +title = 'Port Forwarding' ++++ + +- `-L` 本地转发(本地访问远程) +- `-R` 远程转发(远程访问本地,如clash) + +```pseudo-shell +ssh -R :: @ +ssh -L []::: @ +``` + + + + +--- + + + diff --git a/content/ssh/ssh-via-gpg.md b/content/ssh/ssh-via-gpg.md new file mode 100644 index 0000000..cd63062 --- /dev/null +++ b/content/ssh/ssh-via-gpg.md @@ -0,0 +1,23 @@ ++++ +date = '2025-08-10T11:36:00Z' +title = 'SSH via GPG' ++++ + +## get gpg key grip + + + + +## enable ssh auth + + + + +## enable ssh agent + + + \ No newline at end of file diff --git a/content/ssh/sshd.md b/content/ssh/sshd.md new file mode 100644 index 0000000..1426126 --- /dev/null +++ b/content/ssh/sshd.md @@ -0,0 +1,15 @@ ++++ +date = '2025-08-10T12:13:32Z' +title = 'sshd' ++++ + + + \ No newline at end of file diff --git a/content/util/regex.md b/content/util/regex.md new file mode 100644 index 0000000..faf7b1a --- /dev/null +++ b/content/util/regex.md @@ -0,0 +1,39 @@ ++++ +date = '2025-08-10T12:37:16Z' +title = '正则' ++++ + +## 原子组 + +不回溯 + +```regex +(?>...) +``` + +## 占有量词 + +不回溯 + +```regex +.*+ +.++ +.?+ +``` + +## 详细模式(Verbose Mode / Free-Spacing Mode) + +```python +regex_verbose = r""" + ^ # 匹配字符串开头 + (\d{4}) # 捕获四位数的年份 + - # 匹配连字符 + (\d{2}) # 捕获两位数的月份 + - # 匹配连字符 + (\d{2}) # 捕获两位数的日期 + $ # 匹配字符串结尾 +""" + +date_string = "2023-10-26" +match = re.match(regex_verbose, date_string, re.VERBOSE) +``` diff --git a/content/util/tar.md b/content/util/tar.md new file mode 100644 index 0000000..00a9a1e --- /dev/null +++ b/content/util/tar.md @@ -0,0 +1,30 @@ ++++ +date = '2025-08-10T12:31:42Z' +title = 'tar' ++++ + + + + +--- + + + + +--- + + + + +--- + + + diff --git a/content/vm/_index.md b/content/vm/_index.md new file mode 100644 index 0000000..6453ef4 --- /dev/null +++ b/content/vm/_index.md @@ -0,0 +1,4 @@ ++++ +date = '2025-08-10T12:20:23Z' +title = 'VM' ++++ diff --git a/content/vm/bbr.md b/content/vm/bbr.md new file mode 100644 index 0000000..d4c0240 --- /dev/null +++ b/content/vm/bbr.md @@ -0,0 +1,10 @@ ++++ +date = '2025-08-10T12:11:46Z' +title = 'BBR' ++++ + + + \ No newline at end of file diff --git a/hugo.toml b/hugo.toml new file mode 100644 index 0000000..9b163d2 --- /dev/null +++ b/hugo.toml @@ -0,0 +1,124 @@ +baseURL = 'https://cheatsheet.yuudi.dev' +languageCode = 'en-us' +title = 'Cheatsheet' +theme = 'hugo-geekdoc' + + +# Geekdoc required configuration +pygmentsUseClasses = true +pygmentsCodeFences = true +disablePathToLower = true + +# Needed for mermaid shortcodes +[markup] + [markup.goldmark.renderer] + # Needed for mermaid shortcode or when nesting shortcodes (e.g. img within + # columns or tabs) + unsafe = true + [markup.tableOfContents] + startLevel = 1 + endLevel = 9 + +[taxonomies] + tag = "tags" + +[params] + # (Optional, default none) Set a subtitle used in the page header. + geekdocSubtitle = "Cheatsheet for useful Linux commands" + +# # (Optional, default 6) Set how many table of contents levels to be showed on page. +# # Use false to hide ToC, note that 0 will default to 6 (https://gohugo.io/functions/default/) +# # You can also specify this parameter per page in front matter. +# geekdocToC = 3 + +# # (Optional, default static/brand.svg) Set the path to a logo for the Geekdoc +# # relative to your 'static/' folder. +# geekdocLogo = "logo.png" + +# # (Optional, default false) Render menu from data file in 'data/menu/main.yaml'. +# # See also https://geekdocs.de/usage/menus/#bundle-menu. +# geekdocMenuBundle = true + +# # (Optional, default false) Collapse all menu entries, can not be overwritten +# # per page if enabled. Can be enabled per page via 'geekdocCollapseSection'. +# geekdocCollapseAllSections = true + + # (Optional, default true) Show page navigation links at the bottom of each docs page. + geekdocNextPrev = false + + # (Optional, default true) Show a breadcrumb navigation bar at the top of each docs page. + # You can also specify this parameter per page in front matter. + geekdocBreadcrumb = false + + # (Optional, default none) Set source repository location. Used for 'Edit page' links. + # You can also specify this parameter per page in front matter. + geekdocRepo = "https://gitea.yuudi.dev/yu/cheatsheet-site" + + # (Optional, default none) Enable 'Edit page' links. Requires 'geekdocRepo' param + # and the path must point to the parent directory of the 'content' folder. + # You can also specify this parameter per page in front matter. + geekdocEditPath = "_edit/master" + +# # (Optional, default false) Show last modification date of the page in the header. +# # Keep in mind that last modification date works best if `enableGitInfo` is set to true. +# geekdocPageLastmod = true + + # # (Optional, default true) Enables search function with flexsearch. + # # Index is built on the fly and might slow down your website. + # geekdocSearch = false + +# # (Optional, default false) Display search results with the parent folder as prefix. This +# # option allows you to distinguish between files with the same name in different folders. +# # NOTE: This parameter only applies when 'geekdocSearch = true'. +# geekdocSearchShowParent = true + +# # (Optional, default none) Add a link to your Legal Notice page to the site footer. +# # It can be either a remote url or a local file path relative to your content directory. +# geekdocLegalNotice = "https://blog.example.com/legal" + +# # (Optional, default none) Add a link to your Privacy Policy page to the site footer. +# # It can be either a remote url or a local file path relative to your content directory. +# geekdocPrivacyPolicy = "/privacy" + + # # (Optional, default true) Add an anchor link to headlines. + # geekdocAnchor = true + + # # (Optional, default true) Copy anchor url to clipboard on click. + # geekdocAnchorCopy = true + +# # (Optional, default true) Enable or disable image lazy loading for images rendered +# # by the 'img' shortcode. +# geekdocImageLazyLoading = true + +# # (Optional, default false) Set HTMl to .Site.Home.Permalink if enabled. It might be required +# # if a subdirectory is used within Hugos BaseURL. +# # See https://developer.mozilla.org/de/docs/Web/HTML/Element/base. +# geekdocOverwriteHTMLBase = false + +# # (Optional, default true) Enable or disable the JavaScript based color theme toggle switch. The CSS based +# # user preference mode still works. +# geekdocDarkModeToggle = false + +# # (Optional, default false) Auto-decrease brightness of images and add a slightly grayscale to avoid +# # bright spots while using the dark mode. +# geekdocDarkModeDim = false + +# # (Optional, default false) Enforce code blocks to always use the dark color theme. +# geekdocDarkModeCode = false + +# # (Optional, default true) Display a "Back to top" link in the site footer. +# geekdocBackToTop = true + +# # (Optional, default false) Enable or disable adding tags for post pages automatically to the navigation sidebar. +# geekdocTagsToMenu = true + +# # (Optional, default 'title') Configure how to sort file-tree menu entries. Possible options are 'title', 'linktitle', +# # 'date', 'publishdate', 'expirydate' or 'lastmod'. Every option can be used with a reverse modifier as well +# # e.g. 'title_reverse'. +# geekdocFileTreeSortBy = "title" + +# # (Optional, default none) Adds a "Content licensed under " line to the footer. +# # Could be used if you want to define a default license for your content. +# [params.geekdocContentLicense] +# name = "CC BY-SA 4.0" +# link = "https://creativecommons.org/licenses/by-sa/4.0/" diff --git a/layouts/partials/head/custom.html b/layouts/partials/head/custom.html new file mode 100644 index 0000000..bcbf69e --- /dev/null +++ b/layouts/partials/head/custom.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/themes/hugo-geekdoc b/themes/hugo-geekdoc new file mode 160000 index 0000000..aaf42bf --- /dev/null +++ b/themes/hugo-geekdoc @@ -0,0 +1 @@ +Subproject commit aaf42bf2afe67dca725ebb1ed84c8a9d69c2a17d