Compare commits

..

41 Commits

Author SHA1 Message Date
jaywcjlove
7c7f25bf9f released v1.17.0 2022-11-07 18:06:02 +08:00
jaywcjlove
2dde0c4408 doc: Update npm.md. 2022-11-07 17:40:08 +08:00
jaywcjlove
a2d7cd6e7b doc: Update npm.md. 2022-11-07 17:36:13 +08:00
jaywcjlove
10366e3317 doc: update nginx.md. 2022-11-07 16:59:00 +08:00
jaywcjlove
4bf8a55bf3 chore: add matlab logo. 2022-11-07 16:16:37 +08:00
jaywcjlove
0101ef71d0 doc: update quickreference.md. 2022-11-07 16:11:49 +08:00
jaywcjlove
aa38a0e765 doc: update css.md. 2022-11-07 16:04:39 +08:00
jaywcjlove
4a1eb6964d doc: update yum.md. 2022-11-07 11:40:32 +08:00
jaywcjlove
f6ff51be15 doc: update cargo.md. 2022-11-07 11:40:13 +08:00
jaywcjlove
6c89718254 doc: update docker.md. 2022-11-07 09:41:57 +08:00
jaywcjlove
8c79a648a4 feat: add yum.md cheatsheet. 2022-11-07 01:15:13 +08:00
jaywcjlove
f021d73b77 doc: update README.md 2022-11-06 23:39:00 +08:00
jaywcjlove
c060c36559 doc: update curl.md. 2022-11-06 23:25:58 +08:00
jaywcjlove
39aa2c4387 feat: add xcode.md cheatsheet. 2022-11-06 23:18:12 +08:00
jaywcjlove
aeca8351bd doc: update ffmpeg.md (#18) 2022-11-06 23:02:37 +08:00
jaywcjlove
d7d6b0d447 doc: update ffmpeg.md (#18) 2022-11-06 22:49:56 +08:00
jaywcjlove
4d69a0ef24 doc: update ansible.md (#23) 2022-11-06 22:18:16 +08:00
jaywcjlove
bafc15d17e released v1.16.0 2022-11-06 22:12:36 +08:00
jaywcjlove
68069fbf01 doc: Update README.md 2022-11-06 22:11:35 +08:00
jaywcjlove
ca3cf85666 doc: update README.md (#23) 2022-11-06 22:10:12 +08:00
jaywcjlove
040af8095f doc: update ansible.md (#23) 2022-11-06 22:07:24 +08:00
onewesong
d1dea83330 feat: add ansible cheatsheet. (#23) 2022-11-06 20:51:51 +08:00
jaywcjlove
4503b28837 doc: update cargo.md. 2022-11-05 21:26:39 +08:00
jaywcjlove
02d0a495a6 feat: add matlab.md cheatsheet (#21). 2022-11-04 21:06:49 +08:00
jaywcjlove
c66d1c0294 chore: add .dockerignore file. 2022-11-04 13:02:33 +08:00
jaywcjlove
f2d43d65df website: fix style issue. 2022-11-04 13:02:16 +08:00
jaywcjlove
009c50760c website: Support math formula display. (#21) 2022-11-04 13:01:39 +08:00
jaywcjlove
f683ca5294 feat: add cargo cheatsheet. 2022-11-04 00:34:06 +08:00
jaywcjlove
04369f05d3 doc: update vue.md (#10) 2022-11-03 19:16:33 +08:00
jaywcjlove
ae04c01eb4 doc: update quickreference.md. 2022-11-03 16:51:53 +08:00
jaywcjlove
e66c1c57fd feat: add rust.md cheatsheet (#20). 2022-11-03 15:32:56 +08:00
jaywcjlove
c7df917009 feat: add conan.md cheatsheet. 2022-11-03 13:33:02 +08:00
jaywcjlove
a5744c23b7 doc: update README.md 2022-11-03 11:49:39 +08:00
jaywcjlove
d8ab87b0e0 feat: add default prompt changes. 2022-11-03 11:49:21 +08:00
jaywcjlove
e87ce59a88 doc: update sed.md. 2022-11-03 11:03:44 +08:00
jaywcjlove
428d8488f3 doc: update vue.md (#10). 2022-11-03 10:26:24 +08:00
jaywcjlove
e84c69f8b9 website: update style. 2022-11-03 01:20:38 +08:00
jaywcjlove
3cdc2685e6 doc: update vue.md (#10). 2022-11-03 01:09:38 +08:00
jaywcjlove
df3e04ba92 doc: update vue.md (#10). 2022-11-03 01:08:45 +08:00
jaywcjlove
4662fb8071 feat: add cmake.md cheatsheet (#19). 2022-11-03 00:27:39 +08:00
jaywcjlove
600dbc6fef feat: add gmail.md cheatsheet. 2022-11-02 23:23:20 +08:00
100 changed files with 6043 additions and 199 deletions

25
.dockerignore Normal file
View File

@@ -0,0 +1,25 @@
.github
.husky
docs
scripts
node_modules
package-lock.json
.DS_Store
.cache
.vscode
.idea
.snap
.env
*.bak
*.tem
*.temp
#.swp
*.*~
~*.*
# IDEA
*.iml
*.ipr
*.iws

View File

@@ -67,7 +67,7 @@ Contributing 贡献
[Django](./docs/djiango.md)<!--rehype:style=background: rgb(12 75 51/var(\-\-bg\-opacity));&class=contributing-->
```
添加 `contributing` 类名,会在卡片下方添加 _`👆待完善需要您的参与`_
添加 `contributing` 类名,会在卡片下方添加 _`👆待完善需要您的参与`_,添加 `data-info=👆看看还缺点儿什么?`,更换默认提示文本。
```markdown

View File

@@ -14,6 +14,19 @@ Quick Reference
为开发人员分享快速参考备忘清单【速查表】 _(主要是方便自己)_,在看到 [Reference](https://github.com/Randy8080/reference) 快速参考备忘单,感觉非常简单,造轮子使命感突然来了,造个中文版本的,为了方便自己的技术栈查阅,立马撸起来 :)。如果您发现此处的备忘单不合适,您可以通过提交 [PR](https://github.com/jaywcjlove/reference/blob/main/CONTRIBUTING.md) 来修复它或提供更好的备忘清单,只针对【中文】用户。以下是开源天使提供的一些备忘清单和快速参考 :)。
## 正在建设中...
坑已挖,需要您的参与完善和贡献!🙏
<!--rehype:style=padding-bottom: 23px;-->
[Ansible](./docs/ansible.md)<!--rehype:style=background: rgb(238 0 0/var(\-\-bg\-opacity));&class=contributing tag&data-lang=RedHad&data-info=👆看看还缺点儿什么?-->
[CMake](./docs/cmake.md)<!--rehype:style=background: rgb(92 107 192/var(\-\-bg\-opacity));&class=contributing-->
[Django](./docs/djiango.md)<!--rehype:style=background: rgb(12 75 51/var(\-\-bg\-opacity));&class=contributing tag&data-lang=Python-->
[FFmpeg](./docs/ffmpeg.md)<!--rehype:style=background: rgb(0 193 9/var(\-\-bg\-opacity));&class=contributing-->
[MATLAB](./docs/matlab.md)<!--rehype:style=background: rgb(0 118 168/var(\-\-bg\-opacity));&class=contributing-->
[Vue 3 ](./docs/vue.md)<!--rehype:style=background: rgb(64 184 131/var(\-\-bg\-opacity));&class=contributing-->
<!--rehype:class=home-card-->
## 编程
[Bash](./docs/bash.md)<!--rehype:style=background: rgb(72 143 223/var(\-\-bg\-opacity));-->
@@ -24,10 +37,12 @@ Quick Reference
[Golang](./docs/golang.md)<!--rehype:style=background: rgb(39 160 193/var(\-\-bg\-opacity));-->
[INI](./docs/ini.md)<!--rehype:style=background: rgb(57 59 60/var(\-\-bg\-opacity));-->
[JSON](./docs/json.md)<!--rehype:style=background: rgb(57 59 60/var(\-\-bg\-opacity));-->
[Java](./docs/java.md)<!--rehype:style=background: rgb(211 55 49/var(\-\-bg\-opacity));&class=contributing-->
[Java](./docs/java.md)<!--rehype:style=background: rgb(211 55 49/var(\-\-bg\-opacity));&class=contributing&data-info=👆看看还缺点儿什么?-->
[Markdown](./docs/markdown.md)<!--rehype:style=background: rgb(103 61 156/var(\-\-bg\-opacity));-->
[MySQL](./docs/mysql.md)<!--rehype:style=background: rgb(103 61 156/var(\-\-bg\-opacity));&class=tag&data-lang=SQL-->
[MATLAB](./docs/matlab.md)<!--rehype:style=background: rgb(0 118 168/var(\-\-bg\-opacity));&class=contributing-->
[Python](./docs/python.md)<!--rehype:style=background: rgb(240 81 57/var(\-\-bg\-opacity));-->
[Rust](./docs/rust.md)<!--rehype:style=background: rgb(71 71 71/var(\-\-bg\-opacity));-->
[Swift](./docs/swift.md)<!--rehype:style=background: rgb(240 81 57/var(\-\-bg\-opacity));-->
[SwiftUI](./docs/swiftui.md)<!--rehype:style=background: rgb(10 127 247/var(\-\-bg\-opacity));&class=tag&data-lang=swift-->
[TOML](./docs/toml.md)<!--rehype:style=background: rgb(132 132 132/var(\-\-bg\-opacity));-->
@@ -45,48 +60,54 @@ Quick Reference
[Sass](./docs/sass.md)<!--rehype:style=background: rgb(207 100 154/var(\-\-bg\-opacity));&class=tag&data-lang=CSS-->
[HTML](./docs/html.md)<!--rehype:style=background: rgb(228 77 39/var(\-\-bg\-opacity));-->
[JavaScript](./docs/javascript.md)<!--rehype:style=background: rgb(203 183 31/var(\-\-bg\-opacity));-->
[Jest](./docs/jest.md)<!--rehype:style=background: rgb(153 66 91/var(\-\-bg\-opacity));-->
[Lerna](./docs/lerna.md)<!--rehype:style=background: rgb(192 132 252/var(\-\-bg\-opacity));-->
[Less.js](./docs/lessjs.md)<!--rehype:style=background: rgb(29 54 93/var(\-\-bg\-opacity));&class=tag&data-lang=CSS-->
[npm](./docs/npm.md)<!--rehype:style=background: rgb(203 2 0/var(\-\-bg\-opacity));-->
[package.json](./docs/package.json.md)<!--rehype:style=background: rgb(132 132 132/var(\-\-bg\-opacity));-->
[React](./docs/react.md)<!--rehype:style=background: rgb(34 143 173/var(\-\-bg\-opacity));-->
[RegEx](./docs/regex.md)<!--rehype:style=background: rgb(149 36 155/var(\-\-bg\-opacity));-->
[TypeScript](./docs/typescript.md)<!--rehype:style=background: rgb(49 120 198/var(\-\-bg\-opacity));-->
[Vue 2](./docs/vue2.md)<!--rehype:style=background: rgb(64 184 131/var(\-\-bg\-opacity));-->
[Vue 3 ](./docs/vue.md)<!--rehype:style=background: rgb(64 184 131/var(\-\-bg\-opacity));&class=contributing-->
[Yarn](./docs/yarn.md)<!--rehype:style=background: rgb(64 184 131/var(\-\-bg\-opacity));-->
<!--rehype:class=home-card-->
## Nodejs
[Express.js](./docs/expressjs.md)<!--rehype:style=background: rgb(95 151 206/var(\-\-bg\-opacity));-->
[Jest](./docs/jest.md)<!--rehype:style=background: rgb(153 66 91/var(\-\-bg\-opacity));-->
[Koa.js](./docs/koajs.md)<!--rehype:style=background: rgb(95 151 206/var(\-\-bg\-opacity));-->
[Lerna](./docs/lerna.md)<!--rehype:style=background: rgb(192 132 252/var(\-\-bg\-opacity));-->
[npm](./docs/npm.md)<!--rehype:style=background: rgb(203 2 0/var(\-\-bg\-opacity));-->
[package.json](./docs/package.json.md)<!--rehype:style=background: rgb(132 132 132/var(\-\-bg\-opacity));-->
[Yarn](./docs/yarn.md)<!--rehype:style=background: rgb(33 136 182/var(\-\-bg\-opacity));-->
<!--rehype:class=home-card-->
## 工具
[Emacs](./docs/emacs.md)<!--rehype:style=background: rgb(0 193 9/var(\-\-bg\-opacity));-->
[FFmpeg](./docs/ffmpeg.md)<!--rehype:style=background: rgb(0 193 9/var(\-\-bg\-opacity));&class=contributing-->
[nginx](./docs/nginx.md)<!--rehype:style=background: rgb(0 193 9/var(\-\-bg\-opacity));-->
[Emacs](./docs/emacs.md)<!--rehype:style=background: rgb(98 36 134/var(\-\-bg\-opacity));-->
[Gmail](./docs/gmail.md)<!--rehype:style=background: rgb(234 67 54/var(\-\-bg\-opacity));-->
[nginx](./docs/nginx.md)<!--rehype:style=background: rgb(0 153 0/var(\-\-bg\-opacity));-->
[Semver](./docs/semver.md)<!--rehype:style=background: rgb(106 111 141/var(\-\-bg\-opacity));-->
[Sketch](./docs/sketch.md)<!--rehype:style=background: rgb(223 148 0/var(\-\-bg\-opacity));-->
[Sublime Text](./docs/sublime-text.md)<!--rehype:style=background: rgb(223 148 0/var(\-\-bg\-opacity));-->
[VSCode](./docs/vscode.md)<!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));-->
[Vim](./docs/vim.md)<!--rehype:style=background: rgb(9 150 8/var(\-\-bg\-opacity));-->
[WebStorm](./docs/webstorm.md)<!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));-->
[WebStorm](./docs/webstorm.md)<!--rehype:style=background: rgb(32 148 220/var(\-\-bg\-opacity));-->
[XPath](./docs/xpath.md)<!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));-->
[Xcode](./docs/xcode.md)<!--rehype:style=background: rgb(24 151 233/var(\-\-bg\-opacity));-->
<!--rehype:class=home-card-->
## Linux 命令
[Ansible](./docs/ansible.md)<!--rehype:style=background: rgb(238 0 0/var(\-\-bg\-opacity));&class=contributing tag&data-lang=RedHad&data-info=👆看看还缺点儿什么?-->
[Awk](./docs/awk.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Conan](./docs/conan.md)<!--rehype:style=background: rgb(0 193 9/var(\-\-bg\-opacity));&class=tag&data-lang=C/C++-->
[Cargo](./docs/cargo.md)<!--rehype:style=background: rgb(71 71 71/var(\-\-bg\-opacity));&class=tag&data-lang=Rust-->
[Curl](./docs/curl.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Chmod](./docs/chmod.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Cron](./docs/cron.md)<!--rehype:style=background: rgb(239 68 68/var(\-\-bg\-opacity));-->
[CMake](./docs/cmake.md)<!--rehype:style=background: rgb(92 107 192/var(\-\-bg\-opacity));&class=contributing-->
[Git](./docs/git.md)<!--rehype:style=background: rgb(215 89 62/var(\-\-bg\-opacity));-->
[Grep](./docs/grep.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Find](./docs/find.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[FFmpeg](./docs/ffmpeg.md)<!--rehype:style=background: rgb(0 193 9/var(\-\-bg\-opacity));&class=contributing-->
[Htop](./docs/htop.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Home Brew](./docs/homebrew.md)<!--rehype:style=background: rgb(252 185 87/var(\-\-bg\-opacity));-->
[Netstat](./docs/netstat.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
@@ -95,6 +116,7 @@ Quick Reference
[Sed](./docs/sed.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[SSH](./docs/ssh.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
[Screen](./docs/screen.md)<!--rehype:style=background: rgb(99 99 99/var(\-\-bg\-opacity));-->
[YUM](./docs/yum.md)<!--rehype:style=background: rgb(86 86 123/var(\-\-bg\-opacity));-->
<!--rehype:class=home-card-->
## 其它

367
docs/ansible.md Normal file
View File

@@ -0,0 +1,367 @@
Ansible 备忘清单
====
此快速参考备忘单提供了使用 [Ansible](https://ansible.com) 的各种方法。
入门
---
### 安装
安装命令 | 环境
:-|-
`brew install ansible` | macos
`yum install -y ansible` | centos
`pip install ansible` | python
---
- [Ansible 官方文档](https://docs.ansible.com)
### 配置位置
文件路径 | 说明
:-|-
`/etc/ansible/ansible.cfg` | 系统范围的配置
`~/ansible.cfg` | 用户特定的配置
`$pwd/ansible.cfg` | 当前目录下的配置
### Inventory文件(hosts列表)
#### 静态Inventory
`/etc/ansible/hosts`
```INI
mail.example.com
[webservers]
foo.example.com
bar.example.com
```
## 命令行(ad-hoc)
### ansible
检查Inventory是否生效
```shell
$ ansible all --list-hosts
```
ping所有目标
```shell
$ ansible all -m ping
```
ping本地(不使用SSH连接)
```shell
$ ansible all -i localhost, -e '{"ansible_connection": "local"}' -m ping
```
<!--rehype:className=wrap-text -->
本地执行命令
```shell
$ ansible all -i localhost, -e '{"ansible_connection": "local"}' -a 'hostname'
```
<!--rehype:className=wrap-text -->
获取本地主机的信息
```shell
$ ansible all -i localhost, -e '{"ansible_connection": "local"}' -m setup
```
<!--rehype:className=wrap-text -->
获取远程到本地
```shell
$ ansible target -m fetch -a "src=/tmp/seq dest=/tmp/seq"
```
<!--rehype:className=wrap-text -->
拷贝本地到远程
```shell
$ ansible target -m copy -a "src=/tmp/seq dest=/tmp/seq"
```
<!--rehype:className=wrap-text -->
### Ansible 命令帮助
<!--rehype:wrap-class=col-span-2 row-span-3-->
```bash
$ ansible
$ ansible <host-pattern> [options]
```
----
:- | -
:- | -
`-a MODULE_ARGS`, `--args=MODULE_ARGS` | 模块参数
`--ask-vault-pass` | 询问保险库密码
`-B SECONDS`, `--background=SECONDS` | 异步运行X 秒后失败 (默认=N/A)
`-C`, `--check` | 不要做任何改变;相反,尝试预测可能发生的一些变化
`-D`, `--diff` | 更改(小)文件和模板时,显示这些文件中的差异; 与 `--check` 配合使用效果很好
`-e EXTRA_VARS`, `--extra-vars=EXTRA_VARS` | 将附加变量设置为 key=value 或 YAML/JSON
`-f FORKS`, `--forks=FORKS` | 指定要使用的并行进程数 (default=5)
`-h`, `--help` | 显示此帮助信息并退出
`-i INVENTORY`, `--inventory-file=INVENTORY` | 指定清单主机路径(默认=/etc/ansible/hosts)或逗号分隔的主机列表
`-l SUBSET`, `--limit=SUBSET` | 进一步将选定主机限制为其他模式
`--list-hosts` | 输出匹配主机列表;不执行任何其他操作
`-m MODULE_NAME`, `--module-name=MODULE_NAME` | 要执行的模块名称 (default=command)
`-M MODULE_PATH`, `--module-path=MODULE_PATH` | 指定模块库的路径 (default=None)
`--new-vault-password-file=NEW_VAULT_PASSWORD_FILE` | 用于重新生成密钥的新保管库密码文件
`-o`, `--one-line` | 压缩输出
`--output=OUTPUT_FILE` | 用于加密或解密的输出文件名; 使用 - 用于标准输出
`-P POLL_INTERVAL`, `--poll=POLL_INTERVAL` | 如果使用 -B 则设置轮询间隔(default=15)
`--syntax-check` | 对 playbook 执行语法检查,但不要执行它
`-t TREE`, `--tree=TREE` | 将输出记录到此目录
`--vault-password-file=VAULT_PASSWORD_FILE` | 保险库密码文件
`-v`, `--verbose` | 详细模式(-vvv 更多,-vvvv 启用连接调试)
`--version` | 显示程序的版本号并退出
控制谁以及如何连接到主机,连接选项:
:- | -
:- | -
`-k`, `--ask-pass` | 询问连接密码
`--private-key=PRIVATE_KEY_FILE`, `--key-file=PRIVATE_KEY_FILE` | 使用此文件来验证连接
`-u REMOTE_USER`, `--user=REMOTE_USER` | 以此用户身份连接(default=None)
`-c CONNECTION`, `--connection=CONNECTION` | 要使用的连接类型 (default=smart)
`-T TIMEOUT`, `--timeout=TIMEOUT` | 以秒为单位覆盖连接超时 (default=10)
`--ssh-common-args=SSH_COMMON_ARGS` | 指定要传递给 sftp/scp/ssh 的常用参数 (e.g. ProxyCommand)
`--sftp-extra-args=SFTP_EXTRA_ARGS` | 指定仅传递给 sftp 的额外参数 (e.g. -f, -l)
`--scp-extra-args=SCP_EXTRA_ARGS` | 指定仅传递给 `scp` 的额外参数 (e.g. -l)
`--ssh-extra-args=SSH_EXTRA_ARGS` | 指定仅传递给 `ssh` 的额外参数 (e.g. -R)
控制您成为目标主机上的用户的方式和用户,特权升级选项:
:- | -
:- | -
`-s`, `--sudo` | 使用 sudo (nopasswd) 运行操作(已弃用,使用 become)
`-U SUDO_USER`, `--sudo-user=SUDO_USER` | 所需的 sudo 用户(默认=root)(已弃用,使用 become)
`-S`, `--su` | 使用 su 运行操作(已弃用,使用 become)
`-R SU_USER`, `--su-user=SU_USER` | 以该用户身份使用 su 运行操作(默认 = root)(已弃用,使用 become)
`-b`, `--become` | 使用 become 运行操作(不暗示密码提示)
`--become-method=BECOME_METHOD` | 要使用的权限提升方法(默认=sudo),有效选择:[ sudo | su | pbrun | pfexec | runas | doas | dzdo ]
`--become-user=BECOME_USER` | 以该用户身份运行操作(默认=root)
`--ask-sudo-pass` | 询问 sudo 密码(已弃用,使用 become)
`--ask-su-pass` | 询问 su 密码(已弃用,使用 become)
`-K`, `--ask-become-pass` | 要求提权密码
### Ansible Galaxy 工具
```bash
$ ansible-galaxy [delete|import|info|init|install|list|login|remove|search|setup] [--help] [options] ...
```
<!--rehype:className=wrap-text-->
---
:- | -
:- | -
`-h`, `--help` | 显示此帮助信息并退出
`-v`, `--verbose` | 详细模式(-vvv 更多,-vvvv 启用连接调试)
`--version` | 显示程序的版本号并退出
<!--rehype:className=style-list-->
---
```bash
$ ansible-galaxy search --author <AUTHOR>
$ ansible-galaxy search --platforms <PLATFORM>
$ ansible-galaxy search --galaxy-tags <TAG>
$ ansible-galaxy info <ROLE>
$ ansible-galaxy install <ROLE> -p <ROLE_DIRECTORY>
$ ansible-galaxy install -r <ROLE1> <ROLE2> <ROLE3> ...
$ ansible-galaxy list
$ ansible-galaxy remove <ROLE>
$ ansible-galaxy init <ROLE>
$ ansible-galaxy init --offline <ROLE>
```
<!--rehype:className=wrap-text-->
### ansible-doc
在本地访问文档
```bash
$ ansible-doc
$ ansible-doc [options] [module...]
```
---
:- | -
:- | -
`-h`, `--help` | 显示此帮助信息并退出
`-l`, `--list` | 列出可用模块
`-M MODULE_PATH`, `--module-path=MODULE_PATH` | 指定模块库的路径 (default=None)
`-s`, `--snippet` | 显示指定模块的剧本片段
`-v`, `--verbose` | 详细模式(-vvv 更多,-vvvv 启用连接调试)
`--version` | 显示程序的版本号并退出
<!--rehype:className=style-list-->
### ansible-vault
```bash
$ ansible-vault
$ ansible-vault [create|decrypt|edit|encrypt|rekey|view] [--help] [options] vaultfile.yml
```
---
:- | -
:- | -
`--ask-vault-pass` | 询问保险库密码
`-h`, `--help` | 显示此帮助信息并退出
`--new-vault-password-file=NEW_VAULT_PASSWORD_FILE` | 用于重新生成密钥的新保管库密码文件
`--output=OUTPUT_FILE` | 用于加密或解密的输出文件名; 使用 - 用于标准输出
`--vault-password-file=VAULT_PASSWORD_FILE` | 保险库密码文件
`-v`, `--verbose` | 详细模式(-vvv 更多,-vvvv 启用连接调试)
`--version` | 显示程序的版本号并退出
<!--rehype:className=style-list-->
### ansible-playbook
<!--rehype:wrap-class=row-span-2-->
```bash
$ ansible-playbook
$ ansible-playbook playbook.yml
```
---
:- | -
:- | -
`--ask-vault-pass` | 询问保险库密码
`-C`, `--check` | 不要做任何改变;相反,尝试预测可能发生的一些变化
`-D`, `--diff` | 更改(小)文件和模板时,显示这些文件中的差异;与 `--check` 配合使用效果很好
`-e EXTRA_VARS`, `--extra-vars=EXTRA_VARS` | 将附加变量设置为 key=value 或 YAML/JSON
`--flush-cache` | 清除事实缓存
`--force-handlers` | 即使任务失败也运行处理程序
`-f FORKS`, `--forks=FORKS` | 指定要使用的并行进程数(默认值=5
`-h`, `--help` | 显示此帮助信息并退出
`-i INVENTORY`, `--inventory-file=INVENTORY` | 指定清单主机路径(默认=/etc/ansible/hosts或逗号分隔的主机列表
`-l SUBSET`, `--limit=SUBSET` | 进一步将选定主机限制为其他模式
`--list-hosts` | 输出匹配主机列表;不执行任何其他操作
`--list-tags` | 列出所有可用的标签
`--list-tasks` | 列出所有将要执行的任务
`-M MODULE_PATH`, `--module-path=MODULE_PATH` | 指定模块库的路径(默认=无)
`--new-vault-password-file=NEW_VAULT_PASSWORD_FILE` | 用于重新生成密钥的新保管库密码文件
`--output=OUTPUT_FILE` | 用于加密或解密的输出文件名;使用 - 用于标准输出
`--skip-tags=SKIP_TAGS` | 只运行标签与这些值不匹配的播放和任务
`--start-at-task=START_AT_TASK` | 在匹配此名称的任务处启动剧本
`--step` | 一步一步:在运行前确认每个任务
`--syntax-check` | 对 playbook 执行语法检查,但不要执行它
`-t TAGS`, `--tags=TAGS` | 只运行带有这些值标记的播放和任务
`--vault-password-file=VAULT_PASSWORD_FILE` | 保险库密码文件
`-v`, `--verbose` | 详细模式(-vvv 更多,-vvvv 启用连接调试)
`--version` | 显示程序的版本号并退出
<!--rehype:className=style-list-->
连接选项:
:- | -
:- | -
`-k`, `--ask-pass` | 询问连接密码
`--private-key=PRIVATE_KEY_FILE`, `--key-file=PRIVATE_KEY_FILE` | 使用此文件来验证连接
`-u REMOTE_USER`, `--user=REMOTE_USER` | 以此用户身份连接(默认=None)
`-c CONNECTION`, `--connection=CONNECTION` | 要使用的连接类型(默认=smart)
`-T TIMEOUT`, `--timeout=TIMEOUT` | 以秒为单位覆盖连接超时(默认值 = 10)
`--ssh-common-args=SSH_COMMON_ARGS` | 指定要传递给 sftp/scp/ssh 的常用参数(例如 ProxyCommand)
`--sftp-extra-args=SFTP_EXTRA_ARGS` | 指定仅传递给 sftp 的额外参数(例如 -f、-l)
`--scp-extra-args=SCP_EXTRA_ARGS` | 指定仅传递给 scp 的额外参数(例如 -l)
`--ssh-extra-args=SSH_EXTRA_ARGS` | 指定仅传递给 ssh 的额外参数(例如 -R)
<!--rehype:className=style-list-->
特权升级选项:
:- | -
:- | -
`-s`, `--sudo` | 使用 sudo (nopasswd) 运行操作(已弃用,使用 become)
`-U SUDO_USER`, `--sudo-user=SUDO_USER` | 所需的 sudo 用户(默认=root)(已弃用使用become)
`-S`, `--su` | 使用 su 运行操作(已弃用,使用 become)
`-R SU_USER`, `--su-user=SU_USER` | 以该用户身份使用 su 运行操作(默认 = root)(已弃用使用become)
`-b`, `--become` | 使用 become 运行操作(不暗示密码提示)
`--become-method=BECOME_METHOD` | 要使用的权限提升方法(默认=sudo),有效选择:[ sudo \| su \| pbrun \| pfexec \| runas \| doas \| dzdo ]
`--become-user=BECOME_USER` | 以该用户身份运行操作(默认=root)
`--ask-sudo-pass` | 询问 sudo 密码(已弃用,使用 become)
`--ask-su-pass` | 询问 su 密码(已弃用,使用 become)
`-K`, `--ask-become-pass` | 要求提权密码
<!--rehype:className=style-list-->
### ansible-pull
<!--rehype:wrap-class=row-span-2-->
```bash
$ ansible-pull
$ ansible-pull -U <repository> [options]
```
---
:- | -
:- | -
`--accept-host-key` | 如果尚未添加,则添加 repo url 的主机密钥
`--ask-vault-pass` | 询问保险库密码
`-C CHECKOUT`, `--checkout=CHECKOUT` | 分支/标签/提交结帐。默认为存储库模块的行为。
`-d DEST`, `--directory=DEST` | 签出存储库的目录
`-e EXTRA_VARS`, `--extra-vars=EXTRA_VARS` | 将附加变量设置为 key=value 或 YAML/JSON
`-f`, `--force` | 即使无法更新存储库也运行 playbook
`--full` | 做一个完整的克隆,而不是一个浅的
`-h`, `--help` | 显示此帮助信息并退出
`-i INVENTORY`, `--inventory-file=INVENTORY` | 指定清单主机路径(默认=/etc/ansible/hosts)或逗号分隔的主机列表
`-l SUBSET`, `--limit=SUBSET` | 进一步将选定主机限制为其他模式
`--list-hosts` | 输出匹配主机列表;不执行任何其他操作
`-m MODULE_NAME`, `--module-name=MODULE_NAME` | 存储库模块名称ansible 将使用它来签出 repo。默认是 git
`-M MODULE_PATH`, `--module-path=MODULE_PATH` | 指定模块库的路径(默认=无)
`--new-vault-password-file=NEW_VAULT_PASSWORD_FILE` | 用于重新生成密钥的新保管库密码文件
`-o`, `--only-if-changed` | 仅在存储库已更新时才运行 playbook
`--output=OUTPUT_FILE` | 用于加密或解密的输出文件名;使用 - 用于标准输出
`--purge` | 剧本运行后清除结帐
`--skip-tags=SKIP_TAGS` | 只运行标签与这些值不匹配的播放和任务
`-s SLEEP`, `--sleep=SLEEP` | 在开始之前休眠随机间隔(在 0 到 n 秒之间)。这是分散 git 请求的有用方法
`-t TAGS`, `--tags=TAGS` | 只运行带有这些值标记的播放和任务
`-U URL`, `--url=URL` | 剧本存储库的 URL
`--vault-password-file=VAULT_PASSWORD_FILE` | 保险库密码文件
`-v`, `--verbose` | 详细模式(-vvv 更多,-vvvv 启用连接调试)
`--verify-commit` | 验证签出提交的 GPG 签名,如果失败则中止运行 playbook。这就需要对应的VCS模块来支持这样的操作
`--version` | 显示程序的版本号并退出
<!--rehype:className=style-list-->
连接选项:
:- | -
:- | -
`-k`, `--ask-pass` | 询问连接密码
`--private-key=PRIVATE_KEY_FILE`, `--key-file=PRIVATE_KEY_FILE` | 使用此文件来验证连接
`-u REMOTE_USER`, `--user=REMOTE_USER` | 以此用户身份连接(默认=无)
`-c CONNECTION`, `--connection=CONNECTION` | 要使用的连接类型(默认=智能)
`-T TIMEOUT`, `--timeout=TIMEOUT` | 以秒为单位覆盖连接超时(默认值 = 10)
`--ssh-common-args=SSH_COMMON_ARGS` | 指定要传递给 sftp/scp/ssh 的常用参数(例如 ProxyCommand)
`--sftp-extra-args=SFTP_EXTRA_ARGS` | 指定仅传递给 sftp 的额外参数(例如 -f、-l)
`--scp-extra-args=SCP_EXTRA_ARGS` | 指定仅传递给 scp 的额外参数(例如 -l)
`--ssh-extra-args=SSH_EXTRA_ARGS` | 指定仅传递给 ssh 的额外参数(例如 -R)
<!--rehype:className=style-list-->
特权升级选项:
:- | -
:- | -
`--ask-sudo-pass` | 询问 sudo 密码(已弃用使用become)
`--ask-su-pass` | 询问 su 密码(已弃用使用become)
`-K`, `--ask-become-pass` | 要求提权密码
<!--rehype:className=style-list-->
<!-- ### ansible-playbook -->
<!-- todo -->
另见
---
[Getting started with Ansible](https://docs.ansible.com/ansible/latest/getting_started/index.html)
[Introduction to ad hoc commands](https://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html)
[Ansible cheatsheet](https://github.com/luckylittle/ansible-cheatsheet/blob/master/ansible-cheatsheet.txt)

432
docs/cargo.md Normal file
View File

@@ -0,0 +1,432 @@
Cargo 备忘清单
===
此快速参考备忘清单 [Cargo](https://conan.io/) 提供了编译 [Rust](./rust.md) 常用命令和示例
入门
--------
### 安装 Rust 和 Cargo
```bash
$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
```
<!--rehype:className=wrap-text-->
在 Linux 和 macOS 系统上,这可以通过以上方命令完成
- [Cargo 开源仓库](https://github.com/rust-lang/cargo) _(github.com)_
- [Cargo 官网](https://doc.rust-lang.org/cargo) _(doc.rust-lang.org)_
- [Cargo 官网(中文)](https://www.rustwiki.org.cn/zh-CN/cargo/index.html) _(rustwiki.org.cn)_
- [Rust 社区的 crate 仓库](https://crates.io/) _(crates.io)_
### 命令说明
<!--rehype:wrap-class=col-span-2-->
:- | :-
:- | :-
`cargo version` | 显示版本信息以确认 Cargo 已安装
`cargo new` | 创建一个新项目
`cargo test` | 在项目中运行单元测试
`cargo check` | 快速编译项目,无需生成二进制文件来检查错误
`cargo fmt` | 自动格式化代码
`cargo build` | 编译一个项目
`cargo run` | 一步编译和运行项目
`cargo clippy --all-targets -- --D warnings` | Linter 检查错误
`cargo tarpaulin --ignore-tests` | 检查代码覆盖率
### 切换源
<!--rehype:wrap-class=col-span-2&style=background:#e91e63;--->
```bash
$ touch ~/.cargo/config # 添加配置文件
$ vim ~/.cargo/config # 编辑配置文件
```
配置文件 `config` 内容
```toml
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'tuna' # 👈 如果需要提交包注释配置源
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
# registry = "git://mirrors.ustc.edu.cn/crates.io-index"
```
💥 注意切换源需要删除缓存目录
```bash
$ rm -rf ~/.cargo/.package-cache # ⚠️ 删除缓存目录内容
```
### 创建新项目
<!--rehype:wrap-class=row-span-3-->
```bash
$ cargo new hello_world --bin
```
---
- `--bin` 正在制作一个二进制程序
- `--lib` 正在创建一个库(lib)
得到如下目录:
```bash
$ cd hello_world
$ tree .
.
├── Cargo.toml
└── src
└── main.rs
```
`Cargo.toml` 被称为一个 `manifest` 元清单,它包含了 `Cargo` 编译项目所需的所有元数据
```toml
[package]
name = "hello_world"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
[dependencies]
```
入口文件 `src/main.rs`
```rust
fn main() {
println!("Hello, world!");
}
```
运行编译生成 `hello_world` 二进制文件
```bash
$ cargo build
# 文件放入 `target/release` 目录
$ cargo build --release
```
然后运行它:
```bash
$ ./target/debug/hello_world
Hello, world!
```
也可以直接使用 `cargo run`,它会自行`编译``运行`它:
```bash
$ cargo run
Running `target/hello_world`
Hello, world!
```
### 项目目录
```bash
.
├── Cargo.lock
├── Cargo.toml
├── benches # 基准目录
│ └── large-input.rs
├── examples # 示例
│ └── simple.rs
├── src # 源代码
│ ├── bin
│ │ └── another_executable.rs
│ ├── lib.rs # 默认库
│ └── main.rs # 入口文件
└── tests # 集成测试
└── some-integration-tests.rs
```
### 编译测试
```bash
# 编译输出二进制文件,放入 `target/debug` 目录
$ cargo build
# 输出二进制文件,放入 `target/release` 目录
$ cargo build --release
$ cargo run # 编译并运行
$ cargo test # 运行您的测试
$ cargo test foo # 传递过滤器,来运行特定测试
```
### 配置目标
<!--rehype:wrap-class=row-span-2-->
```toml
[package]
# ...
[lib]
# 生成目标与库的名称. 本该默认是包名, 替换所有破折号为 下划线. (Rust `extern crate` 声明会参考该名因此该值必须是可用的有效Rust标识符)
name = "foo"
# 该字段,指向 crate 的入口(位置), 路径相对于 `Cargo.toml`.
path = "src/lib.rs"
# 一个给目标启用单元测试 的 标志. 会被 `cargo test`使用.
test = true
# 一个给目标启用文档测试 的 标志. 只与库相关, 不会影响其他部分。会被 `cargo test`使用.
doctest = true
# 一个给目标启用基准 的 标志. 会被 `cargo bench`使用.
bench = true
# 一个给目标启用文档 的 标志. 会被 `cargo doc`使用.
doc = true
# 若该目标为 编译器扩展, 那要把该字段设为 true以让 Cargo 正确编译和,可用于所有依赖项.
plugin = false
# 若该目标为 "macros 1.1" 程序宏, 那要把该字段设为 true
proc-macro = false
# 若设为 false, `cargo test` 会为 rustc 省略 `--test` 标志, 这阻止它生成测试工具 这在二进制存在,构建管理测试运行器本身的情况下,有用.
harness = true
# 若设置了,那 目标会使用一个与`[package]`配置不同的版本, 也许是,编译一个库 2018年版本或编译单元测试的2015年版本. 默认情况下所有目标都使用`[package]`中指定的版本进行编译。
edition = '2015'
```
<!--rehype:className=wrap-text-->
### 来源配置
```toml
# `source` 表下,就是存储有关要更换的来源名称
[source]
# 在`source` 表格之下的,可为一定数量的有关来源名称. 示例下面就,定义了一个新源, 叫 `my-awesome-source`,其内容来自本地,`vendor`目录 ,其相对于包含 `.cargo/config` 文件的目录
[source.my-awesome-source]
directory = "vendor"
# Git sources 也指定一个 branch/tag/rev
git = "https://example.com/path/to/repo"
# branch = "master"
# tag = "v1.0.1"
# rev = "313f44e8"
# crates.io 默认源 在"crates-io"名称下,且在这里我们使用 `replace-with` 字段指明 默认源更换成"my-awesome-source"源
[source.crates-io]
replace-with = "my-awesome-source"
```
<!--rehype:className=wrap-text -->
### 配置
```toml
# 每个源都有自己的表格,名称即是表名
[source.the-source-name]
# 命令 `the-source-name` 会被 `another-source`取代
replace-with = "another-source"
# 有几种可用的源定义(接下来有所描述)
registry = "https://example.com/path/to/index"
local-registry = "path/to/registry"
directory = "path/to/vendor"
```
<!--rehype:className=wrap-text -->
更换源的配置通过完成 `.cargo/config`,上面是全套可用字段
包相关命令
---
### init/new
<!--rehype:wrap-class=row-span-2-->
创建一个新的 `cargo`
```bash
$ cargo init [options] [path]
$ cargo new [options] [path]
```
- `--bin` 创建具有二进制目标 (src/main.rs) 的包(默认行为)
- `--lib` 使用库目标 (src/lib.rs) 创建一个包
- `--edition edition` 指定要使用的 Rust 版本。默认值为 `2021`。可能的值2015、2018、2021
- `--name name` 设置包名。默认为目录名称
- `--vcs vcs` 为给定的版本控制系统git、hg、pijul 或fossil初始化一个新的 VCS 存储库,或者根本不初始化任何版本控制(无)
- `--registry registry` 限制仅发布到该注册表
<!--rehype:className=style-arrow-->
```bash
$ cargo new foo
```
### 安装包
<!--rehype:wrap-class=row-span-2-->
```bash
# 从 crates.io 安装或升级软件包:
$ cargo install ripgrep
# 在当前目录安装或重新安装包:
$ cargo install --path .
# 查看已安装包的列表:
$ cargo install --list
```
----
- `--vers version`
- `--version version` 指定要安装的版本
- `--git url` 用于安装指定 crate 的 Git URL
- `--branch branch` 从 git 安装时要使用的分支
- `--tag tag` 从 git 安装时使用的标记
- `--rev sha` 从 git 安装时使用的特定提交
- `--path path` 要安装的本地 crate 的文件系统路径
- `--list` 列出所有已安装的软件包及其版本
- `-f`, `--force` 强制覆盖现有的 crate 或二进制文件
### 搜索包
```bash
$ cargo search [options] [query...]
```
- `--limit limit` 限制结果数量(默认值10最大值100)
- `--index index` 要使用的注册表索引的 URL
- `--registry registry` 要使用的注册表的名称
```bash
$ cargo search serde
```
### 卸载包
```bash
$ cargo uninstall [options] [spec...]
```
- `-p`, `--package spec...` 要卸载的软件包
- `--bin name...` 仅卸载二进制名称
- `--root dir` 从中卸载软件包的目录
```bash
$ cargo uninstall ripgrep
```
发布命令
---
### 登录
```bash
$ cargo login [options] [token]
```
----
:-|:-
:-|:-
`--registry` | 要使用的注册表的名称
----
:-|:-
:-|:-
`-v`, `--verbose` | 启用更加详细的输出
`-q`, `--quiet` | 不输出Cargo的日志信息
`--color when` | 输出内容的颜色 `auto`, `always`, `never`
### 所有者
```bash
# 列出包的所有者:
$ cargo owner --list foo
# 邀请所有者加入包:
$ cargo owner --add username foo
# 从包中删除所有者:
$ cargo owner --remove username foo
```
----
:-|:-
:-|:-
`--token token` | 身份验证时使用的 API 令牌
`--index index` | 要使用的注册表索引的 URL
### 打包 & 发布公共选项
<!--rehype:wrap-class=row-span-3-->
选择包
- `-p spec...`, `--package spec...` Package 指定包
- `--workspace` Package 工作区中的全体成员
- `--exclude SPEC...` 排除指定包
编译选项
- `--target triple` 为指定架构执行 Package
- `--target-dir directory` 用于存放生成的工件以及中间文件的目录
特性选择
- `--features features` 传递以空格或者逗号分隔的列表,其中给出要启用的特性
- `--all-features` 为给定的包启用全部可用特性
- `--no-default-features` 不启用给定包的default特性
清单选项
- `--manifest-path path` 用于指定 Cargo.toml 文件的路径
- `--frozen`, `--locked` 这两个选项用于保证Cargo.lock文件是最新的
- `--offline` 禁止Cargo访问网络
混杂选项
- `-j N`, `--jobs N` 要并行运行的作业数量
### 打包
将本地包打包为可分发的压缩文件
```bash
$ cargo package [options]
```
----
- `-l`, `--list` 输出包中包含的文件(不实际进行打包)。
- `--no-verify` 构建包时不进行校验。
- `--no-metadata` 忽略 缺少可读的元信息(如描述信息或采用的授权协议) 时产生的警告。
- `--allow-dirty` 允许打包 在版本控制系统中仍有未提交内容 的包。
### 发布
<!--rehype:wrap-class=row-span-2-->
```bash
$ cargo publish [options]
```
发布选项
- `--dry-run` 在不上传的情况下执行所有检查
- `--token token` 身份验证时使用的 API 令牌
- `--no-verify` 不要通过构建内容来验证内容
- `--allow-dirty` 允许打包具有未提交的 VCS 更改的工作目录
- `--index index` 要使用的注册表索引的 URL
- `--registry registry` 要发布到的注册表的名称
打包选择
- `-p spec`, `--package spec` 要发布的包
### yank
从服务器的索引中删除以前发布的 crate 版本
```bash
$ cargo yank --vers 1.0.7 foo
```
- `--vers version` 要 yank 或 un-yank 的版本
- `--undo` 撤消 yank将版本放回索引中
- `--token token` 身份验证时使用的 API 令牌
- `--index index` 要使用的注册表索引的 URL
- `--registry registry` 要使用的注册表名称
另见
---
- [The Cargo Book](https://doc.rust-lang.org/stable/cargo/) _(doc.rust-lang.org)_
- [Cargo 手册 中文版](https://www.rustwiki.org.cn/zh-CN/cargo/index.html) _(rustwiki.org.cn)_

114
docs/cmake.md Normal file
View File

@@ -0,0 +1,114 @@
CMake 备忘清单
===
本清单提供了对 CMake 的入门简要概述,以及 CMake 常用示例
入门
---
### Hello CMake
CMake 是一个用于配置跨平台源代码项目应该如何配置的工具建立在给定的平台上。
```bash
├┈ CMakeLists.txt # 希望运行的 CMake 命令
╰┈ main.cpp # 带有 main 的源文件
```
在此项目上运行 `CMake` 时,系统会要求您提供二进制目录,运行 `CMake` 不会创建最终的可执行文件,而是会为 `Visual Studio``XCode``makefile` 生成项目文件。 使用这些工具构建该项目
#### CMakeLists.txt
```cmake
# 设置可以使用的最低 CMake 版本
cmake_minimum_required(VERSION 3.5)
# 设置项目名称
project (hello_cmake)
# 添加可执行文件
add_executable(hello_cmake main.cpp)
```
#### main.cpp
```c
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "Hello CMake!" << std::endl;
return 0;
}
```
#### 编译示例
```bash
$ mkdir build # 创建 build 目录
$ cd build # 进入目录
$ cmake .. # 目录的上一级目录运行命令
$ ./hello_cmake # 运行生成的 hello_cmake
Hello CMake!
```
### cmake
<!--rehype:wrap-class=col-span-2-->
生成项目构建系统
```bash
$ cmake [<options>] <path-to-source | path-to-existing-build>bash
$ cmake [<options>] -S <path-to-source> -B <path-to-build>
```
建立一个项目
```bash
$ cmake --build <dir> [<options>] [-- <build-tool-options>]
```
安装项目
```bash
$ cmake --install <dir> [<options>]
```
打开一个项目
```bash
$ cmake --open <dir>
```
运行脚本
```bash
$ cmake [-D <var>=<value>]... -P <cmake-script-file>
```
运行命令行工具
```bash
$ cmake -E <command> [<options>]
```
运行查找包工具
```bash
$ cmake --find-package [<options>]
```
运行工作流预设
```bash
$ cmake --workflow [<options>]
```
查看帮助
```bash
$ cmake --help[-<topic>]
```
另见
----
- [CMake Examples](http://ttroy50.github.io/cmake-examples/) _(ttroy50.github.io)_

228
docs/conan.md Normal file
View File

@@ -0,0 +1,228 @@
Conan 备忘清单
===
这个 [Conan](https://conan.io/) 快速参考备忘清单显示了它的常用命令使用清单
入门
---
### 介绍
Conan 是开源、去中心化和多平台的软件包,管理器来创建和共享您的所有本机二进制文件
- [Conan 官网](https://conan.io/)
#### 安装
```bash
$ pip install conan
$ pip install conan --upgrade
```
初始化配置文件
```bash
$ conan config init
```
### 显示本地客户端配置
Conan 应用配置
```bash
# 查看 Conan 主目录
$ conan config home
# 显示部分或全部配置项
$ conan config get [<section>.<config>]
# 显示完整的 conan.conf 文件
$ conan config get
# 在“日志”部分显示“级别”项
$ conan config get log.level
```
配置文件的内容(例如默认值)
```bash
$ conan profile show default
```
远程存储库
```bash
$ conan remote list
```
### 添加和修改配置
安装配置集合
```bash
$ conan config install <url>
$ conan config install ./my_config.conf
```
更改单个配置值
```bash
$ conan config set general.revisions_enabled=1
```
<!--rehype:className=wrap-text -->
添加遥控器
```bash
$ conan remote add my_remote <url>
```
提供远程凭据
```bash
$ conan user -p <password> -r my_remote <username>
```
<!--rehype:className=wrap-text -->
### 显示来自 inspect 或 reference 的信息
显示 `conanfile.py` 的属性
```bash
$ conan inspect <path> -a <attribute>
```
显示 `conanfile.py` 的内容以供参考
```bash
$ conan get <reference>
```
显示 `recipe` 的依赖关系图信息
```bash
$ conan info <path_or_reference>
```
### 搜索包
<!--rehype:wrap-class=col-span-2-->
在远程搜索包
```bash
# 列出本地缓存中的包名称
$ conan search
$ conan search <package>/<revision>@<user>/<channel> # 输出取决于给出了多少包引用。
# 支持通配符
[--table=file.html] # 将输出保存在 HTML 文件中
[-r=<remote>] # 查看远程存储库(默认为本地缓存)
$ conan search mylib/1.0@user/channel # 显示本地缓存中 mylib/1.0@user/channel 的所有包
$ conan search "zlib/*" -r=all # 在所有远程中显示所有版本的 zlib
$ conan search zlib -r conan-center
# 显示包的修订:
$ conan search <package>/<revision>@<user>/<channel> --revisions
```
### 安装包
<!--rehype:wrap-class=row-span-2-->
仅使用参考安装包
```bash
$ conan install <package_reference>
```
从 conanfile 安装软件包列表
```bash
$ cat conanfile.txt
[requires]
zlib/1.2.11
$ conan install <path_to_conanfile>
```
通过生成器在构建系统中使用包
```bash
$ cat conanfile.txt
[requires]
zlib/1.2.11
[generators]
cmake_find_package
msbuild
make
```
安装需求并生成文件
```bash
$ mkdir build && cd build
$ conan install ..
```
运行您的构建系统(以下之一)
```bash
$ cmake .. && cmake --build .
$ msbuild myproject.sln
$ make
```
### 创建一个包
从模板创建配方 (conanfile.py)
```bash
$ conan new <reference> -m <template>
```
只需将配方导出到本地缓存
```bash
$ conan export <path_to_conanfile>
```
从 recipe 为一种配置创建包
也隐含地安装和导出步骤
```bash
$ conan create . -pr <profile>
```
### 检查包裹
完整打印包装配方:
```bash
$ conan get <package>/<revision>@<user>/<channel>
$ conan get boost/1.74.0
```
<!--rehype:className=wrap-text -->
包装配方的打印属性:
```bash
$ conan inspect <package>/<revision>@<user>/<channel>
$ conan inspect boost/1.74.0
```
<!--rehype:className=wrap-text -->
请参阅 [conan get](https://docs.conan.io/en/latest/reference/commands/consumer/get.html) 和 [conan inspect](https://docs.conan.io/en/latest/reference/commands/misc/inspect.html) 参考
### Lockfiles
创建一个锁文件:
```bash
$ conan lock create <package>/conanfile.py --user=<user> --channel=<channel>
```
<!--rehype:className=wrap-text -->
`conan create``conan install` 期间使用 lockfile
```bash
$ conan <command> --lockfile conan.lock
```
查看 [conan lock](https://docs.conan.io/en/latest/reference/commands/misc/lock.html) 参考

View File

@@ -1116,7 +1116,7 @@ grid-row-gap: length;
### minmax() 函数
<!--rehype:wrap-class=col-span-2-->
```css {.wrap}
```css
.grid {
display: grid;
grid-template-columns: 100px minmax(100px, 500px) 100px;
@@ -1374,10 +1374,11 @@ a[href^="http"]:empty::before {
}
```
如果你的 `<a>` 标签里面没有内容,将 `href` 的值作为内容展示
如果 `<a>` 标签里面没有内容,将 `href` 的值作为内容展示
### 使用 :root 表示灵活类型
<!--rehype:wrap-class=row-span-2-->
响应式布局中的字体大小应该能够根据每个视口进行调整,您可以使用 `:root` 根据视口高度和宽度计算字体大小
@@ -1387,7 +1388,7 @@ a[href^="http"]:empty::before {
}
```
现在您可以根据 `:root` 计算的值使用根 `em` 单位:
您可以根据 `:root` 计算的值使用根 `em` 单位:
```css
body {
@@ -1395,6 +1396,19 @@ body {
}
```
### 类似 contenteditable 的样式
```css
div {
-webkit-user-modify:
read-write-plaintext-only;
}
```
<!--rehype:className=wrap-text -->
通过样式来控制一个元素 `div` 是否可以编辑
另见
---------

View File

@@ -228,3 +228,58 @@ curl "https://{foo,bar}.com/file_[1-4].webp" --output "#1_#2.webp"
<!--rehype:className=wrap-text -->
下载一系列文件(输出`foo_file1.webp``foo_file2.webp…bar_file1_webp`等)
### 将输出重定向到文件
<!--rehype:wrap-class=col-span-3-->
```bash
$ curl http://url/file > file
```
### 基本认证
<!--rehype:wrap-class=col-span-3-->
```bash
$ curl --user username:password http://example.com/
$ curl -u username:password http://example.com/
```
### 写入文件而不是标准输出
<!--rehype:wrap-class=col-span-2-->
```bash
$ curl -o file http://url/file
$ curl --output file http://url/file
```
### 下载头信息
```bash
$ curl -I url
# 显示头信息
```
### 将输出写入名为远程文件的文件
<!--rehype:wrap-class=col-span-2-->
```bash
$ curl -o file http://url/file
$ curl --output file http://url/file
```
### 执行远程脚本
<!--rehype:wrap-class=col-span-2-->
```bash
$ curl -s http://url/myscript.sh
```
### 配置文件
<!--rehype:wrap-class=col-span-2-->
```bash
curl -K file
# 从文件中读取配置
curl --config file
$HOME/.curlrc # 类 UNIX 系统中的默认配置文件
```

View File

@@ -134,6 +134,7 @@ Docker 镜像
<!--rehype:body-class=cols-2-->
### 操控
<!--rehype:wrap-class=row-span-2-->
| `Example` | Description |
|-----------|-----------|
@@ -159,6 +160,12 @@ $ docker build -f myOtherDockerfile .
$ curl example.com/remote/Dockerfile | docker build -f - .
```
### 删除 \<none> 镜像
```bash
$ docker rmi -f $(docker images | grep "none" | awk '{print $3}')
```
Docker 网络
----
<!--rehype:body-class=cols-2-->

View File

@@ -74,7 +74,7 @@ a{Click me}
p>{Click }+a{here}+{ 继续}
```html {.wrap}
```html
<p>Click <a href="">here</a> 继续</p>
```

View File

@@ -7,6 +7,7 @@ FFmpeg 参考
---
### 安装
<!--rehype:wrap-class=row-span-2-->
Linux
@@ -22,6 +23,7 @@ $ brew install ffmpeg
```
### 示例
<!--rehype:wrap-class=row-span-2-->
mp4 转 avi:
@@ -35,40 +37,86 @@ webm 转 mp4:
$ ffmpeg -i movie.webm movie.mp4
```
### 常用开关
### 全局选项
:- | -
:- | -
`-y` | 覆盖输出文件
`-n` | 不要覆盖输出文件
### 主要选项
:- | -
:- | -
`-f fmt` | 强制输入或输出文件格式
`-i fName` | 输入文件名,未指定显示内容流的摘要
`-c codecName` | 指定编解码器 [输入或输出]
`-fs Nbytes` | 以 Nbytes 指定最大输出文件大小
### 基础参数
:- | -
:- | -
`-codecs` | 列出可用编码
`-formats` | 列出支持的格式
`-protocols` | 列出支持的协议
`-i input.mp4` | 指定输入文件
`-c:v libx264` | 指定视频编码
`-c:a aac` | 指定音频编码
`-vcodec libx264` | 旧写法
`-acodec aac` | 旧写法
`-fs SIZE` | 指定文件大小
### 视频参数
<!--rehype:wrap-class=col-span-2 row-span-2-->
:- | -
:- | -
`-b bRate` | 设置视频比特率(单位 kbit/s)
`-fixaspect` | 固定纵横比
`-bt tolerance` | 设置视频比特率容差(单位 kbit/s)
`-maxrate bRate` | 设置最大视频比特率容差(单位 kbit/s)
`-minrate bRate` | 设置最小视频比特率容差(单位 kbit/s)
`-bufsize size` | 设置速率控制缓冲区大小(以 kByte 为单位)
`-sameq` | 使用与源相同的视频质量(意味着 VBR)
`-newvideo` | 将新的视频流添加到当前输出流
`-aspect RATIO` | 纵横比(4:3、16:9 或 1.25)
`-r RATE` | 每秒帧率
`-s WIDTHxHEIGHT` | 帧大小
`-vn` | 没有视频
### 码率设置
```bash
-codecs # 列出编解码器
-c:v # 视频编解码器(-vcodec)-'copy'复制流
-c:a # 音频编解码器(-acodec)
-fs SIZE # 限制文件大小(字节)
-b:v 1M # 视频比特率(1M = 1Mbit/s)
-b:a 1M # 音频比特率(1M = 1Mbit/s)
```
### 音频
### 尺寸规格
```bash
-aq QUALITY # 音频质量(特定于编解码器)
-ar 44100 # 音频采样率 (Hz)
-ac 1 # 音频通道1=单声道2=立体声)
-an # 没有音频
-vol N # 音量256=正常)
```
:- | - | - | -
:- | - | - | -
`K``k` | 103 | 1000 字节 | 千字节 Kilobytes
`M` | 106 | 1000000 字节 | 兆字节 Megabytes
`G` | 109 | 1000000000 | 千兆字节 Gigabytes
`Ki` | 210 | 1024 | 千字节 Kibibyte
`Mi` | 220 | 1048576 | 兆字节 Mebibyte
`Gi` | 230 | 1073741824 | Gibibyte
### 比特率
```bash
-b:v 1M # 视频比特率1M = 1Mbit/s
-b:a 1M # 音频比特率
```
### 音频参数
<!--rehype:wrap-class=col-span-2-->
#### 视频
```bash
-aspect RATIO # 纵横比4:3、16:9 或 1.25
-r RATE # 每秒帧率
-s WIDTHxHEIGHT # 帧大小
-vn # 没有视频
```
:- | -
:- | -
`-ab bRate` | 设置音频比特率(单位 kbit/s)
`-aframes N` | 设置要录制的音频帧数 [-frames:a 的别名]
`-aq q` | 设置音频质量(特定于编解码器VBR) [-q:a 的别名]
`-an` | 禁用录音
`-acodec codec` | 设置音频编解码器。[-codec:a 的别名] 使用 'copy' 复制流。
`-vol` | 以 256 的倍数更改音频音量,其中 256 = 100%(正常)音量。例如 512 = 200%
`-newaudio` | 将新的音频流添加到当前输出流
`-alang code` | 设置当前音频流的 ISO 639 语言代码(3 个字母)
视频编辑
---
@@ -116,7 +164,7 @@ $ ffmpeg -i input.avi -r 24 output.avi
$ ffmpeg -r 1 -i input.m2v -r 24 output.avi
```
将输入文件的帧速率仅对原始格式有效强制为 1 fps将输出文件的帧速率强制为 24 fps
将输入文件的帧速率(仅对原始格式有效)强制为 1 fps将输出文件的帧速率强制为 24 fps
### 剪切视频部分
<!--rehype:wrap-class=col-span-2-->
@@ -188,7 +236,7 @@ $ ffmpeg -i file.mp4 -vn -acodec copy output.aac
```
<!--rehype:className=wrap-text -->
`-vn`无视频`-acodec copy` 结合起来。请注意,输出文件扩展名必须与输入文件中的音频编解码器匹配,`-acodec copy` 才能工作。
`-vn`(无视频)`-acodec copy` 结合起来。请注意,输出文件扩展名必须与输入文件中的音频编解码器匹配,`-acodec copy` 才能工作。
### 创建缩略图
<!--rehype:wrap-class=row-span-2-->
@@ -259,7 +307,7 @@ $ ffmpeg -i input.mov -itsoffset 3 -i input.mov -map 0:v -map 1:a -codec:a copy
```
<!--rehype:className=wrap-text -->
将视频延迟 3 秒即将音频提前 3 秒
将视频延迟 3 秒(即将音频提前 3 秒)
```bash
$ ffmpeg -i input.mov -itsoffset 3 -i input.mov -map 1:v -map 0:a -codec:a copy -codec:v copy output.mov
@@ -283,7 +331,7 @@ $ ffmpeg -i video.mp4 image%d.jpg
```
### 转换为 Gif
<!--rehype:wrap-class=col-span-2-->
<!--rehype:wrap-class=col-span-2 row-span-3-->
```bash
$ ffmpeg -ss 2 -t 28 -i input.mp4 -vf "fps=10,scale=1080:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif
@@ -308,8 +356,23 @@ $ ffmpeg -i input.mov -codec:v copy -an output.mov
```
<!--rehype:className=wrap-text -->
### 将输入文件转码为 DVD PAL 格式
```bash
$ ffmpeg -y -threads 8 -i inFile -target pal-dvd -ac 2 -aspect 16:9 -acodec mp2 -ab 224000 -vf pad=0:­0:0:0 outFile
```
<!--rehype:className=wrap-text -->
### 转换为灰度
```bash
$ ffmpeg -y -i inFile -flags gray outFile
```
### 字幕
<!--rehype:wrap-class=col-span-2-->
<!--rehype:wrap-class=col-span-2 row-span-2-->
将字幕写入视频
@@ -322,9 +385,24 @@ $ ffmpeg -i input.mov -filter:v 'subtitles=subtitles.srt' -codec:a copy output.m
```bash
$ ffmpeg -i input.mov -filter:v "subtitles=subtitles.srt:force_style='FontName=Menlo Bold,Fontsize=18'" -codec:a copy output.mov
```
<!--rehype:className=wrap-text -->
### 制造 1 分钟的音频噪音
```bash
$ ffmpeg -ar 48000 -t 60 -f s16le -acodec pcm_s16le -i /dev/u­random -ab 64K -f mp2 -acodec mp2 -y noise.mp2
```
<!--rehype:className=wrap-text -->
### 从视频中提取图像
```bash
$ ffmpeg -i foo.avi -r 1 -s WxH -f image2 outFil­e%0­3d.png
```
<!--rehype:className=wrap-text -->
### 音量
<!--rehype:wrap-class=col-span-2-->
<!--rehype:wrap-class=col-span-2 row-span-2-->
将音量减半
@@ -338,6 +416,84 @@ $ ffmpeg -i input.mov -codec:v copy -filter:a 'volume=0.5' output.mov
$ ffmpeg -i input.mov -codec:v copy -filter:a 'volume=2' output.mov
```
### 将图像文件转换为其他格式
```bash
$ ffmpeg -i foo012­2.png foo.tiff
```
pgm, ppm, pam, pgmyuv, jpeg, gif, png, tiff, sgi
### 将图像转换为 AVI 文件
```bash
$ ffmpeg -f image2 -i foo-%0­3d.jpeg -r 12 -s WxH foo.avi
```
<!--rehype:className=wrap-text -->
### 将 WAV 文件转换为 MP3
```bash
$ ffmpeg -i source­_so­ng.wav -vn -ar 44100 -ac 2 -ab 192 -f mp3 final_­son­g.mp3
```
<!--rehype:className=wrap-text -->
### 从视频中提取音频,将其转码为 MP3
```bash
$ ffmpeg -i source.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 sound.mp3
```
<!--rehype:className=wrap-text -->
### 将 .avi 转换为 .flv
```bash
$ ffmpeg -i source.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv output.flv
```
<!--rehype:className=wrap-text -->
### 将图片附加到 mp3
```bash
$ ffmpeg -i input.mp3 -i cover.png -c copy -metad­ata:s:v title=­"­Album cover" -metad­ata:s:v commen­t="Cover (Front­)" out.mp3
```
<!--rehype:className=wrap-text -->
### 将视频与声音文件混合
```bash
$ ffmpeg -i song.wav -i source­_vi­deo.avi outvid­eo.mpg
```
<!--rehype:className=wrap-text -->
### 编写带有 ID3v2.3 页眉和 ID3v1 页脚的 mp3
```bash
$ ffmpeg -i inFile -id3v2­_ve­rsion 3 -write­_id3v1 1 outFil­e.mp3
```
<!--rehype:className=wrap-text -->
### 连接输入文件
```bash
$ cat inFile1 inFile2 | ffmpeg -f mpeg -i - -vcodec copy -acodec copy outFil­e.mpg
```
<!--rehype:className=wrap-text -->
### 使用比特率和 mp3 音频的编解码器对剪辑进行编码
```bash
$ ffmpeg -i clip.avi -vcodec libxvid -b 800000 -acodec libmp3lame -ab 128 new-cl­ip.avi
```
<!--rehype:className=wrap-text -->
### 将音频流与来自不同文件的视频流合并
```bash
$ ffmpeg -i audioS.mp4 -i videoS.mp4 -c copy -map 0:a -map 1:v outFil­e.mp4
```
<!--rehype:className=wrap-text -->
另见
---
@@ -345,3 +501,4 @@ $ ffmpeg -i input.mov -codec:v copy -filter:a 'volume=2' output.mov
- [FFmpeg Cheat Sheet](https://lzone.de/cheat-sheet/ffmpeg) _(lzone.de)_
- [FFmpeg Cheat Sheet](https://devhints.io/ffmpeg) _(devhints.io)_
- [FFmpeg Cheat Sheet](https://github.com/yuanqing/ffmpeg-cheatsheet) _(github.com)_
- [FFmpeg Cheat Sheet](https://cheatography.com/thetartankilt/cheat-sheets/ffmpeg/) _(cheatography.com)_

129
docs/gmail.md Normal file
View File

@@ -0,0 +1,129 @@
Gmail 备忘清单
===
本备忘单总结了常用的 [Gmail](https://gmail.com/) 快捷键,以供快速参考。
Gmail 快捷键
---
### Gmail 导航
:- | :-
:- | :-
`u` | 返回话题列表(或刷新话题列表)
`k` / `j` | 较新/较旧的对话
`o` or `Enter` | 打开对话; 折叠/展开
`p` / `n` | 阅读上一条/下一条消息
<code>\`</code> | 转到下一个收件箱部分
`~` | 转到上一个收件箱部分
<!--rehype:className=shortcuts-->
### Gmail 应用程序
:- | :-
:- | :-
`c` | 撰写
`d` | 添加 cc 撰写
`b` | 添加 cc 和 bcc 撰写
`/` | 搜索
`q` | 焦点聊天联系人搜索
`?` | 打开快捷方式帮助
<!--rehype:className=shortcuts-->
### Gmail 操作
<!--rehype:wrap-class=row-span-3-->
:- | :-
:- | :-
`,` | 将焦点移至工具栏
`x` | 选择对话
`s` | 旋转超级巨星
`y` | 删除标签
`e` | 档案
`m` | 忽略对话
`!` | 报告为垃圾邮件
`v` | 打开移动到菜单
`#` | 移到废纸篓
`r` | 回复
`Shift+r` | 在新窗口中回复
`a` | 全部回复
`Shift+a` | 在新窗口中回复所有
`f` | 向前
`Shift+f` | 在新窗口中转发
`Shift+n` | 更新对话
`Tab` 然后 `Enter` | 发邮件
`Esc` | 焦点最后聊天痣
`]` / `[` | 删除并转到上一个/下一个
`}` / `{` | 存档并转到上一个/下一个
`z` | 撤消上一个操作
`.` | 打开更多操作菜单
`l` | 打开标签菜单
`Shift+i` | 标记为已读
`Shift+u` | 标记为未读
`_` | 将所选邮件标记为未读
`Ctrl+s` | 保存草稿
`+``=` | 标记为重要
`-` | 标记为不重要
`Shift+l` | 喜欢/不喜欢嗡嗡声
`h` | 抢先看
`g` 然后 `p` | 打个电话
`&` | 启动老蛇
`Shift+t` | 将对话添加到任务
<!--rehype:className=shortcuts-->
### Gmail 跳转
:- | :-
:- | :-
`g` 然后 `i` | 打开收件箱
`g` 然后 `s` | 打开已加星标的对话
`g` 然后 `t` | 打开已发送消息
`g` 然后 `d` | 打开草稿
`g` 然后 `a` | 打开所有消息
`g` 然后 `c` | 打开联系人
`g` 然后 `b` | 去嗡嗡声
`g` 然后 `l` | 转到标签
`g` 然后 `k` | 前往任务
<!--rehype:className=shortcuts-->
### Gmail 主题列表选择
:- | :-
:- | :-
`*` 然后 `a` | 选择所有对话
`*` 然后 `n` | 取消选择所有对话
`*` 然后 `r` | 选择阅读对话
`*` 然后 `u` | 选择未读对话
`*` 然后 `s` | 选择加星标的对话
`*` 然后 `t` | 选择未加星标的对话
<!--rehype:className=shortcuts-->
### Gmail 搜索语法
:- | :-
:- | :-
`from:[arg]` | 从
`to:[arg]` | 至
`label:­[arg]` | 标签
`subjec­t:[arg]` | 主题
`-[arg]` | 不包含
`has:at­tac­hment` | 有附件
`filena­me:­[fi­lename]` | 附件文件名
`before­:20­11/­11/20` | 之前(日期)
`after:­201­1/11/20` | 之后(日期)
`from:annie``from:david` | 或运算符
`list:[arg]` | 邮件列表
`subjec­t:(­word1 word2)` | 组词
`in:any­where` | 在所有框中搜索(垃圾邮件和垃圾邮件除外)
`in:trash in:inbox in:spam` | 在特定框中搜索
`is:starred is:read is:unread` | 搜索特定消息
`is:chat` | 在聊天中搜索
`cc:[arg] bcc:[arg]` | 搜索副本收件人
<!--rehype:className=shortcuts-->
### Gmail 提示和技巧
-`u` 刷新话题列表
- 对于多选,选择一个对话,然后 `shift+单击`另一个对话以选择其间的所有对话
- 在主题中添加 `EOM`(消息结尾)以避免 `no-text-in-body` 警告

1409
docs/matlab.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -192,7 +192,7 @@ $ cat video.avi | nc -l 8000
客户端 Client
```shell {.wrap}
```shell
$ nc 192.168.1.9 8000 | mplayer -vo x11 -cache 3000 -
```

View File

@@ -1,7 +1,7 @@
NGINX 备忘清单
===
这个 nginx 快速参考备忘单显示了它的常用命和配置使用清单。
这个 [nginx](https://nginx.org/en/) 快速参考备忘单显示了它的常用命和配置使用清单。
入门
----

View File

@@ -1,7 +1,7 @@
npm 备忘清单
===
这个 npm 快速参考备忘单显示了它的常用命令使用清单
这个 [npm](https://www.npmjs.com/) 快速参考备忘单显示了它的常用命令使用清单
常用命令
----
@@ -67,112 +67,94 @@ npm 备忘清单
### 缓存 cache
```bash
npm cache add <package-spec> # 将指定的包添加到本地缓存
npm cache clean [<key>] # 删除缓存文件夹中的所有数据
npm cache ls [<name>@<version>]
npm cache verify # 验证缓存文件夹的内容,垃圾收集任何不需要的数据,
$ npm cache add <package-spec> # 将指定的包添加到本地缓存
$ npm cache clean [<key>] # 删除缓存文件夹中的所有数据
$ npm cache ls [<name>@<version>]
$ npm cache verify # 验证缓存文件夹的内容,垃圾收集任何不需要的数据,
# 并验证缓存索引和所有缓存数据的完整性
```
用于添加、列出或清理 npm 缓存文件夹
用于添加、列出或清理 [npm](https://www.npmjs.com/) 缓存文件夹
### 更新
| 命令 | 描述 |
| --- | --- |
| `npm version <version>` | 要更改 `package.json` 中的版本号 |
| `npm update` | 更新生产包 |
| `npm update --dev` | 更新开发包 |
| `npm update -g` | 更新全局包 |
| `npm update lodash` | 更新 `lodash` |
命令 | 描述
:- | -
`npm version <version>` | 要更改 `package.json` 中的版本号
`npm update` | 更新生产包
`npm update --dev` | 更新开发包
`npm update -g` | 更新全局包
`npm update lodash` | 更新 `lodash`
### 杂项功能
<!--rehype:wrap-class=row-span-2-->
将某人添加为所有者
```bash
npm owner add USERNAME PACKAGENAME
```
列出包
```bash
npm ls
```
向安装旧版本软件包的用户添加警告(弃用)
```bash
npm deprecate PACKAGE@"< 0.2.0" "critical bug fixed in v0.2.0"
```
更新所有包或选定的包
```bash
npm update [-g] PACKAGE
```
检查过时的包
```bash
npm outdated [PACKAGE]
```
### 更改包裹可见性
将公共包设为私有
```bash
npm access restricted <package-name>
```
公开私有包
```bash
npm access public <package-name>
```
授予私有包访问权限
```bash
npm owner add <user> <your-package-name>
```
### 要将包转移到 npm 用户帐户
```bash
npm owner add <their-username> <package-name>
# 新维护者接受邀请
npm owner rm <your-username> <package-name>
```
写入启用了双因素身份验证
```bash
npm owner add <their-username> <package-name> --otp=123456
# 将某人添加为所有者
$ npm owner add USERNAME PACKAGENAME
# 列出包
$ npm ls
# 向安装旧版本软件包的用户添加警告(弃用)
$ npm deprecate PACKAGE@"< 0.2.0" "critical bug fixed in v0.2.0"
# 更新所有包或选定的包
$ npm update [-g] PACKAGE
# 检查过时的包
$ npm outdated [PACKAGE]
```
### 取消发布包
```bash
npm unpublish <package-name> -f
$ npm unpublish <package-name> -f
# 取消指定版本
npm unpublish <package-name>@<version>
$ npm unpublish <package-name>@<version>
```
注意:如果您取消发布整个包,则必须在 24 小时后才能发布该包的任何新版本
注意:如果您取消发布整个包,则必须在 24 小时后才能发布该包的任何新版本
### 更改包裹可见性
```bash
# 将公共包设为私有
$ npm access restricted <package-name>
# 公开私有包
$ npm access public <package-name>
# 授予私有包访问权限
$ npm owner add <user> <your-package-name>
```
### 要将包转移到 npm 用户帐户
```bash
# 新维护者接受邀请
$ npm owner add <their-username> <package-name>
# 删除维护者
$ npm owner rm <your-username> <package-name>
# 写入启用了双因素身份验证
$ npm owner add <their-username> <package-name> --otp=123456
```
### 发布包 npmjs.org
```bash
npm publish
$ npm publish
# 第一次需要指定公开参数
npm publish --access public
$ npm publish --access public
```
发布公开包,到 npmjs.org
发布公开包,到 [npmjs.org](https://docs.npmjs.com)
### 使用 nrm 切换 registry
```bash
$ npm install -g nrm # 安装 nrm 包
# 查看 registry 列表
$ nrm ls
# 将注册表切换到 cnpm
$ nrm use cnpm
```
配置
---
@@ -188,15 +170,27 @@ npm publish --access public
### 配置内容
<!--rehype:wrap-class=col-span-2-->
```ini
# last modified: 01 Jan 2016
; Set a new registry for a scoped package
@myscope:registry=https://registry.npmmirror.com
```
<!--rehype:className=wrap-text -->
注释使用 `#`, `;` 放置到一行的开头`.npmrc` 文件由指定此注释语法的 [`npm/ini`](https://github.com/npm/ini) 解析
注释使用 `#`, `;` 放置到一行的开头 [`.npmrc`](https://docs.npmjs.com/cli/v8/configuring-npm/npmrc) 文件由指定此注释语法的 [`npm/ini`](https://github.com/npm/ini) 解析
### registry
:- | :-
:- | :-
`npm` | https://registry.npmjs.org/
`yarn` | https://registry.yarnpkg.com/
`tencent` | https://mirrors.cloud.tencent.com/npm/
`cnpm` | https://r.cnpmjs.org/
`taobao` | https://registry.npmmirror.com/
`npmMirror` | https://skimdb.npmjs.com/registry/
### `.npmignore`
@@ -223,7 +217,7 @@ npm publish --access public
$ npm install -g <package-name> --registry=https://registry.npmmirror.com
```
将配置放置在 `.npmrc` 全局配置文件中,或者在项目的根目录中。
将配置放置在 [`.npmrc`](https://docs.npmjs.com/cli/v8/configuring-npm/npmrc) 全局配置文件中,或者在项目的根目录中。
```ini
; registry=https://registry.npmjs.org/
@@ -241,7 +235,7 @@ registry=https://registry.npmmirror.com
替换 npm 仓库地址为 npmmirror(淘宝) 镜像地址
```bash
npm config set registry https://registry.npmmirror.com
$ npm config set registry https://registry.npmmirror.com
```
请参阅:[npmmirror 中国镜像站](https://npmmirror.com/)

View File

@@ -29,7 +29,7 @@ HTML 存放在仓库根目录下的 `dist` 目录中,将 `dist/index.html` 静
### 介绍
在备忘清单采用 `HTML 注释语法`,标识网站布局和一些样式,目的是为了在 `GitHub` 中也是正常毫无瑕疵的预览 `Markdown`
在备忘清单采用 `HTML 注释语法`,标识网站布局和一些样式,目的是为了在 `GitHub` 中也是正常毫无瑕疵的预览 [`Markdown`](./markdown.md)
```markdown
### 卡片标题
@@ -45,7 +45,7 @@ HTML 存放在仓库根目录下的 `dist` 目录中,将 `dist/index.html` 静
### 注释语法介绍
<!--rehype:wrap-class=row-span-3&style=color:black;background-color: #d7a100;-->
- 在某个 Markdown 语法下方或者后面,添加 HTML注释
- 在某个 [`Markdown`](./markdown.md) 语法下方或者后面,添加 HTML注释
-`<!--rehype:` 开始,`-->` 结束,包裹参数内容
- 内容采用 URL 参数的字符拼接方式
@@ -78,7 +78,7 @@ HTML 存放在仓库根目录下的 `dist` 目录中,将 `dist/index.html` 静
---- | ----
`body-style` | 包裹所有卡片`外壳`的样式
`body-class` | 用于卡片栏布局,添加`类`
`wrap-style` | 卡片栏添加 CSS 样式
`wrap-style` | 卡片栏添加 [CSS](./css.md) 样式
`wrap-class` | 用于卡片占位,添加`类`
### 文字颜色
@@ -135,7 +135,7 @@ export const Student = (
);
```
上面 `{1,4-5}` 行代码高亮,下面是 `Markdown` 代码示例
上面 `{1,4-5}` 行代码高亮,下面是 [`Markdown`](./markdown.md) 代码示例
```markdown
```jsx {1,4-5}
@@ -214,6 +214,22 @@ const school = <div>学校</div>;
`<del>``~~删除~~` | <del>~~红色~~</del>
<!--rehype:className=shortcuts-->
### 注释类配置
<!--rehype:wrap-class=col-span-2 row-span-2-->
类 | 说明
---- | ----
`<!--rehype:className=wrap-text-->` | 强制换行
`<!--rehype:className=show-header-->` | 展示表格表头
`<!--rehype:className=shortcuts-->` | 快捷键样式
`<!--rehype:className=auto-wrap-->` | 隐藏表头强制小尺寸自动换行
`<!--rehype:className=style-list-arrow-->` | 列表箭头样式展示表格
`<!--rehype:className=style-list-->` | 列表样式展示表格
`<!--rehype:className=left-align-->` | 表格末尾列左对齐
`<!--rehype:className=style-none-->` | \<li> 没有标记
`<!--rehype:className=style-timeline-->` | 时间轴样式
`<!--rehype:className=style-arrow-->` | 箭头标记
### 隐藏卡片标题
<!--rehype:style=display:none;&wrap-style=padding-top: 0;-->
@@ -242,8 +258,24 @@ const school = <div>学校</div>;
<b>这里是你的 HTML 代码</b>
```
上面的 `markdown` 代码在 `meta` 位置添加 `preview` 标识HTML 代码将被执行预览
上面的 [`markdown`](./markdown.md) 代码在 `meta` 位置添加 `preview` 标识,[HTML](./html.md) 代码将被执行预览
### KaTeX 数学渲染
```KaTeX
c = \pm\sqrt{a^2 + b^2}
L = \frac{1}{2} \rho v^2 S C_L
```
上面示例 [`Markdown`](./markdown.md) 代码源码
```markdown {1}
```KaTeX
c = \pm\sqrt{a^2 + b^2}
L = \frac{1}{2} \rho v^2 S C_L
```
还可以单行展示 `KaTeX:c = \pm\sqrt{a^2 + b^2}`,需要标记 <code>\`KaTeX:数学公式\`</code> 将被显示成数学公式,这是基于 [KaTeX](https://katex.org/) 生成
布局
---
@@ -336,7 +368,7 @@ H2 部分
╰┈┈┈╯ ╰┈┈┈╯ ╰┈┈┈╯
```
上面布局效果 Markdown 源码:
上面布局效果 [Markdown](./markdown.md) 源码:
```markdown
### H3 Title 1
@@ -361,7 +393,7 @@ H2 部分
╰┈┈┈╯ ╰┈┈┈╯ ╰┈┈┈╯
```
上面布局效果 Markdown 源码:
上面布局效果 [Markdown](./markdown.md) 源码:
```markdown
### Title 1
@@ -409,7 +441,7 @@ H2 部分
╰┈┈┈╯ ╰┈┈┈╯ ╰┈┈┈╯
```
上面布局效果 Markdown 源码:
上面布局效果 [Markdown](./markdown.md) 源码:
```markdown
### Title 1
@@ -433,7 +465,7 @@ H2 部分
╰┈┈┈╯ ╰┈┈┈┈┈┈┈┈┈╯
```
上面布局效果 Markdown 源码:
上面布局效果 [Markdown](./markdown.md) 源码:
```markdown
### Title 1
@@ -457,7 +489,7 @@ H2 部分
╰┈┈┈╯ ╰┈┈┈╯ ╰┈┈┈╯
```
上面布局效果 Markdown 源码:
上面布局效果 [Markdown](./markdown.md) 源码:
```markdown
### Title 1
@@ -481,7 +513,7 @@ H2 部分
╰┈┈┈┈┈┈┈┈┈╯ ╰┈┈┈╯
```
上面布局效果 Markdown 源码:
上面布局效果 [Markdown](./markdown.md) 源码:
```markdown
### Title 1
@@ -505,7 +537,7 @@ H2 部分
╰┈┈┈╯ ╰┈┈┈╯ ╰┈┈┈╯ ╰┈┈┈╯
```
上面布局效果 Markdown 源码:
上面布局效果 [Markdown](./markdown.md) 源码:
```markdown
H2 部分
@@ -536,7 +568,7 @@ H2 部分
╰┈┈┈╯ ╰┈┈┈╯ ╰┈┈┈╯
```
上面布局效果 Markdown 源码:
上面布局效果 [Markdown](./markdown.md) 源码:
```markdown
### Title 1

View File

@@ -855,7 +855,7 @@ console.log(array[1]);
### replace()
```javascript {.wrap}
```javascript
let text = 'Do you like aPPles?';
let regex = /apples/i
@@ -1091,7 +1091,7 @@ MySQL中的正则表达式
### REGEXP
```sql {.wrap}
```sql
expr REGEXP pat
```
@@ -1164,7 +1164,7 @@ mysql> SELECT regexp_like('a\nb\nc', '^b$', 'm');
### REGEXP_INSTR
``` {.wrap}
```
REGEXP_INSTR(expr, pat[, pos[, occurrence[, return_option[, match_type]]]])
```

807
docs/rust.md Normal file
View File

@@ -0,0 +1,807 @@
Rust 备忘清单
====
Rust 快速参考备忘单,旨在为编写基本语法和方法提供帮助。
入门
---
### Hello_World.rs
```rust
fn main() {
println!("Hello, World!");
}
```
#### 编译运行
```shell
$ rustc Hello_World.rs
$ ./Hello_World
Hello, World!
```
### 原始类型
:-| :-
:-| :-
`bool` | 布尔值 (`true` _/_ `false`)
`char` | 字符
`f32`, `f64` | 32 位、64 位浮点数
`i64`, `i32`, `i16`, `i8` | 有符号 16- ... 整数
`u64`, `u32`, `u16`, `u8` | 无符号 16 位,... 整数
`isize` | 指针大小的有符号整数
`usize` | 指针大小的无符号整数
查看: [Rust 类型](#rust-类型)
### 格式化
<!--rehype:wrap-class=row-span-2-->
```rust
// 单个占位符
println!("{}", 1);
// 多个占位符
println!("{} {}", 1, 3);
// 位置参数
println!("{0}{1} {2}{0} 也是 {3} 编程语言", "Rust", "cool", "language", "safe");
// 命名参数
println!("{country} 是一个团结的国家", country = "China");
// 占位符特征 :b 表示二进制, :0x 表示十六进制, :o 表示八进制
println!("让我们打印 76 是二进制的 {:b} ,十六进制等价物是 {:0x} 八进制等价物是 {:o}", 76, 76, 76);
// 调试特征
println!("使用调试特征 {:?} 在此处打印我们想要的任何内容", (76, 'A', 90));
// 1.58 中的新格式字符串
let x = "world";
println!("Hello {x}!");
```
<!--rehype:className=wrap-text -->
### 打印风格
```rust
// 打印输出
print!("Hello World\n");
// 打印后追加新行
println!("追加新行");
// 打印为错误
eprint!("这是一个错误\n");
// 打印为新行错误
eprintln!("这是新行的错误");
```
### 变量
```rust
// 初始化和声明变量
let some_variable = "This_is_a_variable";
// 使变量可变
let mut mutable_variable = "Mutable";
// 分配多个变量
let (name, age) = ("ElementalX", 20);
// (全局)常量
const SCREAMING_SNAKE_CASE:i64 = 9;
```
### 注释
```rust
// 行注释
/*.............块注释 */
/// 外部文档注释
//! 内部文档评论
```
另见: [注释](https://doc.rust-lang.org/reference/comments.html) _(doc.rust-lang.org)_
### 函数
```rust
fn test(){
println!("这是一个函数!");
}
fn main(){
test();
}
```
查看: [Functions](#rust-函数)
### 声明宏
```rust
macro_rules! foo {
($l:tt) => { bar!($l); }
}
macro_rules! bar {
(3) => {}
}
foo!(3);
```
### 元变量
<!--rehype:wrap-class=row-span-2-->
:- | :-
:- | :-
`item` | 程序项
`block` | 块表达式
`stmt` | 语句<br/> _(注意此选择器不匹配句尾的分号)_
`pat` | 模式
`expr` | 表达式
`ty` | 类型
`ident` | 标识符或关键字
`path` | 类型表达式 形式的路径
`tt` | `token`<br/> _(单个 `token` 或宏匹配定界符 `()`、`[]` 或 `{}` 中的标记)_
`meta` | 属性,属性中的内容
`lifetime` | 生存期 `token`
`vis` | 可能为空的可见性限定符
`literal` | 匹配 `-?` 字面量表达式
### 结构体
```rust
struct Point { x: i32, y: i32 }
let p = Point { x: 10, y: 11 };
let px: i32 = p.x;
```
结构体是一个使用关键字 `struct` 定义的标称型(nominal)结构体类型
### 枚举
```rust
enum Foo {
Bar, // 0
Baz = 123, // 123
Quux, // 124
}
let baz_discriminant = Foo::Baz as u32;
assert_eq!(baz_discriminant, 123);
```
Rust 类型
--------
### 类型别名
```rust
type Point = (u8, u8);
let p: Point = (41, 68);
```
### 整数
```rust
let mut a: u32 = 8;
let b: u64 = 877;
let c: i64 = 8999;
let d = -90;
```
### 浮点数
```rust
let mut sixty_bit_float: f64 = 89.90;
let thirty_two_bit_float: f32 = 7.90;
let just_a_float = 69.69;
```
### 布尔值
```rust
let true_val: bool = true;
let false_val: bool = false;
let just_a_bool = true;
let is_true = 8 < 5; // => false
```
### 字符
```rust
let first_letter_of_alphabet = 'a';
let explicit_char: char = 'F';
let implicit_char = '8';
let emoji = "\u{1f600}"; // => 😀
```
### 字符串字面量
```rust
let community_name = "AXIAL";
let no_of_members: &str = "ten";
println!("社区的名称是 {community_name},它有 {no_of_members} 个成员");
```
<!--rehype:className=wrap-text -->
查看: [字符串](#rust-字符串)
### 数组
```rust
┌─────┬─────┬─────┬─────┬─────┬─────┐
| 92 | 97 | 98 | 99 | 98 | 94 |
└─────┴─────┴─────┴─────┴─────┴─────┘
0 1 2 3 4 5
```
----
```rust
let array: [i64; 6] = [92,97,98,99,98,94];
```
### 多维数组
<!--rehype:wrap-class=row-span-2-->
```rust
j0 j1 j2 j3 j4 j5
┌────┬────┬────┬────┬────┬────┐
i0 | 1 | 2 | 3 | 4 | 5 | 6 |
├────┼────┼────┼────┼────┼────┤
i1 | 6 | 5 | 4 | 3 | 2 | 1 |
└────┴────┴────┴────┴────┴────┘
```
----
```rust
let array: [[i64; 6] ;2] = [
[1,2,3,4,5,6],
[6,5,4,3,2,1]];
```
### 可变数组
```rust
let mut array: [i32 ; 3] = [2,6,10];
array[1] = 4;
array[2] = 6;
```
使用 `mut` 关键字使其可变
### 切片
```rust
let mut array: [ i64; 4] = [1,2,3,4];
// 下限包括在内,上限不包括在内
let mut slices: &[i64] = &array[0..3]
println!("切片的元素是:{slices:?}");
```
### 向量
```rust
let some_vector = vec![1,2,3,4,5];
```
使用 `vec!` 宏声明向量
### 元组
```rust
let tuple = (1, 'A' , "Cool", 78, true);
```
Rust 字符串
--------------
### 字符串字面量
```rust
let cs:&str = "备忘清单";
// => 为开发者分享备忘单
println!("为开发者分享 {cs}");
```
### 字符串对象
```rust
// 创建一个空字符串对象
let my_string = String::new;
// 转换为字符串对象
let S_string = a_string.to_string()
// 创建一个初始化的字符串对象
let lang = String::from("Rust");
println!("First language is {lang}");
```
### .capacity()
```rust
let rand = String::from("Random String");
rand.capacity() // => 13
```
以字节为单位计算字符串的容量
### .contains()
```rust
let name = String::from("ElementalX");
name.contains("Element") // => true
```
检查子字符串是否包含在原始字符串中
### 添加单个字符
```rust
let mut half_text = String::from("Hal");
half_text.push('f'); // => Half
```
### 添加整个字符串
```rust
let mut hi = String::from("Hey there...");
hi.push_str("How are you doing??");
// => Hey there...How are you doing??
println!("{hi}");
```
Rust 运算符
-----------
### 比较运算符
:-|:-
:-|:-
`e == f` | `e` 等于 `f`
`e != f` | `e` 不等于 `f`
`e < f` | `e` 小于 `f`
`e > f` | `e` 大于 `f`
`e <= f` | `e` 小于或等于 `f`
`e >= f` | `e` 大于或等于 `f`
---------
```rust
let (e, f) = (1, 100);
let greater = f > e; // => true
let less = f < e; // => false
let greater_equal = f >= e; // => true
let less_equal = e <= f; // => true
let equal_to = e == f; // => false
let not_equal_to = e != f; // => true
```
### 算术运算符
:-|:-
:-|:-
`a + b` | `a` 被添加到 `b`
`a - b` | 从 `a` 中减去`b`
`a / b` | `a` 除以 `b`
`a % b` | 通过与 `b` 相除得到 `a` 的余数
`a * b` | `a``b` 相乘
------
```rust
let (a, b) = (4, 5);
let sum: i32 = a + b; // => 9
let subtractions: i32 = a - b; // => -1
let multiplication: i32 = a * b; // => 20
let division: i32 = a / b; // => 0
let modulus: i32 = a % b; // => 4
```
### 位运算符
运算符 | 描述
:- | :-
`g & h` | 二进制与
`g | h` | 二进制或
`g ^ h` | 二进制异或
`g ~ h` | 二进制补码
`g << h` | 二进制左移
`g >> h` | 二进制右移
-----
```rust
let (g, h) = (0x1, 0x2);
let bitwise_and = g & h; // => 0
let bitwise_or = g | h; // => 3
let bitwise_xor = g ^ h; // => 3
let right_shift = g >> 2; // => 0
let left_shift = h << 4; // => 32
```
### 逻辑运算符
示例 | 意义
:- | :-
`c && d` | 两者都是真的_(AND)_
`c || d` | 要么是真的_(OR)_
`!c` | `c` 为假 _(NOT)_
------
```rust
let (c, d) = (true, false);
let and = c && d; // => false
let or = c || d; // => true
let not = !c; // => false
```
### 复合赋值运算符
```rust
let mut k = 9;
let mut l = k;
```
----
运算符 | 描述
:- | :-
`k += l` | 添加一个值并赋值,然后 `k=9`
`k -= l` | `Substrate` 一个值并赋值,然后 `k=18`
`k /= l` | 除以一个值并赋值,然后 `k=9`
`k *= l` | 乘一个值并赋值,然后 `k=81`
`k \|= l` | 按位或并赋值,则 `k=89`
Rust 流程控制
------------
### If表达式
```rust
let case1: i32 = 81;
let case2: i32 = 82;
if case1 < case2 {
println!("case1 大于 case2");
}
```
### If...Else 表达式
```rust
let case3 = 8;
let case4 = 9;
if case3 >= case4 {
println!("case3 优于 case4");
} else {
println!("case4 大于 case3");
}
```
### If...Else...if...Else 表达式
```rust
let foo = 12;
let bar = 13;
if foo == bar {
println!("foo 等于 bar");
} else if foo < bar {
println!("foo 小于 bar");
} else if foo != bar {
println!("foo 不等于 bar");
} else {
println!("Nothing");
}
```
### If...let 表达式
<!--rehype:wrap-class=row-span-3-->
```rust
let mut arr1:[i64 ; 3] = [1,2,3];
if let[1,2,_] = arr1{
println!("与数组一起使用");
}
let mut arr2:[&str; 2] = ["one", "two"];
if let["Apple", _] = arr2{
println!("也适用于 str 数组");
}
```
----
```rust
let tuple_1 = ("India", 7, 90, 90.432);
if let(_, 7, 9, 78.99) = tuple_1{
println!("也适用于元组");
}
let tuple_2 = ( 9, 7, 89, 12, "Okay");
if let(9, 7,89, 12, blank) = tuple_2 {
println!("一切{blank}伴侣?");
}
let tuple_3 = (89, 90, "Yes");
if let(9, 89, "Yes") = tuple_3{
println!("模式确实匹配");
}
else {
println!("模式不匹配");
}
```
### 匹配表达式
<!--rehype:wrap-class=row-span-3-->
```rust
let day_of_week = 2;
match day_of_week {
1 => {
println!("兄弟们今天是星期一");
},
2 => {
println!("兄弟们今天是星期二");
},
3 => {
println!("兄弟们今天是星期三");
},
4 => {
println!("兄弟们今天是星期四");
},
5 => {
println!("兄弟们今天是星期五");
},
6 => {
println!("兄弟们今天是星期六");
},
7 => {
println!("兄弟们今天是星期天");
},
_ => {
println!("默认!")
}
};
}
```
### 嵌套...If 表达式
```rust
let nested_conditions = 89;
if nested_conditions == 89 {
let just_a_value = 98;
if just_a_value >= 97 {
println!("大于 97");
}
}
```
### For 循环
```rust
for mut i in 0..15 {
i-=1;
println!("i 的值为:{i}");
}
```
### While 循环
```rust
let mut check = 0;
while check < 11{
println!("check 是:{check}");
check+=1;
println!("递增后:{check}");
if check == 10{
break; // 停止 while
}
}
```
### Loop 关键字
```rust
loop {
println!("你好,世界永远!");
}
```
无限循环表示
### Break 中断语句
```rust
let mut i = 1;
loop {
println!("i 是 {i}");
if i > 100 {
break;
}
i *= 2;
}
```
### Continue 继续声明
```rust
for (v, c) in (0..10+1).enumerate(){
println!("{c} 数字循环");
if v == 9{
println!("我们继续?");
continue;
}
println!{"v 的值为:{v}"};
}
```
Rust 函数
--------
### 基本函数
```rust
fn print_message(){
println!("Hello, Quick Reference!");
}
fn main(){
// 在 Rust 中调用函数
print_message();
}
```
### 按值传递
```rust
fn main()
{
let x:u32 = 10;
let y:u32 = 20;
// => 200
println!("计算: {}", cal_rect(x, y));
}
fn cal_rect(x:u32, y:u32) -> u32
{
x * y
}
```
### 通过引用传递
```rust
fn main(){
let mut by_ref = 3; // => 3
power_of_three(&mut by_ref);
println!("{by_ref}"); // => 9
}
fn power_of_three(by_ref: &mut i32){
// 取消引用很重要
*by_ref = *by_ref * *by_ref;
println!("{by_ref}"); // => 9
}
```
### 返回
```rust
fn main(){
let (mut radius, mut pi) = (3.0, 3.14);
let(area, _perimeter) = calculate (
&mut radius,
&mut pi
);
println!("圆的面积和周长为:{area} & {_perimeter}");
}
fn calculate(radius : &mut f64, pi: &mut f64) -> (f64, f64){
let perimeter = 2.0 * *pi * *radius;
let area = *pi * *radius * *radius;
return (area, perimeter);
}
```
<!--rehype:className=wrap-text -->
### 数组作为参数
```rust
fn main(){
let mut array: [i32 ; 5] = [1,2,3,4,6];
print_arrays(array);
println!("元素:{array:?}");
}
fn print_arrays(mut array:[i32; 5]) {
array[0] = 89;
array[1] = 90;
array[2] = 91;
array[3] = 92;
array[4] = 93;
println!("元素:{array:?}");
}
```
### 返回数组
```rust
fn main(){
let mut arr:[i32; 5] = [2,4,6,8,10];
multiply(arr);
println!("数组是:{:?}", multiply(arr));
}
fn multiply (mut arr: [i32 ; 5]) -> [i32 ; 5]{
arr[2] = 90;
for mut i in 0..5 {
arr[i] = arr[i] * arr[2];
}
return arr;
}
```
<!--rehype:className=wrap-text -->
### 泛型函数
```rust
use std::fmt::Debug;
fn foo<T>(x: &[T]) where T: Debug {
// 省略细节
}
foo(&[1, 2]);
```
杂项
-----
### 类型断言 type-casting
```rust
let a_int = 90; // int
// int 到 float
let mut type_cast = (a_int as f64);
```
------
```rust
let orginal: char = 'I';
// char 到 int => 73
let type_casted: i64 = orginal as i64;
```
要在 `Rust` 中执行类型转换,必须使用 `as` 关键字
### 借用
```rust
let mut foo = 4;
let mut borrowed_foo = &foo;
println!("{borrowed_foo}");
```
------
```rust
let mut bar = 3;
let mut mutable_borrowed_bar = &mut bar;
println!("{mutable_borrowed_bar}");
```
这里借用的值使用 `&` 运算符从值一中借用值
### 取消引用
```rust
let mut borrow = 10;
let deref = &mut borrow;
println!("{}", *deref);
```
可以使用 `*` 操作符在 rust 中取消引用
### 变量范围
```rust
{
// 范围仅限于此大括号
let a_number = 1;
}
println!("{a_number}");
```
这将产生错误,因为变量 `a_number` 的范围在大括号处结束
另见
--------
- [Cargo 备忘清单](./cargo.md) _(jaywcjlove.github.io)_
- [The Rust Document](https://doc.rust-lang.org/book/ch00-00-introduction.html) _(doc.rust-lang.org)_
- [The Rust Reference](https://doc.rust-lang.org/reference/introduction.html) _(doc.rust-lang.org)_
- [Rust Cheatsheet](https://phaiax.github.io/rust-cheatsheet/) _(phaiax.github.io)_
- [Rust 标准库文档中文版](https://jaywcjlove.github.io/rust-cn-document-for-docker/std/std/) _(jaywcjlove.github.io)_
- [Rust 程序设计语言 中文版](https://jaywcjlove.github.io/rust-cn-document-for-docker/book/) _(jaywcjlove.github.io)_
- [Rust By Example 中文版](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-by-example-cn/) _(jaywcjlove.github.io)_
- [Rust 参考手册中文版](https://jaywcjlove.github.io/rust-cn-document-for-docker/reference/) _(jaywcjlove.github.io)_
- [RustDoc 手册中文版](https://jaywcjlove.github.io/rust-cn-document-for-docker/rustdoc/) _(jaywcjlove.github.io)_
- [Rust Cookbook 中文版](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-cookbook/) _(jaywcjlove.github.io)_

View File

@@ -71,26 +71,26 @@ Sed 命令
### 命令
<!--rehype:wrap-class=col-span-2-->
| Command | Example | Description |
|---------|----------------------------------------|-----------------------------|
| `p` | sed -n '1,4 p' input.txt | Print lines 1-4 |
| `p` | sed -n -e '1,4 p' -e '6,7 p' input.txt | Print lines 1-4 and 6-7 |
| `d` | sed '1,4 d' input.txt | Print lines except 1-4 |
| `w` | sed -n '1,4 w output.txt' input.txt | Write pattern space to file |
| `a` | sed '2 a new-line' input.txt | Append line after |
| `i` | sed '2 i new-line' input.txt | Insert line before |
命令 | 示例 | 描述
:- | :- |:-
`p` | sed -n '1,4 p' input.txt | 打印第 1-4 行
`p` | sed -n -e '1,4 p' -e '6,7 p' input.txt | 打印第 1-4 行和第 6-7
`d` | sed '1,4 d' input.txt | 打印除 1-4 之外的行
`w` | sed -n '1,4 w output.txt' input.txt | 将模式空间写入文件
`a` | sed '2 a new-line' input.txt | 在后面追加一行
`i` | sed '2 i new-line' input.txt | 在前面插入行
<!--rehype:className=show-header-->
### 空间命令
| Command | Description |
|---------|--------------------------------------------------------------|
| `n` | 打印模式空间,空模式空间,读取下一行 |
| `x` | 用保持空间交换模式空间 |
| `h` | 复制模式空间以保持空间 |
| `H` | 追加模式空间以保持空间 |
| `g` | 将保持空间复制到模式空间 |
| `G` | 将保持空间附加到模式空间 |
命令 | 描述
:- | :-
`n` | 打印模式空间,空模式空间,读取下一行
`x` | 用保持空间交换模式空间
`h` | 复制模式空间以保持空间
`H` | 追加模式空间以保持空间
`g` | 将保持空间复制到模式空间
`G` | 将保持空间附加到模式空间
### Flags

View File

@@ -11,8 +11,9 @@ Vue 3 备忘清单
Vue 是一套用于构建用户界面的渐进式框架
- [Vue 3.x 官方文档](https://cn.vuejs.org/)
- [Vue Router 4.x 官方文档](https://router.vuejs.org/zh/)
- [Vue 3.x 官方文档](https://cn.vuejs.org/) _(cn.vuejs.org)_
- [Vue Router 4.x 官方文档](https://router.vuejs.org/zh/) _(router.vuejs.org)_
- [Vue 2 备忘清单](./vue2.md)
<!--rehype:className=style-round-->
注意Vue 3.x 版本对应 Vue Router 4.x 路由版本
@@ -269,3 +270,375 @@ v-on:submit.prevent="onSubmit"
┆ ╰─ Argument 跟随冒号或速记符号
╰─ Name 以 v- 开头使用速记时可以省略
```
响应式基础
---
### 声明状态
```html
<div>{{ count }}</div>
```
---
```js {2,4}
export default {
data() {
return {
count: 0
}
},
}
```
### 声明方法
```html
<button @click="increment">
{{ count }}
</button>
```
---
```js {8-10}
export default {
data() {
return {
count: 0
}
},
methods: {
increment() {
this.count++
}
}
}
```
### 有状态方法
```js
import { debounce } from 'lodash-es'
export default {
created() {
// 每个实例都有了自己的预置防抖的处理函数
this.debouncedClick = debounce(this.click, 500)
},
unmounted() {
// 最好是在组件卸载时
// 清除掉防抖计时器
this.debouncedClick.cancel()
},
methods: {
click() {
// ... 对点击的响应 ...
}
}
}
```
<!--rehype:className=wrap-text -->
API 参考
---
### 全局 API - 应用实例
<!--rehype:wrap-class=row-span-3-->
:- | :-
:- | :-
`createApp()` | [#](https://cn.vuejs.org/api/application.html#create-app)
`createSSRApp()` | [#](https://cn.vuejs.org/api/application.html#create-ssr-app)
`app.mount()` | [#](https://cn.vuejs.org/api/application.html#app-mount)
`app.unmount()` | [#](https://cn.vuejs.org/api/application.html#app-unmount)
`app.provide()` | [#](https://cn.vuejs.org/api/application.html#app-provide)
`app.component()` | [#](https://cn.vuejs.org/api/application.html#app-component)
`app.directive()` | [#](https://cn.vuejs.org/api/application.html#app-directive)
`app.use()` | [#](https://cn.vuejs.org/api/application.html#app-use)
`app.mixin()` | [#](https://cn.vuejs.org/api/application.html#app-mixin)
`app.version` | [#](https://cn.vuejs.org/api/application.html#app-version)
`app.config` | [#](https://cn.vuejs.org/api/application.html#app-config)
`app.config.errorHandler` | [#](https://cn.vuejs.org/api/application.html#app-config-errorhandler)
`app.config.warnHandler` | [#](https://cn.vuejs.org/api/application.html#app-config-warnhandler)
`app.config.performance` | [#](https://cn.vuejs.org/api/application.html#app-config-performance)
`app.config.compilerOptions` | [#](https://cn.vuejs.org/api/application.html#app-config-compileroptions)
`app.config.globalProperties` | [#](https://cn.vuejs.org/api/application.html#app-config-globalproperties)
`app.config.optionMergeStrategies` | [#](https://cn.vuejs.org/api/application.html#app-config-optionmergestrategies)
### 全局 API - 通用
:- | :-
:- | :-
`version` | [#](https://cn.vuejs.org/api/general.html#version)
`nextTick()` | [#](https://cn.vuejs.org/api/general.html#nexttick)
`defineComponent()` | [#](https://cn.vuejs.org/api/general.html#definecomponent)
`defineAsyncComponent()` | [#](https://cn.vuejs.org/api/general.html#defineasynccomponent)
`defineCustomElement()` | [#](https://cn.vuejs.org/api/general.html#definecustomelement)
### 组合式 API - setup()
:- | :-
:- | :-
`基本使用` | [#](https://cn.vuejs.org/api/composition-api-setup.html#basic-usage)
`访问 Props` | [#](https://cn.vuejs.org/api/composition-api-setup.html#accessing-props)
`Setup 上下文` | [#](https://cn.vuejs.org/api/composition-api-setup.html#setup-context)
`与渲染函数一起使用` | [#](https://cn.vuejs.org/api/composition-api-setup.html#usage-with-render-functions)
### 组合式 API - 响应式: 工具
:- | :-
:- | :-
`isRef()` | [#](https://cn.vuejs.org/api/reactivity-utilities.html#isref)
`unref()` | [#](https://cn.vuejs.org/api/reactivity-utilities.html#unref)
`toRef()` | [#](https://cn.vuejs.org/api/reactivity-utilities.html#toref)
`toRefs()` | [#](https://cn.vuejs.org/api/reactivity-utilities.html#torefs)
`isProxy()` | [#](https://cn.vuejs.org/api/reactivity-utilities.html#isproxy)
`isReactive()` | [#](https://cn.vuejs.org/api/reactivity-utilities.html#isreactive)
`isReadonly()` | [#](https://cn.vuejs.org/api/reactivity-utilities.html#isreadonly)
### 组合式 API - 生命周期钩子
<!--rehype:wrap-class=row-span-3-->
:- | :-
:- | :-
`onMounted()` | 组件挂载完成后执行 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onmounted)
`onUpdated()` | 状态变更而更新其 DOM 树之后调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onupdated)
`onUnmounted()` | 组件实例被卸载之后调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onunmounted)
`onBeforeMount()` | 组件被挂载之前被调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onbeforemount)
`onBeforeUpdate()` | 状态变更而更新其 DOM 树之前调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onbeforeupdate)
`onBeforeUnmount()` | 组件实例被卸载之前调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onbeforeunmount)
`onErrorCaptured()` | 捕获了后代组件传递的错误时调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onerrorcaptured)
`onRenderTracked()` | 组件渲染过程中追踪到响应式依赖时调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onrendertracked)
`onRenderTriggered()` | 响应式依赖的变更触发了组件渲染时调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onrendertriggered)
`onActivated()` | 若组件实例是 \<KeepAlive> 缓存树的一部分,当组件被插入到 DOM 中时调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onactivated)
`onDeactivated()` | 若组件实例是 \<KeepAlive> 缓存树的一部分,当组件从 DOM 中被移除时调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#ondeactivated)
`onServerPrefetch()` | 组件实例在服务器上被渲染之前调用 [#](https://cn.vuejs.org/api/composition-api-lifecycle.html#onserverprefetch)
<!--rehype:className=style-list-->
### 组合式 API - 依赖注入
:- | :-
:- | :-
`provide()` | [#](https://cn.vuejs.org/api/composition-api-dependency-injection.html#provide)
`inject()` | [#](https://cn.vuejs.org/api/composition-api-dependency-injection.html#inject)
### 组合式 API - 响应式: 核心
:- | :-
:- | :-
`ref()` | [#](https://cn.vuejs.org/api/reactivity-core.html#ref)
`computed ()` | [#](https://cn.vuejs.org/api/reactivity-core.html#computed)
`reactive()` | [#](https://cn.vuejs.org/api/reactivity-core.html#reactive)
`readonly()` | [#](https://cn.vuejs.org/api/reactivity-core.html#readonly)
`watchEffect()` | [#](https://cn.vuejs.org/api/reactivity-core.html#watcheffect)
`watchPostEffect()` | [#](https://cn.vuejs.org/api/reactivity-core.html#watchposteffect)
`watchSyncEffect()` | [#](https://cn.vuejs.org/api/reactivity-core.html#watchsynceffect)
`watch()` | [#](https://cn.vuejs.org/api/reactivity-core.html#watch)
### 选项式 API - 状态选项
:- | :-
:- | :-
`data` | [#](https://cn.vuejs.org/api/options-state.html#data)
`props` | [#](https://cn.vuejs.org/api/options-state.html#props)
`computed` | [#](https://cn.vuejs.org/api/options-state.html#computed)
`methods` | [#](https://cn.vuejs.org/api/options-state.html#methods)
`watch` | [#](https://cn.vuejs.org/api/options-state.html#watch)
`emits` | [#](https://cn.vuejs.org/api/options-state.html#emits)
`expose` | [#](https://cn.vuejs.org/api/options-state.html#expose)
### 选项式 API - 生命周期选项
<!--rehype:wrap-class=row-span-2-->
:- | :-
:- | :-
`beforeCreate` | [#](https://cn.vuejs.org/api/options-lifecycle.html#beforecreate)
`created` | [#](https://cn.vuejs.org/api/options-lifecycle.html#created)
`beforeMount` | [#](https://cn.vuejs.org/api/options-lifecycle.html#beforemount)
`mounted` | [#](https://cn.vuejs.org/api/options-lifecycle.html#mounted)
`beforeUpdate` | [#](https://cn.vuejs.org/api/options-lifecycle.html#beforeupdate)
`updated` | [#](https://cn.vuejs.org/api/options-lifecycle.html#updated)
`beforeUnmount` | [#](https://cn.vuejs.org/api/options-lifecycle.html#beforeunmount)
`unmounted` | [#](https://cn.vuejs.org/api/options-lifecycle.html#unmounted)
`errorCaptured` | [#](https://cn.vuejs.org/api/options-lifecycle.html#errorcaptured)
`renderTracked` | [#](https://cn.vuejs.org/api/options-lifecycle.html#rendertracked)
`renderTriggered` | [#](https://cn.vuejs.org/api/options-lifecycle.html#rendertriggered-sup-classvt-badge-dev-only)
`activated` | [#](https://cn.vuejs.org/api/options-lifecycle.html#activated)
`deactivated` | [#](https://cn.vuejs.org/api/options-lifecycle.html#deactivated)
`serverPrefetch` | [#](https://cn.vuejs.org/api/options-lifecycle.html#serverprefetch)
### 选项式 API - 其他杂项
:- | :-
:- | :-
`name` | 显式声明组件展示时的名称 [#](https://cn.vuejs.org/api/options-misc.html#name)
`inheritAttrs` | 默认的组件 `attribute` 透传行为 [#](https://cn.vuejs.org/api/options-misc.html#inheritattrs)
`components` | [#](https://cn.vuejs.org/api/options-misc.html#components)
`directives` | [#](https://cn.vuejs.org/api/options-misc.html#directives)
### 选项式 API - 渲染选项
:- | :-
:- | :-
`template` | [#](https://cn.vuejs.org/api/options-rendering.html#template)
`render` | [#](https://cn.vuejs.org/api/options-rendering.html#render)
`compilerOptions` | [#](https://cn.vuejs.org/api/options-rendering.html#compileroptions)
### 选项式 API - 组件实例
<!--rehype:wrap-class=row-span-2-->
:- | :-
:- | :-
`$data` | [#](https://cn.vuejs.org/api/component-instance.html#data)
`$props` | [#](https://cn.vuejs.org/api/component-instance.html#props)
`$el` | [#](https://cn.vuejs.org/api/component-instance.html#el)
`$options` | [#](https://cn.vuejs.org/api/component-instance.html#options)
`$parent` | [#](https://cn.vuejs.org/api/component-instance.html#parent)
`$root` | [#](https://cn.vuejs.org/api/component-instance.html#root)
`$slots` | [#](https://cn.vuejs.org/api/component-instance.html#slots)
`$refs` | [#](https://cn.vuejs.org/api/component-instance.html#refs)
`$attrs` | [#](https://cn.vuejs.org/api/component-instance.html#attrs)
`$watch()` | [#](https://cn.vuejs.org/api/component-instance.html#watch)
`$emit()` | [#](https://cn.vuejs.org/api/component-instance.html#emit)
`$forceUpdate()` | [#](https://cn.vuejs.org/api/component-instance.html#forceupdate)
`$nextTick()` | [#](https://cn.vuejs.org/api/component-instance.html#nexttick)
### 选项式 API - 组合选项
:- | :-
:- | :-
`provide` | [#](https://cn.vuejs.org/api/options-composition.html#provide)
`inject` | [#](https://cn.vuejs.org/api/options-composition.html#inject)
`mixins` | [#](https://cn.vuejs.org/api/options-composition.html#mixins)
`extends` | [#](https://cn.vuejs.org/api/options-composition.html#extends)
### 内置内容 - 指令
<!--rehype:wrap-class=row-span-2-->
:- | :-
:- | :-
`v-text` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-text)
`v-html` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-html)
`v-show` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-show)
`v-if` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-if)
`v-else` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-else)
`v-else-if` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-else-if)
`v-for` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-for)
`v-on` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-on)
`v-bind` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-bind)
`v-model` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-model)
`v-slot` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-slot)
`v-pre` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-pre)
`v-once` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-once)
`v-memo` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-memo)
`v-cloak` | [#](https://cn.vuejs.org/api/built-in-directives.html#v-cloak)
### 内置内容 - 组件
:- | :-
:- | :-
`<Transition>` | [#](https://cn.vuejs.org/api/built-in-components.html#transition)
`<TransitionGroup>` | [#](https://cn.vuejs.org/api/built-in-components.html#transitiongroup)
`<KeepAlive>` | [#](https://cn.vuejs.org/api/built-in-components.html#keepalive)
`<Teleport>` | [#](https://cn.vuejs.org/api/built-in-components.html#teleport)
`<Suspense>` | [#](https://cn.vuejs.org/api/built-in-components.html#suspense)
### 内置内容 - 特殊 Attributes
:- | :-
:- | :-
`key` | [#](https://cn.vuejs.org/api/built-in-special-attributes.html#key)
`ref` | [#](https://cn.vuejs.org/api/built-in-special-attributes.html#ref)
`is` | [#](https://cn.vuejs.org/api/built-in-special-attributes.html#is)
### 内置内容 - 特殊元素
:- | :-
:- | :-
`<component>` | [#](https://cn.vuejs.org/api/built-in-special-elements.html#component)
`<slot>` | [#](https://cn.vuejs.org/api/built-in-special-elements.html#slot)
### 单文件组件 - 语法定义
<!--rehype:wrap-class=row-span-2-->
:- | :-
:- | :-
`总览` | [#](https://cn.vuejs.org/api/sfc-spec.html#overview)
`相应语言块` | [#](https://cn.vuejs.org/api/sfc-spec.html#language-blocks)
`自动名称推导` | [#](https://cn.vuejs.org/api/sfc-spec.html#automatic-name-inference)
`预处理器` | [#](https://cn.vuejs.org/api/sfc-spec.html#pre-processors)
`Src 导入` | [#](https://cn.vuejs.org/api/sfc-spec.html#src-imports)
`注释` | [#](https://cn.vuejs.org/api/sfc-spec.html#comments)
### 单文件组件 - \<script setup>
<!--rehype:wrap-class=row-span-2-->
:- | :-
:- | :-
`基本语法` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#basic-syntax)
`响应式` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#reactivity)
`使用组件` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#using-components)
`使用自定义指令` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#using-custom-directives)
`defineProps() 和 defineEmits()` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#defineprops-defineemits)
`defineExpose` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#defineexpose)
`useSlots() 和 useAttrs()` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#useslots-useattrs)
`与普通的 &lt;script&gt; 一起使用` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#usage-alongside-normal-script)
`顶层 await` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#top-level-await)
`针对 TypeScript 的功能` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#typescript-only-features)
`限制` | [#](https://cn.vuejs.org/api/sfc-script-setup.html#restrictions)
### 单文件组件 - CSS 功能
:- | :-
:- | :-
`组件作用域 CSS` | [#](https://cn.vuejs.org/api/sfc-css-features.html#scoped-css)
`CSS Modules` | [#](https://cn.vuejs.org/api/sfc-css-features.html#css-modules)
`CSS 中的 v-bind()` | [#](https://cn.vuejs.org/api/sfc-css-features.html#v-bind-in-css)
### 进阶 API - 渲染函数
:- | :-
:- | :-
`h()` | [#](https://cn.vuejs.org/api/render-function.html#h)
`mergeProps()` | [#](https://cn.vuejs.org/api/render-function.html#mergeprops)
`cloneVNode()` | [#](https://cn.vuejs.org/api/render-function.html#clonevnode)
`isVNode()` | [#](https://cn.vuejs.org/api/render-function.html#isvnode)
`resolveComponent()` | [#](https://cn.vuejs.org/api/render-function.html#resolvecomponent)
`resolveDirective()` | [#](https://cn.vuejs.org/api/render-function.html#resolvedirective)
`withDirectives()` | [#](https://cn.vuejs.org/api/render-function.html#withdirectives)
`withModifiers()` | [#](https://cn.vuejs.org/api/render-function.html#withmodifiers)
### 进阶 API - 服务端渲染
:- | :-
:- | :-
`renderToString()` | [#](https://cn.vuejs.org/api/ssr.html#rendertostring)
`renderToNodeStream()` | [#](https://cn.vuejs.org/api/ssr.html#rendertonodestream)
`pipeToNodeWritable()` | [#](https://cn.vuejs.org/api/ssr.html#pipetonodewritable)
`renderToWebStream()` | [#](https://cn.vuejs.org/api/ssr.html#rendertowebstream)
`pipeToWebWritable()` | [#](https://cn.vuejs.org/api/ssr.html#pipetowebwritable)
`renderToSimpleStream()` | [#](https://cn.vuejs.org/api/ssr.html#rendertosimplestream)
`useSSRContext()` | [#](https://cn.vuejs.org/api/ssr.html#usessrcontext)
### 进阶 API - TypeScript 工具类型
:- | :-
:- | :-
`PropType<T>` | [#](https://cn.vuejs.org/api/utility-types.html#proptypet)
`ComponentCustomProperties` | [#](https://cn.vuejs.org/api/utility-types.html#componentcustomproperties)
`ComponentCustomOptions` | [#](https://cn.vuejs.org/api/utility-types.html#componentcustomoptions)
`ComponentCustomProps` | [#](https://cn.vuejs.org/api/utility-types.html#componentcustomprops)
`CSSProperties` | [#](https://cn.vuejs.org/api/utility-types.html#cssproperties)
### 进阶 API - 自定义渲染
:- | :-
:- | :-
`createRenderer()` | [#](https://cn.vuejs.org/api/custom-renderer.html#create-renderer)
另见
---
- [Vue 3.x 官方文档](https://cn.vuejs.org/)
- [Vue Router 4.x 官方文档](https://router.vuejs.org/zh/)

View File

@@ -10,8 +10,9 @@ Vue2 备忘清单
Vue 是一套用于构建用户界面的渐进式框架
- [Vue 2.x 官方文档](https://v2.cn.vuejs.org/)
- [Vue Router 3.x 官方文档](https://v3.router.vuejs.org/)
- [Vue 2.x 官方文档](https://v2.cn.vuejs.org/) _(v2.cn.vuejs.org)_
- [Vue Router 3.x 官方文档](https://v3.router.vuejs.org/) _(v3.router.vuejs.org)_
- [Vue 3 备忘清单](./vue.md)
<!--rehype:className=style-round-->
注意Vue 2.x 版本对应 Vue Router 3.x 路由版本

107
docs/xcode.md Normal file
View File

@@ -0,0 +1,107 @@
Xcode 备忘清单
====
这个 Xcode 快速参考备忘单显示了它的键盘快捷键和命令。
Xcode
---
### 搜索
快捷键 | 描述
:---- | ----
`Cmd + F` | 在文件中查找
`Cmd + Option + F` | 在文件中查找和替换
`Cmd + Shift + F` | 在项目中查找
`Cmd + Option + Shift + F` | 在项目中查找和替换
<!--rehype:className=shortcuts-->
### 选项卡
快捷键 | 描述
:---- | ----
`Cmd + T` | 新选项卡
`Cmd + }` | 上一个选项卡
`Cmd + {` | 下一个选项卡
<!--rehype:className=shortcuts-->
### 导航
<!--rehype:wrap-class=row-span-2-->
快捷键 | 描述
:---- | ----
`Cmd + Shift + O` | 快速打开
`Cmd + J` | 专注于编辑
`Cmd + Ctrl + UP` | 下一个对手
`Cmd + Ctrl + DOWN` | 上一个对手
`Cmd + Ctrl + RIGHT` | 下一个最近的文件
`Cmd + Ctrl + LEFT` | 上一个 最近的文件
`Cmd + click` | 符号的定义
`Cmd + L` | 去线
`Cmd + Option + LEFT` | 折叠部分
`Cmd + Option + RIGHT` | 展开部分
<!--rehype:className=shortcuts-->
### 调试
快捷键 | 描述
:---- | ----
`Cmd + Shift + Y` | 切换调试区域
`Cmd + '` | 下一期
`Cmd + "` | 上一期
`Cmd + \` | 添加/删除断点
`Cmd + Y` | 活动/非活动断点
`Cmd + K` | 清除控制台
<!--rehype:className=shortcuts-->
### 导航器(左侧面板)
快捷键 | 描述
:---- | ----
`Cmd + 0` | 显示隐藏
`Cmd + 1-8` | 切换标签
`Option + click` | 打开助理编辑器
`Shift + Option + click` | 决定在哪里打开
`double click` | 在新窗口中打开
<!--rehype:className=shortcuts-->
### 编辑
快捷键 | 描述
:---- | ----
`Cmd + Option + ENTER` | 显示助理编辑器
`Cmd + ENTER` | 隐藏助理编辑器
`Ctrl + SPACE or ESC` | 切换完成
`Cmd + ]` | 缩进部分
`Cmd + [` | 突出部分
`Ctrl + i` | 修复缩进
`Cmd + /` | 评论/取消评论
`Cmd + Option + [` | 向上移动队列
`Cmd + Option + ]` | 下移线
<!--rehype:className=shortcuts-->
### 实用程序(右面板)
快捷键 | 描述
:---- | ----
`Cmd + Option + 0` | 显示隐藏
`Cmd + Option + 1-9` | 转到选项卡
<!--rehype:className=shortcuts-->
### 调试和运行
快捷键 | 描述
:---- | ----
`Cmd + B` | 建造
`Cmd + R` | 运行
`Cmd + .` | 停止
`Cmd + Shift + B` | 分析
`Cmd + U` | 测试
`Cmd + Shift + K` | 清理
<!--rehype:className=shortcuts-->

View File

@@ -57,7 +57,7 @@ other_thing: *VAR_NAME
#### ↓ 等效的 JSON
```json {.wrap}
```json
{
"some_thing": "foobar",
"other_thing": "foobar"
@@ -84,7 +84,7 @@ description: |
#### ↓ 等效的 JSON
```json {.wrap}
```json
{"description": "hello\nworld\n"}
```
@@ -102,7 +102,7 @@ child:
#### ↓ 等效的 JSON
```json {.wrap}
```json
{
"parent": {
"a": 2,
@@ -129,7 +129,7 @@ other_values:
#### ↓ 等效的 JSON
```json {.wrap}
```json
{
"values": [
"Will be",
@@ -154,7 +154,7 @@ description: >
#### ↓ 等效的 JSON
```json {.wrap}
```json
{"description": "hello world\n"}
```

423
docs/yum.md Normal file
View File

@@ -0,0 +1,423 @@
YUM 备忘清单
===
这个 YUM 快速参考备忘单显示了它的常用命令使用清单。
YUM 清单查询
---
### 介绍
yum`Y`ellow dog `U`pdater, `M`odified是一个在 `Fedora``RedHat` 以及 SUSE 中的 `Shell` 前端软件包管理器
```bash
$ yum [options] [command] [package ...]
```
----
- [YUM 官方网站](http://yum.baseurl.org/) _(yum.baseurl.org)_
- [Fedora 中的 Yum 文档](https://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/ch-yum.html) _(fedoraproject.org)_
- [CentOS 中的 Yum 文档](http://wiki.centos.org/PackageManagement/Yum/) _(wiki.centos.org)_
- [Scientific Linux 中的 Yum 文档](https://www.scientificlinux.org/documentation/faq/yum.apt.repo) _(scientificlinux.org)_
### YUM 查询
子命令描述和任务
#### help
显示 yum 命令和选项
```bash
yum help
```
显示 yum 子命令和选项
### 单独的包
<!--rehype:wrap-class=row-span-3-->
#### list
列出存储库中的包名称
```bash
# 列出存储库中的包名称
yum list available
# 列出所有可用的包
yum list installed
# 列出所有已安装的包
yum list all
# 列出已安装和可用的软件包
yum list kernel
```
#### info
列出已安装和可用的内核包
```bash
# 列出有关 `vsftpd` 软件包的信息
$ yum info vsftpd
```
#### deplist
显示包的依赖项
```bash
$ yum deplist nfs-utils
```
列出依赖项和提供它们的包
#### provides
```bash
# 查找提供查询文件的包
$ yum provides “*bin/top”
# 显示包含 README.top 文件的包
$ yum provides “*/README.top”
```
#### search
```bash
# 查找名称或描述中带有 samba 的软件包
$ yum search samba
```
#### updateinfo
```bash
# 获取有关可用软件包更新的信息
$ yum updateinfo security
```
获取有关可用 security 更新的信息
### 包组
#### grouplist
列出已安装和可用软件包组的名称
#### groupinfo
```bash
# 查看 Web 服务器组中的包
$ yum groupinfo "Web Server"
```
#### check-update
查询存储库以获取可用的软件包更新
### 管理 YUM 存储库
<!--rehype:wrap-class=row-span-2-->
#### repolist
显示启用的软件存储库
#### repoinfo
显示有关启用的 `yum` 存储库的信息 *
```bash
$ yum repoinfo rhel-7-server-rpms
```
请参阅有关 rhel-7-server-rpms 存储库的信息
#### repo-pkgs
使用特定存储库中的包 *
```bash
# 列出来自 my-rpms 存储库的软件包
$ yum repo-pkgs my-rpms list
# 从 my-rpms repo 安装所有软件包
$ yum repo-pkgs my-rpms install
# 从 my-rpms 存储库中删除所有软件包
$ yum repo-pkgs my-rpms remove
```
#### makecache
下载 `yum` 存储库数据到缓存
### 故障排除和维护 YUM
<!--rehype:wrap-class=row-span-2-->
#### check
检查本地 RPM 数据库是否有问题(运行了很长时间)
#### history
```bash
# 列出所有 yum 安装、更新和清理操作
$ yum history list
# 显示 yum info 3 的详细信息
$ yum history info 3
# 撤消事务 3 中的 yum 操作
$ yum history undo 3
# 重做事务 3 中撤消的 yum 操作
$ yum history redo 3
```
#### clean
```bash
# 删除缓存中保存的包
$ yum clean packages
# 从缓存中清除所有包和元数据
$ yum clean all
```
清除缓存的包数据
#### fssnapshot
列出 LVM 快照(帮助在包更新后回滚)
#### fs
```bash
# 列出启用的文件系统过滤器
$ yum fs filters
# 过滤所有正在安装的文档(小心!)
$ yum fs documentation
```
对文件系统采取行动(防止在最小系统上安装 doc 或语言文件)非常有用!
### 使用 YUM 管理语言包
#### langavailable
列出已安装的语言 *
#### langinfo
```bash
# 列出与西班牙语相关的软件包
$ yum langinfo es
```
#### langinstall
```bash
# 安装与西班牙语相关的软件包
$ yum langinstall es
```
#### langlist
列出已安装的语言 *
#### langremove
```bash
# 删除与西班牙语相关的软件包
$ yum langremove es
```
### 使用 YUM 安装、删除和升级软件包
<!--rehype:wrap-class=row-span-2-->
#### install
```bash
# 安装 vsftpd 包
$ yum install vsftpd
```
#### update
```bash
# 使用可用更新更新所有软件包
$ yum update
# 更新 httpd 包(如果可用)
$ yum update httpd
# 应用与安全相关的包更新
$ yum update --security
```
#### update-to
将一个或所有软件包更新到特定版本
#### upgrade
```bash
$ yum -y upgrade
```
更新包考虑过时,只升级所有包,不升级软件和系统内核
#### localinstall
```bash
# 从本地文件、http 或 ftp 安装包
$ yum localinstall abc-1-1.i686.rpm
# 从本地目录安装 abc 包
$ yum localinstall http://myrepo/abc-1-1.i686.rpm
```
<!--rehype:className=wrap-text-->
从 FTP 站点安装 abc
#### downgrade
将软件包降级到早期版本
```bash
$ yum downgrade abc
```
将 abc 包降级到早期版本
#### reinstall
```bash
# 重新安装 util-linux以替换任何已删除的文件
$ yum reinstall util-linux
```
#### swap
```bash
# 删除 ftp 包并安装 lftp 包
$ yum swap ftp lftp
```
#### erase/remove
```bash
# 删除 vsftpd 包和依赖
$ yum remove vsftpd
```
#### autoremove
```bash
# 删除 httpd 和其他不需要的包
$ yum autoremove httpd
```
#### groupinstall
```bash
# 安装 Web 服务器包
$ yum groupinstall "Web server"
```
### 更多 YUM 相关命令(安装 yum-utils 软件包)
#### find-repos-of-install
查找包来自哪个存储库
#### needs-restarting
查找已更新且需要重启的进程
#### repoclosure
从存储库中获取未满足的依赖项列表
#### repoquery
查询远程仓库和本地 `RPM` 数据库
```bash
# 显示依赖包
$ repoquery --requires --resolve bash
```
#### reposync
`yum` 存储库同步到本地目录
```bash
# 从 repo 获取包
$ reposync -r rhel-atomic-host-beta-rpms
```
#### repotrack
下载一个包及其所有依赖项
#### show-installed
列出已安装的 RPM 包和统计信息
#### verifytree
检查本地 yum 存储库的一致性
#### yum-complete-transaction
尝试完成未完成的 yum 交易
#### yumdb
检查或更改 yum 数据库
#### yumdownloader
```bash
# 使用本地源离线安装 net-tools 工具包
$ yumdownloader net-tools.x86_64
# 使用 destdir 参数设置下载的目标目录
$ yumdownloader net-tools.x86_64 --destdir=/usr/local/bin/
# 使用 resolve 参数解决依赖关系并下载所需的安装包
$ yumdownloader net-tools.x86_64 --resolve --destdir=/usr/local/bin/
```
<!--rehype:className=wrap-text-->
从 repo 下载一个包到当前目录
### 不同 YUM 命令的常用选项
```bash
yum --disableplugin=langpacks info vsftpd
# 显示与正在运行的进程相关的包
yum --enableplugin=ps ps
yum install docker \
--enablerepo=rhel-7-server-extras-rpm
yum list available --disablerepo=epel
# 下载 vsftpd 包到缓存
yum install --downloadonly vsftpd
```
---
:- | -
:- | -
`-y` | 如果出现提示,假设是
`--assumeno` | 如果提示,则假设否
`-q` | 不产生任何输出
`-v` | 产生额外的调试输出
`--noplugins` | 运行命令而不加载任何 yum 插件
`--disableplugin=` | 禁用单个命令的特定插件
`--enableplugin=` | 启用已安装但当前已禁用的插件
`--enablerepo=` | 为单个命令启用当前禁用的 repo通配符可以
`--disablerepo=` | 为单个命令禁用当前启用的 repo通配符可以
`--downloadonly` | 下载到 `/var/cache/yum/arch/prod/repo/packages/`,但不要安装
`--filter-???=` | 代替???与vendors, rpm-groups, arches 和其他人一起过滤输出
`--changelog` | 显示包的变更日志信息
<!--rehype:className=style-list-->
另见
---
- [YUM 官方网站](http://yum.baseurl.org/) _(yum.baseurl.org)_
- [YUM 备忘清单(适用于红帽 RedHad 企业 Linux)](https://access.redhat.com/sites/default/files/attachments/rh_yum_cheatsheet_1214_jcs_print-1.pdf) _(access.redhat.com)_
- [用 yum 管理软件包](http://prefetch.net/articles/yum.html) _(prefetch.net)_
- [Fedora 中的 Yum 文档](https://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/ch-yum.html) _(fedoraproject.org)_
- [CentOS 中的 Yum 文档](http://wiki.centos.org/PackageManagement/Yum/) _(wiki.centos.org)_
- [Scientific Linux 中的 Yum 文档](https://www.scientificlinux.org/documentation/faq/yum.apt.repo) _(scientificlinux.org)_

View File

@@ -1,6 +1,6 @@
{
"name": "@wcj/reference",
"version": "1.15.0",
"version": "1.17.0",
"description": "为开发人员分享快速参考备忘单(主要是方便自己)。",
"author": "jaywcjlove",
"license": "MIT",

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em" viewBox="0 0 65 65">
<path fill="currentColor" d="M32,0 C49.672,0 64,14.328 64,32 C64,49.674 49.674,64 32,64 C14.326,64 0,49.674 0,32 C0,14.326 14.328,0 32,0 Z M32.539,12.688 C31.666,12.688 30.875,13.156 30.511,14.04 L16.52,47.664 L21.303,47.664 L26.837,33.801 L43.352,47.144 C44.016,47.681 44.496,47.924 45.119,47.924 C46.367,47.924 47.457,46.988 47.457,45.638 C47.457,45.418 47.379,45.068 47.239,44.694 L34.512,14.04 C34.148,13.156 33.412,12.688 32.539,12.688 Z M32.54,19.548 L40.82,39.986 L28.312,30.133 L32.54,19.548 Z" transform="translate(.38 .76)"/>
</svg>

After

Width:  |  Height:  |  Size: 648 B

3
scripts/assets/cargo.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="1em" height="1em" viewBox="0 0 32 32">
<path d="M15 3.77a.951.951 0 1 1 1.902 0 .951.951 0 0 1-1.902 0M3.654 12.38a.951.951 0 1 1 1.902 0 .951.951 0 0 1-1.902 0m22.692.044a.951.951 0 0 1 1.902 0 .951.951 0 0 1-1.902 0M6.406 13.73a.87.87 0 0 0 .441-1.146l-.422-.954h1.66v7.48H4.736a11.71 11.71 0 0 1-.379-4.47zm6.942.184v-2.205H17.3c.204 0 1.44.236 1.44 1.16 0 .768-.95 1.044-1.73 1.044zM7.952 25.785a.951.951 0 1 1 1.902 0 .951.951 0 0 1-1.902 0m14.093.044a.951.951 0 0 1 1.902 0 .951.951 0 0 1-1.902 0m.294-2.157a.867.867 0 0 0-1.03.667l-.477 2.228a11.71 11.71 0 0 1-9.765-.047l-.477-2.228a.865.865 0 0 0-1.03-.667l-1.967.422a11.71 11.71 0 0 1-1.017-1.199h9.57c.108 0 .18-.02.18-.118v-3.385c0-.1-.072-.118-.18-.118h-2.8v-2.146h3.027c.276 0 1.477.08 1.862 1.614l.565 2.5c.18.55.913 1.653 1.693 1.653h4.94a11.71 11.71 0 0 1-1.085 1.255zm5.314-8.938a11.71 11.71 0 0 1 .025 2.033h-1.2c-.12 0-.17.08-.17.197v.552c0 1.3-.732 1.58-1.374 1.653-.61.07-1.29-.256-1.372-.63-.36-2.028-.96-2.46-1.9-3.21 1.177-.748 2.402-1.85 2.402-3.327 0-1.594-1.093-2.598-1.838-3.09-1.045-.69-2.202-.827-2.514-.827H7.277a11.71 11.71 0 0 1 6.551-3.697l1.465 1.537c.33.347.88.36 1.226.028l1.64-1.567a11.71 11.71 0 0 1 8.017 5.709l-1.122 2.534a.87.87 0 0 0 .441 1.146zm2.798.04-.038-.392 1.156-1.078c.235-.22.147-.66-.153-.772l-1.477-.552-.116-.38.92-1.28c.188-.26.015-.675-.3-.727l-1.558-.253-.187-.35.655-1.437c.134-.293-.115-.667-.437-.655l-1.58.055-.25-.303.363-1.54c.073-.313-.244-.63-.557-.557l-1.54.363-.304-.25.055-1.58c.012-.32-.362-.57-.654-.437l-1.436.655-.35-.188-.254-1.558c-.05-.316-.467-.488-.727-.3l-1.28.92-.38-.115L19.47.586c-.112-.3-.553-.388-.772-.154L17.62 1.588l-.392-.038-.832-1.345c-.168-.272-.62-.272-.787 0l-.832 1.345-.392.038L13.305.43c-.22-.234-.66-.147-.772.154l-.552 1.477-.38.115-1.28-.92c-.26-.188-.676-.015-.727.3L9.34 3.114l-.35.188-1.436-.655c-.292-.133-.667.117-.654.437l.055 1.58-.304.25-1.54-.363c-.313-.073-.63.244-.557.557l.363 1.54-.25.303-1.58-.055c-.32-.01-.57.362-.437.655l.655 1.437-.188.35-1.558.253c-.316.05-.488.467-.3.727l.92 1.28-.116.38-1.477.552c-.3.112-.388.553-.153.772l1.156 1.078-.038.392-1.345.832c-.272.168-.272.62 0 .787l1.345.832.038.392L.43 18.697c-.234.22-.147.66.153.772l1.477.552.116.38-.92 1.28c-.187.26-.015.676.3.727l1.557.253.188.35-.655 1.436c-.133.292.118.667.437.655l1.58-.055.25.304-.363 1.54c-.073.312.244.63.557.556l1.54-.363.304.25-.055 1.58c-.012.32.362.57.654.437l1.436-.655.35.188.254 1.557c.05.317.467.488.727.302l1.28-.922.38.116.552 1.477c.112.3.553.388.772.153l1.078-1.156.392.04.832 1.345c.168.27.618.272.787 0l.832-1.345.392-.04 1.078 1.156c.22.235.66.147.772-.153l.552-1.477.38-.116 1.28.922c.26.187.676.015.727-.302l.254-1.557.35-.188 1.436.655c.292.133.666-.116.654-.437l-.055-1.58.303-.25 1.54.363c.313.073.63-.244.557-.556l-.363-1.54.25-.304 1.58.055c.32.013.57-.363.437-.655l-.655-1.436.187-.35 1.558-.253c.317-.05.49-.466.3-.727l-.92-1.28.116-.38 1.477-.552c.3-.113.388-.553.153-.772l-1.156-1.078.038-.392 1.345-.832c.272-.168.273-.618 0-.787z"/>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

3
scripts/assets/cmake.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
<path d="M11.769.066.067 23.206l12.76-10.843zm11.438 23.868L7.471 17.587 0 23.934zm.793-.198L12.298.463l1.719 19.24zM12.893 12.959l-5.025 4.298 5.62 2.248z"/>
</svg>

After

Width:  |  Height:  |  Size: 274 B

3
scripts/assets/conan.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
<path d="M11.709 0 0 5.534V16.76L11.984 24l4.857-2.706V9.998c.13-.084.275-.196.399-.27l.032-.017c.197-.11.329-.102.23.33v10.884l6.466-3.603V6.11L24 6.093Zm.915 2.83c.932.02 1.855.191 2.706.552a9.106 9.106 0 0 1 3.45 2.429 62.814 62.814 0 0 1-3.044 1.616c.56-.853.14-2.009-.76-2.455-.93-.648-2.093-.73-3.205-.674-1.064.175-2.258.51-2.893 1.474-.722.862-.084 2.11.914 2.408 1.2.509 2.543.38 3.806.413-.975.457-1.931.97-2.927 1.358-1.701-.176-3.585-.917-4.374-2.51-.574-1.178.215-2.572 1.319-3.14a11.426 11.426 0 0 1 3.336-1.348 9.212 9.212 0 0 1 1.672-.123Z"/>
</svg>

After

Width:  |  Height:  |  Size: 674 B

3
scripts/assets/gmail.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
<path d="M24 5.457v13.909c0 .904-.732 1.636-1.636 1.636h-3.819V11.73L12 16.64l-6.545-4.91v9.273H1.636A1.636 1.636 0 0 1 0 19.366V5.457c0-2.023 2.309-3.178 3.927-1.964L5.455 4.64 12 9.548l6.545-4.91 1.528-1.145C21.69 2.28 24 3.434 24 5.457z"/>
</svg>

After

Width:  |  Height:  |  Size: 358 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em" viewBox="0 0 170 155">
<path fill="currentColor" d="M114.011719,0 C114.031753,0 114.051781,9.66838127e-05 114.071803,0.00028991369 L113.950625,0 C114.100589,0 114.249952,0.00491257692 114.398738,0.0147015257 C114.496091,0.0180986001 114.59346,0.0264563127 114.690679,0.0370869506 C114.763187,0.0481571338 114.835494,0.0572318789 114.907669,0.067464417 C114.971991,0.0739091229 115.036007,0.0841522806 115.099959,0.0953775501 C115.24595,0.122450074 115.39156,0.152173631 115.536656,0.18662408 C115.540798,0.188498498 115.544794,0.189486731 115.54879,0.190478791 C119.122197,1.04453486 122.383831,4.76737051 125.66002,10.8263087 C134.504866,26.8199813 143.233527,58.3720491 155.079417,90.6337197 C159.654754,102.628081 164.55935,114.497108 169.788199,126.226944 L169.804687,126.261915 C169.561883,126.036533 169.320725,125.810778 169.080287,125.584766 C157.868517,115.075569 148.22195,104.663526 137.239023,104.2475 C132.658523,104.354002 127.856902,106.798464 122.838279,110.852094 C115.884496,116.808357 108.801576,125.883622 101.371385,134.204547 C98.5874924,137.56095 95.5963582,140.611013 92.6231575,143.258032 C88.7439115,146.854737 84.755953,149.885794 80.6318234,151.86198 C77.8565289,153.320564 75.5138817,154.09239 73.9252344,154.03711 C73.9252344,154.03711 73.6050703,153.13142 73.0221211,151.57669 C72.3047411,149.730047 71.5034539,147.651723 70.6255994,145.430214 C66.7152626,135.747112 59.8767348,120.415838 53.1632895,113.088875 C51.6852935,111.572994 50.1641478,110.359882 48.6081822,109.545946 C44.005418,107.866712 38.8723879,108.38614 34.6886719,110.979493 L0.055,86.396 L48.3332422,66.8904688 L48.6560848,66.4654629 C53.451559,60.1199079 58.8698811,54.2694715 64.8303516,49.0016797 L64.5185432,49.2785154 C64.6217228,49.1857698 64.7250601,49.0931917 64.8285547,49.0007813 C68.8310937,46.8777734 76.3510156,48.0304688 90.1177734,30.9287109 C90.3414762,30.6490748 90.5626216,30.370121 90.781262,30.0919051 C92.8016022,27.5154524 94.6118072,25.0027302 96.2508432,22.5981511 L96.5028669,22.2275882 C105.052639,9.58238289 108.828956,0 113.950625,0 L113.994,0.001 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

3
scripts/assets/rust.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="1em" height="1em" viewBox="0 0 32 32">
<path d="M15 3.77a.951.951 0 1 1 1.902 0 .951.951 0 0 1-1.902 0M3.654 12.38a.951.951 0 1 1 1.902 0 .951.951 0 0 1-1.902 0m22.692.044a.951.951 0 0 1 1.902 0 .951.951 0 0 1-1.902 0M6.406 13.73a.87.87 0 0 0 .441-1.146l-.422-.954h1.66v7.48H4.736a11.71 11.71 0 0 1-.379-4.47zm6.942.184v-2.205H17.3c.204 0 1.44.236 1.44 1.16 0 .768-.95 1.044-1.73 1.044zM7.952 25.785a.951.951 0 1 1 1.902 0 .951.951 0 0 1-1.902 0m14.093.044a.951.951 0 0 1 1.902 0 .951.951 0 0 1-1.902 0m.294-2.157a.867.867 0 0 0-1.03.667l-.477 2.228a11.71 11.71 0 0 1-9.765-.047l-.477-2.228a.865.865 0 0 0-1.03-.667l-1.967.422a11.71 11.71 0 0 1-1.017-1.199h9.57c.108 0 .18-.02.18-.118v-3.385c0-.1-.072-.118-.18-.118h-2.8v-2.146h3.027c.276 0 1.477.08 1.862 1.614l.565 2.5c.18.55.913 1.653 1.693 1.653h4.94a11.71 11.71 0 0 1-1.085 1.255zm5.314-8.938a11.71 11.71 0 0 1 .025 2.033h-1.2c-.12 0-.17.08-.17.197v.552c0 1.3-.732 1.58-1.374 1.653-.61.07-1.29-.256-1.372-.63-.36-2.028-.96-2.46-1.9-3.21 1.177-.748 2.402-1.85 2.402-3.327 0-1.594-1.093-2.598-1.838-3.09-1.045-.69-2.202-.827-2.514-.827H7.277a11.71 11.71 0 0 1 6.551-3.697l1.465 1.537c.33.347.88.36 1.226.028l1.64-1.567a11.71 11.71 0 0 1 8.017 5.709l-1.122 2.534a.87.87 0 0 0 .441 1.146zm2.798.04-.038-.392 1.156-1.078c.235-.22.147-.66-.153-.772l-1.477-.552-.116-.38.92-1.28c.188-.26.015-.675-.3-.727l-1.558-.253-.187-.35.655-1.437c.134-.293-.115-.667-.437-.655l-1.58.055-.25-.303.363-1.54c.073-.313-.244-.63-.557-.557l-1.54.363-.304-.25.055-1.58c.012-.32-.362-.57-.654-.437l-1.436.655-.35-.188-.254-1.558c-.05-.316-.467-.488-.727-.3l-1.28.92-.38-.115L19.47.586c-.112-.3-.553-.388-.772-.154L17.62 1.588l-.392-.038-.832-1.345c-.168-.272-.62-.272-.787 0l-.832 1.345-.392.038L13.305.43c-.22-.234-.66-.147-.772.154l-.552 1.477-.38.115-1.28-.92c-.26-.188-.676-.015-.727.3L9.34 3.114l-.35.188-1.436-.655c-.292-.133-.667.117-.654.437l.055 1.58-.304.25-1.54-.363c-.313-.073-.63.244-.557.557l.363 1.54-.25.303-1.58-.055c-.32-.01-.57.362-.437.655l.655 1.437-.188.35-1.558.253c-.316.05-.488.467-.3.727l.92 1.28-.116.38-1.477.552c-.3.112-.388.553-.153.772l1.156 1.078-.038.392-1.345.832c-.272.168-.272.62 0 .787l1.345.832.038.392L.43 18.697c-.234.22-.147.66.153.772l1.477.552.116.38-.92 1.28c-.187.26-.015.676.3.727l1.557.253.188.35-.655 1.436c-.133.292.118.667.437.655l1.58-.055.25.304-.363 1.54c-.073.312.244.63.557.556l1.54-.363.304.25-.055 1.58c-.012.32.362.57.654.437l1.436-.655.35.188.254 1.557c.05.317.467.488.727.302l1.28-.922.38.116.552 1.477c.112.3.553.388.772.153l1.078-1.156.392.04.832 1.345c.168.27.618.272.787 0l.832-1.345.392-.04 1.078 1.156c.22.235.66.147.772-.153l.552-1.477.38-.116 1.28.922c.26.187.676.015.727-.302l.254-1.557.35-.188 1.436.655c.292.133.666-.116.654-.437l-.055-1.58.303-.25 1.54.363c.313.073.63-.244.557-.556l-.363-1.54.25-.304 1.58.055c.32.013.57-.363.437-.655l-.655-1.436.187-.35 1.558-.253c.317-.05.49-.466.3-.727l-.92-1.28.116-.38 1.477-.552c.3-.113.388-.553.153-.772l-1.156-1.078.038-.392 1.345-.832c.272-.168.273-.618 0-.787z"/>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

3
scripts/assets/xcode.svg Normal file
View File

@@ -0,0 +1,3 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em">
<path d="M19.06 5.333c.452-.194.774-.258 1.097-.194.516.13.774.516.968.71.194.387.903.774 1.226.839.258.064.71-.645 1.033-1.29.322-.582.516-1.356.451-1.55-.064-.193-.968-.58-1.161-.58-.13 0-.388.129-.84.064-.45-.064-.903-.58-1.16-.968-.453-.645-1.098-1.032-1.679-1.355C18.35.686 17.64.493 16.93.364 15.898.105 14.865-.088 13.833.04c-.58.064-1.29.129-1.807.323-.065 0-.194.193-.065.193s.581.065.581.065-.58.129-.58.258c0 .13.064.13.129.13.064 0 1.484-.065 2.065 0 .645.128 1.355.45 1.807 1.225.774 1.42.451 2.775.258 3.227-.968 2.13-8.648 15.23-9.035 16.133-.387.903-.516 1.484.581 2.065s1.678.322 2-.065c.388-.516 7.034-17.165 9.293-18.262zm-3.614 8.711h1.549c1.032 0 1.226.517 1.226.71.065.516-.194 1.162-1.226 1.162h-.968l.774 1.29c.452.775.258 1.162 0 1.42-.387.387-1.226.387-1.677-.452l-.904-1.548c-.645 1.42-1.29 2.968-2.065 4.775h4.001c1.936 0 3.55-1.613 3.55-3.55V6.56c-.065-.13-.194-.065-.259 0-.387.451-1.484 2-4 7.485zm-9.809 8.002h-.322a4.186 4.186 0 0 1-4.195-4.194V7.01a4.186 4.186 0 0 1 4.195-4.195h9.357c-.194-.194-.968-.516-1.742-.452-.323 0-.968.13-1.356-.129-.387-.322-.322-.516-.903-.516H4.928A4.764 4.764 0 0 0 .152 6.494V18.24c0 2.646 2.13 4.775 4.453 4.71.645 0 .839-.516 1.032-.903zm14.778-15.1v10.906a4.186 4.186 0 0 1-4.194 4.194h-4.324s-.387 1.033.839 1.033h3.872a4.764 4.764 0 0 0 4.775-4.776V8.817c.065-.903-.71-1.484-.968-1.871zM1.83 7.01v10.84c0 1.937 1.613 3.55 3.55 3.55h.58c0-.065.774-1.42 2.452-4.26.194-.386.452-.773.71-1.225h-4.71c-.581 0-.904-.387-.969-.71-.129-.516.194-1.162.904-1.162h2.387l3.034-5.291s-.71-1.29-.904-1.613c-.258-.452-.129-.904.13-1.162.386-.387 1.032-.58 1.677.452l.258.387.258-.387c.58-.84.968-.775 1.29-.71.517.129.84.71.388 1.613l-4.001 6.711h1.355c.452-.774.904-1.548 1.355-2.387-.064-.323-.129-.71-.064-1.033.064-.516.323-.968.645-1.355l.387.645c1.227-2.13 2.13-3.936 2.388-4.646.13-.387.323-1.162.13-1.807H5.38a3.54 3.54 0 0 0-3.55 3.55zm2.775 10.776c0-.064.774-1.42.774-1.42 1.227-.322 1.807.452 1.872.517 0 0-.84 1.484-1.097 1.742s-.581.323-.904.258c-.516-.129-.839-.645-.645-1.097z"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -5,8 +5,6 @@ import { create } from './create.mjs';
export const OUTOUT = path.resolve(process.cwd(), 'dist');
export const DOCS = path.resolve(process.cwd(), 'docs');
export const CSSPATH = path.resolve(process.cwd(), 'scripts/style.css');
export const CSS_OUTPUT_PATH = path.resolve(OUTOUT, 'style/style.css');
export async function createHTML(files = [], num = 0) {
const dataFile = files[num];
@@ -33,7 +31,10 @@ export async function createHTML(files = [], num = 0) {
isHome: /README.md$/.test(path.relative(process.cwd(), dataFile.path)),
githubURL,
homePath: path.relative(path.dirname(outputHTMLPath), path.resolve(OUTOUT, 'index.html')),
css: [path.relative(path.dirname(outputHTMLPath), CSS_OUTPUT_PATH)],
css: [
path.relative(path.dirname(outputHTMLPath), path.resolve(OUTOUT, 'style/style.css')),
path.relative(path.dirname(outputHTMLPath), path.resolve(OUTOUT, 'style/katex.css')),
],
});
await fs.writeFile(outputHTMLPath, html);
console.log(`♻️ \x1b[32;1m ${path.relative(OUTOUT, outputHTMLPath)} \x1b[0m`);
@@ -43,8 +44,8 @@ export async function createHTML(files = [], num = 0) {
export async function run() {
await fs.ensureDir(OUTOUT);
await fs.emptyDir(OUTOUT);
await fs.ensureDir(path.dirname(CSS_OUTPUT_PATH));
await fs.copyFile(CSSPATH, CSS_OUTPUT_PATH);
await fs.ensureDir(path.resolve(OUTOUT, 'style'));
await fs.copy(path.resolve(process.cwd(), 'scripts/style'), path.resolve(OUTOUT, 'style'));
const files = await recursiveReaddirFiles(process.cwd(), {
ignored: /\/(node_modules|\.git)/,
exclude: /(\.json|\.mjs|CONTRIBUTING\.md)$/,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1086
scripts/style/katex.css Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -237,6 +237,7 @@ table thead {
table td:first-child > code {
--text-opacity: 1;
color: rgb(5 150 105 / var(--text-opacity));
white-space: pre-wrap;
}
table td > del,
table td:first-child > del > code,
@@ -370,7 +371,7 @@ body.home .max-container a.home-button:visited:hover {
}
.home-card a.contributing::after {
color: var(--color-fg-muted);
content: '👆待完善需要您的参与';
content: attr(data-info);
display: block;
position: absolute;
font-size: 10px;
@@ -379,7 +380,20 @@ body.home .max-container a.home-button:visited:hover {
}
.home-card a.contributing:hover:after {
color: var(--color-fg-muted);
animation: contributing-move 0.1s infinite;
}
@keyframes contributing-move {
0% {
transform: translate(0px, 0px);
}
50% {
transform: translate(0px, -3px);
}
100% {
transform: translate(0px, 0px);
}
}
.home-card a.tag::before {
content: attr(data-lang);
display: block;
@@ -602,6 +616,8 @@ a.text-grey {
display: block;
overflow: hidden;
padding: 0.3rem 0.5rem;
text-overflow: ellipsis;
white-space: nowrap;
}
.menu-tocs > .menu-modal a.leve2 {
@@ -655,7 +671,7 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after {
}
.wrap.h3body-exist .wrap-header.h3wrap {
flex: initial;
flex: 1;
}
.wrap.h3body-exist > .h3wrap-body {
@@ -719,6 +735,10 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after {
border-radius: 0 0 0.5rem 0.5rem;
}
.wrap-header.h3wrap > .wrap-body :not(:first-child):last-child {
border-radius: 0 0 0.5rem 0.5rem;
}
.wrap-header.h3wrap > .wrap-body {
z-index: 0;
display: flex;
@@ -727,9 +747,9 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after {
flex-direction: column;
}
.h3wrap-body > h4,
.h3wrap-body > h5,
.h3wrap-body > h6 {
.wrap-body > h4,
.wrap-body > h5,
.wrap-body > h6 {
border-color: transparent;
background-color: var(--color-neutral-muted);
color: var(--color-fg-default);
@@ -745,10 +765,7 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after {
.h3wrap .wrap-body > ul,
.h3wrap .wrap-body > ol,
.h3wrap .wrap-body > dl,
.h3wrap-body > ul,
.h3wrap-body > ol,
.h3wrap-body > dl {
.h3wrap .wrap-body > dl {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
display: grid;

View File

@@ -117,7 +117,7 @@ export function getTocsTree(arr = [], result = []) {
if (titleNum(toc.tagName) > 3) {
panle = [toc, ...header];
}
if (resultChilds.length > 0) {
if (resultChilds.length > -1) {
const bodyStyle = toc.properties['body-style'];
delete toc.properties['body-style'];
const bodyClass = toc.properties['body-class'];
@@ -125,12 +125,16 @@ export function getTocsTree(arr = [], result = []) {
if (Array.isArray(panle)) {
panle = panle.concat(resultChilds);
} else if (panle.children) {
if (titleNum(toc.tagName) < 3) {
panle.children = panle.children.concat({
type: 'element',
tagName: 'div',
properties: { class: [`h${level}wrap-body`, bodyClass], style: bodyStyle },
children: [...resultChilds],
});
} else {
panle.children[0].children[1].children = panle.children[0].children[1].children.concat(resultChilds);
}
}
}
if (Array.isArray(panle)) {

View File

@@ -3,7 +3,23 @@ import path from 'path';
import { getSVGNode, ICONS_PATH } from './getSVGNode.mjs';
export function homeCardIcons(node, parent, isHome) {
if (isHome && node && node.type === 'element' && node.properties?.class?.includes('home-card')) {
if (
isHome &&
node &&
node.type === 'element' &&
(node.properties?.class || node.properties?.className)?.includes('contributing')
) {
const info = node.properties['data-info'];
if (!info) {
node.properties['data-info'] = '👆待完善需要您的参与';
}
}
if (
isHome &&
node &&
node.type === 'element' &&
(node.properties?.class || node.properties?.className)?.includes('home-card')
) {
node.children = node.children.map((child) => {
const href = child.properties?.href;
if (href) {