init
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
7
.devcontainer/devcontainer.json
Normal file
7
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "Cheatsheet-hugo",
|
||||
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/hugo:1": {}
|
||||
}
|
||||
}
|
||||
51
.github/workflows/build.yml
vendored
Normal file
51
.github/workflows/build.yml
vendored
Normal file
@@ -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 }}
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/public
|
||||
.hugo_build.lock
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "themes/hugo-geekdoc"]
|
||||
path = themes/hugo-geekdoc
|
||||
url = git@github.com:thegeeklab/hugo-geekdoc.git
|
||||
5
archetypes/default.md
Normal file
5
archetypes/default.md
Normal file
@@ -0,0 +1,5 @@
|
||||
+++
|
||||
date = '{{ .Date }}'
|
||||
draft = true
|
||||
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
|
||||
+++
|
||||
6
content/_index.md
Normal file
6
content/_index.md
Normal file
@@ -0,0 +1,6 @@
|
||||
+++
|
||||
date = '2025-08-10T11:26:53Z'
|
||||
title = 'Cheatsheet'
|
||||
+++
|
||||
|
||||
Cheatsheet for useful Linux commands
|
||||
4
content/markdown/_index.md
Normal file
4
content/markdown/_index.md
Normal file
@@ -0,0 +1,4 @@
|
||||
+++
|
||||
date = '2025-08-10T12:20:42Z'
|
||||
title = 'Markdown'
|
||||
+++
|
||||
112
content/markdown/markdown-extensions.md
Normal file
112
content/markdown/markdown-extensions.md
Normal file
@@ -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
|
||||
```
|
||||
62
content/markdown/mermaid.md
Normal file
62
content/markdown/mermaid.md
Normal file
@@ -0,0 +1,62 @@
|
||||
+++
|
||||
date = '2025-08-10T11:51:03Z'
|
||||
title = 'Mermaid'
|
||||
+++
|
||||
|
||||
<https://mermaid.js.org/intro/>
|
||||
|
||||
```
|
||||
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
|
||||
默认
|
||||
圆角矩形(圆角矩形)
|
||||
矩形[矩形]
|
||||
棱形{棱形}
|
||||
胶囊([胶囊])
|
||||
子程序[[子程序]]
|
||||
圆柱[(圆柱)]
|
||||
圆形((圆形))
|
||||
六边形{{六边形}}
|
||||
平行四边形[/平行四边形/]
|
||||
反平行四边形[\反平行四边形\]
|
||||
正梯形[/正梯形\]
|
||||
反梯形[\反梯形/]
|
||||
非对称的矩形>非对称的矩形]
|
||||
双圆(((双圆)))
|
||||
```
|
||||
4
content/ssh/_index.md
Normal file
4
content/ssh/_index.md
Normal file
@@ -0,0 +1,4 @@
|
||||
+++
|
||||
date = '2025-08-10T11:30:43Z'
|
||||
title = 'SSH'
|
||||
+++
|
||||
24
content/ssh/port-forwarding.md
Normal file
24
content/ssh/port-forwarding.md
Normal file
@@ -0,0 +1,24 @@
|
||||
+++
|
||||
date = '2025-08-10T11:55:59Z'
|
||||
title = 'Port Forwarding'
|
||||
+++
|
||||
|
||||
- `-L` 本地转发(本地访问远程)
|
||||
- `-R` 远程转发(远程访问本地,如clash)
|
||||
|
||||
```pseudo-shell
|
||||
ssh -R <remote_listen_port>:<local_host>:<local_port> <user>@<ssh_server>
|
||||
ssh -L [<local_listen_host>]:<local_listen_port>:<remote_host>:<remote_port> <user>@<ssh_server>
|
||||
```
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="ssh -R ${REMOTE_LISTEN_PORT}:${LOCAL_HOST:-localhost}:${LOCAL_PORT} ${SSH_HOST} ${COMMAND}"
|
||||
variables='[{"name":"REMOTE_LISTEN_PORT","default":"7890"},{"name":"LOCAL_HOST","default":"localhost"},{"name":"LOCAL_PORT","default":"7890"},{"name":"SSH_HOST","required":true},{"name":"COMMAND","default":"sleep infinity"}]'>
|
||||
</shell-commands-builder-component>
|
||||
|
||||
---
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="ssh -L ${LOCAL_LISTEN_PORT}:${REMOTE_HOST:-localhost}:${REMOTE_PORT} ${SSH_HOST} ${COMMAND}"
|
||||
variables='[{"name":"LOCAL_LISTEN_PORT","default":"8080"},{"name":"REMOTE_HOST","default":"localhost"},{"name":"REMOTE_PORT","default":"80"},{"name":"SSH_HOST","required":true},{"name":"COMMAND","default":"sleep infinity"}]'>
|
||||
</shell-commands-builder-component>
|
||||
23
content/ssh/ssh-via-gpg.md
Normal file
23
content/ssh/ssh-via-gpg.md
Normal file
@@ -0,0 +1,23 @@
|
||||
+++
|
||||
date = '2025-08-10T11:36:00Z'
|
||||
title = 'SSH via GPG'
|
||||
+++
|
||||
|
||||
## get gpg key grip
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="gpg -k --with-keygrip">
|
||||
</shell-commands-builder-component>
|
||||
|
||||
## enable ssh auth
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="gpg-connect-agent 'keyattr $1 Use-for-ssh: true' /bye"
|
||||
variables='[{"position":1,"required":true}]'>
|
||||
</shell-commands-builder-component>
|
||||
|
||||
## enable ssh agent
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="echo 'export SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh' >> ~/.bashrc">
|
||||
</shell-commands-builder-component>
|
||||
15
content/ssh/sshd.md
Normal file
15
content/ssh/sshd.md
Normal file
@@ -0,0 +1,15 @@
|
||||
+++
|
||||
date = '2025-08-10T12:13:32Z'
|
||||
title = 'sshd'
|
||||
+++
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="cat << EOF > /etc/ssh/sshd_config.d/security.conf
|
||||
PermitRootLogin no
|
||||
PubkeyAuthentication yes
|
||||
PasswordAuthentication no
|
||||
Port $SSH_LISTEN_PORT
|
||||
EOF
|
||||
systemctl restart sshd"
|
||||
variables='[{"name":"SSH_LISTEN_PORT","default":"22"}]'>
|
||||
</shell-commands-builder-component>
|
||||
39
content/util/regex.md
Normal file
39
content/util/regex.md
Normal file
@@ -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)
|
||||
```
|
||||
30
content/util/tar.md
Normal file
30
content/util/tar.md
Normal file
@@ -0,0 +1,30 @@
|
||||
+++
|
||||
date = '2025-08-10T12:31:42Z'
|
||||
title = 'tar'
|
||||
+++
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="tar czf $ARCHIVE_NAME.tgz $FILES"
|
||||
variables='[{"name":"ARCHIVE_NAME","default":"archive"},{"name":"FILES","required":true}]'>
|
||||
</shell-commands-builder-component>
|
||||
|
||||
---
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="tar cJf $ARCHIVE_NAME.tar.xz $FILES"
|
||||
variables='[{"name":"ARCHIVE_NAME","default":"archive"},{"name":"FILES","required":true}]'>
|
||||
</shell-commands-builder-component>
|
||||
|
||||
---
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="tar cjf $ARCHIVE_NAME.tar.bz2 $FILES"
|
||||
variables='[{"name":"ARCHIVE_NAME","default":"archive"},{"name":"FILES","required":true}]'>
|
||||
</shell-commands-builder-component>
|
||||
|
||||
---
|
||||
|
||||
<shell-commands-builder-component
|
||||
command="tar --zstd -cf $ARCHIVE_NAME.tar.zst $FILES"
|
||||
variables='[{"name":"ARCHIVE_NAME","default":"archive"},{"name":"FILES","required":true}]'>
|
||||
</shell-commands-builder-component>
|
||||
4
content/vm/_index.md
Normal file
4
content/vm/_index.md
Normal file
@@ -0,0 +1,4 @@
|
||||
+++
|
||||
date = '2025-08-10T12:20:23Z'
|
||||
title = 'VM'
|
||||
+++
|
||||
10
content/vm/bbr.md
Normal file
10
content/vm/bbr.md
Normal file
@@ -0,0 +1,10 @@
|
||||
+++
|
||||
date = '2025-08-10T12:11:46Z'
|
||||
title = 'BBR'
|
||||
+++
|
||||
|
||||
<shell-commands-builder-component
|
||||
command='echo "net.core.default_qdisc=fq" >>/etc/sysctl.conf
|
||||
echo "net.ipv4.tcp_congestion_control=bbr" >>/etc/sysctl.conf
|
||||
sysctl -p'>
|
||||
</shell-commands-builder-component>
|
||||
124
hugo.toml
Normal file
124
hugo.toml
Normal file
@@ -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 <base> 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 <license>" 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/"
|
||||
1
layouts/partials/head/custom.html
Normal file
1
layouts/partials/head/custom.html
Normal file
@@ -0,0 +1 @@
|
||||
<script src="https://s3.yuudi.dev/lib/shell-commands-builder-component/shell-commands-builder-component.js"></script>
|
||||
1
themes/hugo-geekdoc
Submodule
1
themes/hugo-geekdoc
Submodule
Submodule themes/hugo-geekdoc added at aaf42bf2af
Reference in New Issue
Block a user