mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-20 14:07:32 +08:00
Compare commits
105 Commits
Author | SHA1 | Date | |
---|---|---|---|
b98e7d8395 | |||
3d1317603e | |||
8a651c813b | |||
10884e73f0 | |||
de4286cd7f | |||
f31aab4b35 | |||
485e83c5df | |||
5f1e3f6a2b | |||
9688866fdb | |||
9c59d4a225 | |||
3f2559c1e1 | |||
606776662d | |||
3cec40c4f9 | |||
a5c1f3c02e | |||
8171974454 | |||
d50673ad3f | |||
7ca89af17c | |||
e0ce750d73 | |||
409e44a354 | |||
8382555a20 | |||
e3e6783703 | |||
ea86c3a76c | |||
49b1394090 | |||
03f1c20d2c | |||
ae060ebac2 | |||
358d8f4e17 | |||
6614543e04 | |||
5693510df6 | |||
dfaaee7ce5 | |||
c356147d5f | |||
1e1836f949 | |||
65aab8d920 | |||
816aabf365 | |||
9efea19f6b | |||
e1661b5dc4 | |||
45f42568fc | |||
04d063f1fe | |||
7b5d556dcc | |||
6900980460 | |||
28066ae3c4 | |||
39bd0173e8 | |||
6b570f2035 | |||
dac7e778cb | |||
9e16ec7005 | |||
489d7f509e | |||
c0855988c0 | |||
e5e0160628 | |||
cb7b542fb1 | |||
101d5c1b09 | |||
004553f1de | |||
da7da9aae0 | |||
6d4ce812d0 | |||
bab4e10038 | |||
e30defe3bf | |||
0691e82eb2 | |||
38b685315b | |||
ae633b43e8 | |||
cc6e992a4b | |||
2d994f8597 | |||
ad5accdeff | |||
3a7af1eef3 | |||
9ef65a9f3d | |||
6c220d88ae | |||
01da713410 | |||
768bcb96d9 | |||
fc11b2f0dc | |||
dda6efdc7c | |||
019b4d51ec | |||
f40b56ebb8 | |||
bb533b9081 | |||
6ca7d88a48 | |||
a2cfd4e785 | |||
b08cc85e41 | |||
3f84fe66d3 | |||
5cde10b118 | |||
db7a9aa6f9 | |||
9879fabc78 | |||
a2a2ae55ca | |||
19f919f532 | |||
cabda9b9c9 | |||
ce12b2a329 | |||
5e3d42d1ad | |||
bf962194da | |||
f5e2ad2c31 | |||
ff0cc58c1d | |||
b42883e3de | |||
931850d916 | |||
f4d2c99007 | |||
112a53c101 | |||
9e525009c9 | |||
f78562b95e | |||
63d846b35d | |||
afd924a928 | |||
fb19cda5bb | |||
c9834110cd | |||
98edffbca0 | |||
b3d206d981 | |||
9ec7595b83 | |||
ef823de9a5 | |||
da22b78d8f | |||
06978b1601 | |||
b768bd4e9b | |||
a143e30d93 | |||
7ac675e34c | |||
8e3307272c |
140
CONTRIBUTING.md
140
CONTRIBUTING.md
@ -132,15 +132,80 @@ REF_LABEL=网站首页
|
||||
|
||||
由于中国国内访问,时常打不开,你可以访问下面镜像网站。
|
||||
|
||||
- [quickref.cn](https://quickref.cn)
|
||||
- [ecdata.cn](http://ref.ecdata.cn)
|
||||
- [mofe.io](http://quickref.mofe.io)
|
||||
- [aibk.cn](https://quickref.aibk.cn)
|
||||
- [jgeek.cn](http://reference.jgeek.cn/)
|
||||
- [laoleng.vip](http://bbs.laoleng.vip/reference/)
|
||||
- [liujiapeng.com](https://www.liujiapeng.com/)
|
||||
- [dbyun.net](https://www.dbyun.net/reference/index.html)
|
||||
- [dc6.fun](https://dc6.fun/reference/)
|
||||
- [if010.com](https://quickref.if010.com/)
|
||||
- [pipecraft.net](https://quickref.pipecraft.net/)
|
||||
- [isteed.cc](https://ref.isteed.cc/)
|
||||
- [1han.wiki](https://code.1han.wiki/)
|
||||
- [linzhe.top](https://linzhe.top/)
|
||||
- [xushanxiang.com](https://xushanxiang.com/ref/)
|
||||
- [winnerzr01.github.io](https://winnerzr01.github.io/Quick-Reference/index.html)
|
||||
- [hestudio.org](https://quickref.hestudio.org)
|
||||
- [surcode.cn](https://ref.surcode.cn)
|
||||
- [cms.im](https://quickref.cms.im/)
|
||||
- [nuomiphp.com](https://reference.tool.nuomiphp.com/)
|
||||
- [eryajf.net](https://ref.eryajf.net/)
|
||||
- [kjchmc.cn](https://ref.kjchmc.cn/)
|
||||
- [likeadmin.cn](https://www.likeadmin.cn/quickref/)
|
||||
- [qiubit.cc](http://ref.qiubit.cc)
|
||||
- [aoh.cc](https://aoh.cc/)
|
||||
- [reference.code05.com](https://reference.code05.com/)
|
||||
- [kyoma.top](https://reference.kyoma.top/)
|
||||
- [quickreference.pages.dev](https://quickreference.pages.dev/)
|
||||
- [code05.com](https://reference.code05.com/)
|
||||
- [xhfun.cn](https://ref.xhfun.cn/)
|
||||
|
||||
感谢🙏
|
||||
|
||||
## 利用 Github Actions 定时任务来完成自动更新
|
||||
|
||||
在仓库添加 `.github/workflows/update-ref.yml` 文件 Github Actions 配置,感谢 @eryajf https://github.com/jaywcjlove/reference/issues/102#issuecomment-1368158419 提供方法
|
||||
|
||||
```yml
|
||||
name: 每8个小时更新一次reference
|
||||
on:
|
||||
schedule:
|
||||
- cron: '21 */8 * * *' # 定时任务
|
||||
workflow_dispatch: # 手动运行
|
||||
|
||||
env: # 设置环境变量
|
||||
TZ: Asia/Shanghai # 时区(设置时区可使页面中的`最近更新时间`使用时区时间)
|
||||
|
||||
jobs:
|
||||
build: # 自定义名称
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🚜 拉取最新代码
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: 'main'
|
||||
repository: 'jaywcjlove/reference'
|
||||
|
||||
- name: ♻️ 编译静态文件
|
||||
run: |
|
||||
echo -e 'REF_URL=https://refs.xxx.net/\nREF_LABEL=网站首页' > .env
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
- name: 🚁 部署到服务器
|
||||
uses: wlixcc/SFTP-Deploy-Action@v1.0
|
||||
with:
|
||||
username: 'root' #ssh user name
|
||||
port: '22' # 远程服务器ssh端口,默认22
|
||||
server: 'prod.refs.xxx.net' # 远程服务器IP
|
||||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} # 认证服务器秘钥对的私钥
|
||||
local_path: './dist/*' # 对应我们项目打包后的静态文件路径
|
||||
remote_path: '/data/www/refs.xxx.net' # 服务器上的路径
|
||||
delete_remote_files: true
|
||||
```
|
||||
|
||||
## 贡献
|
||||
|
||||
请参阅[贡献指南](./CONTRIBUTING.md)了解如何开始。一如既往,感谢我们出色的贡献者!
|
||||
@ -163,18 +228,30 @@ REF_LABEL=网站首页
|
||||
<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/LiuYuan-SHU" title="Liuyuan">
|
||||
<img src="https://avatars.githubusercontent.com/u/96400967?v=4" width="42;" alt="Liuyuan"/>
|
||||
</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/heStudio-Network" title="醉、倾城">
|
||||
<img src="https://avatars.githubusercontent.com/u/119711513?v=4" width="42;" alt="醉、倾城"/>
|
||||
</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/LufsX" title="LufsX">
|
||||
<img src="https://avatars.githubusercontent.com/u/33221883?v=4" width="42;" alt="LufsX"/>
|
||||
<a href="https://github.com/XYZscratcher" title="XYZ">
|
||||
<img src="https://avatars.githubusercontent.com/u/108533817?v=4" width="42;" alt="XYZ"/>
|
||||
</a>
|
||||
<a href="https://github.com/1834423612" title="kjch">
|
||||
<img src="https://avatars.githubusercontent.com/u/49981661?v=4" width="42;" alt="kjch"/>
|
||||
</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/pangxiaoli" title="pangxiaoli">
|
||||
<img src="https://avatars.githubusercontent.com/u/54620953?v=4" width="42;" alt="pangxiaoli"/>
|
||||
</a>
|
||||
<a href="https://github.com/partoneplay" title="partoneplay">
|
||||
<img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"/>
|
||||
</a>
|
||||
@ -187,11 +264,14 @@ REF_LABEL=网站首页
|
||||
<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/Country-If" title="Maylon">
|
||||
<img src="https://avatars.githubusercontent.com/u/62837275?v=4" width="42;" alt="Maylon"/>
|
||||
</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="dousha">
|
||||
<img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="dousha"/>
|
||||
<a href="https://github.com/dousha0w0" title="dousha0w0">
|
||||
<img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="dousha0w0"/>
|
||||
</a>
|
||||
<a href="https://github.com/Brid9e" title="Brid9e">
|
||||
<img src="https://avatars.githubusercontent.com/u/85558909?v=4" width="42;" alt="Brid9e"/>
|
||||
@ -205,12 +285,21 @@ REF_LABEL=网站首页
|
||||
<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/Damao2250" title="Damao">
|
||||
<img src="https://avatars.githubusercontent.com/u/19251992?v=4" width="42;" alt="Damao"/>
|
||||
</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/eeeeeio" title="EEEEE">
|
||||
<img src="https://avatars.githubusercontent.com/u/20723545?v=4" width="42;" alt="EEEEE"/>
|
||||
</a>
|
||||
<a href="https://github.com/gongyeheyu" title="GONGYE Heyu">
|
||||
<img src="https://avatars.githubusercontent.com/u/85177605?v=4" width="42;" alt="GONGYE Heyu"/>
|
||||
</a>
|
||||
<a href="https://github.com/Ding-Kyoma" title="HooinKyoma">
|
||||
<img src="https://avatars.githubusercontent.com/u/44542198?v=4" width="42;" alt="HooinKyoma"/>
|
||||
</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>
|
||||
@ -229,14 +318,26 @@ REF_LABEL=网站首页
|
||||
<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/malcolmyu" title="Minghao Yu">
|
||||
<img src="https://avatars.githubusercontent.com/u/3203962?v=4" width="42;" alt="Minghao Yu"/>
|
||||
</a>
|
||||
<a href="https://github.com/Mo3et" title="Monet Lee">
|
||||
<img src="https://avatars.githubusercontent.com/u/34803812?v=4" width="42;" alt="Monet Lee"/>
|
||||
</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/Perzch" title="Perzch">
|
||||
<img src="https://avatars.githubusercontent.com/u/67987641?v=4" width="42;" alt="Perzch"/>
|
||||
</a>
|
||||
<a href="https://github.com/PipecraftNet" title="Pipecraft">
|
||||
<img src="https://avatars.githubusercontent.com/u/88728670?v=4" width="42;" alt="Pipecraft"/>
|
||||
</a>
|
||||
<a href="https://github.com/QDelta" title="QDelta">
|
||||
<img src="https://avatars.githubusercontent.com/u/60222316?v=4" width="42;" alt="QDelta"/>
|
||||
<a href="https://github.com/QDelta" title="Jianxing Qin">
|
||||
<img src="https://avatars.githubusercontent.com/u/60222316?v=4" width="42;" alt="Jianxing Qin"/>
|
||||
</a>
|
||||
<a href="https://github.com/qinxiongzhou" title="Ryan Zhou">
|
||||
<img src="https://avatars.githubusercontent.com/u/33239096?v=4" width="42;" alt="Ryan Zhou"/>
|
||||
</a>
|
||||
<a href="https://github.com/whb1998a" title="WHB">
|
||||
<img src="https://avatars.githubusercontent.com/u/44045064?v=4" width="42;" alt="WHB"/>
|
||||
@ -244,9 +345,15 @@ REF_LABEL=网站首页
|
||||
<a href="https://github.com/hi-liyan" title="Yan Li">
|
||||
<img src="https://avatars.githubusercontent.com/u/40056492?v=4" width="42;" alt="Yan Li"/>
|
||||
</a>
|
||||
<a href="https://github.com/yikuaibro" title="YuGan">
|
||||
<img src="https://avatars.githubusercontent.com/u/44493045?v=4" width="42;" alt="YuGan"/>
|
||||
</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/Lmmmmmm-bb" title="_lmmmmmm">
|
||||
<img src="https://avatars.githubusercontent.com/u/54026110?v=4" width="42;" alt="_lmmmmmm"/>
|
||||
</a>
|
||||
<a href="https://github.com/chyok" title="chyok">
|
||||
<img src="https://avatars.githubusercontent.com/u/32629225?v=4" width="42;" alt="chyok"/>
|
||||
</a>
|
||||
@ -256,15 +363,27 @@ REF_LABEL=网站首页
|
||||
<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/fjqz177" title="fjqz177">
|
||||
<img src="https://avatars.githubusercontent.com/u/83070583?v=4" width="42;" alt="fjqz177"/>
|
||||
</a>
|
||||
<a href="https://github.com/gi-b716" title="gi-b716">
|
||||
<img src="https://avatars.githubusercontent.com/u/78394473?v=4" width="42;" alt="gi-b716"/>
|
||||
</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/sunny0826" title="guoxudong">
|
||||
<img src="https://avatars.githubusercontent.com/u/24563928?v=4" width="42;" alt="guoxudong"/>
|
||||
</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/yanxuplay" title="hupilan">
|
||||
<img src="https://avatars.githubusercontent.com/u/69749541?v=4" width="42;" alt="hupilan"/>
|
||||
</a>
|
||||
<a href="https://github.com/hweining" title="hweining">
|
||||
<img src="https://avatars.githubusercontent.com/u/8973985?v=4" width="42;" alt="hweining"/>
|
||||
</a>
|
||||
@ -289,8 +408,8 @@ REF_LABEL=网站首页
|
||||
<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 href="https://github.com/miclon-dev" title="miclon-dev">
|
||||
<img src="https://avatars.githubusercontent.com/u/111753685?v=4" width="42;" alt="miclon-dev"/>
|
||||
</a>
|
||||
<a href="https://github.com/onewesong" title="onewesong">
|
||||
<img src="https://avatars.githubusercontent.com/u/17920822?v=4" width="42;" alt="onewesong"/>
|
||||
@ -313,6 +432,9 @@ REF_LABEL=网站首页
|
||||
<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/LuckyJie12" title="夜未央">
|
||||
<img src="https://avatars.githubusercontent.com/u/102901105?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>
|
||||
|
95
README.md
95
README.md
@ -53,8 +53,9 @@ Quick Reference
|
||||
[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=👆看看还缺点儿什么?-->
|
||||
[Julia](./docs/julia.md)<!--rehype:style=background: rgb(26 188 156);&class=contributing&data-info=👆看看还缺点儿什么?-->
|
||||
[Kotlin](./docs/kotlin.md)<!--rehype:style=background: rgb(211 55 49);&class=contributing&data-info=👆看看还缺点儿什么?-->
|
||||
[Kubernetes](./docs/kubernetes.md)<!--rehype:style=background: rgb(51 113 227);&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);-->
|
||||
@ -147,6 +148,7 @@ Quick Reference
|
||||
[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);-->
|
||||
[ps](./docs/ps.md)<!--rehype:style=background: rgb(99 99 99);-->
|
||||
[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);-->
|
||||
@ -161,6 +163,7 @@ Quick Reference
|
||||
## 数据库
|
||||
|
||||
[MySQL](./docs/mysql.md)<!--rehype:style=background: rgb(1 117 143);&class=tag&data-lang=SQL-->
|
||||
[MongoDB](./docs/mongodb.md)<!--rehype:style=background: rgb(0 237 100);-->
|
||||
[Oracle](./docs/oracle.md)<!--rehype:style=background: rgb(255 0 0);&class=tag&data-lang=SQL-->
|
||||
[PostgreSQL](./docs/postgres.md)<!--rehype:style=background: rgb(43 109 163);&class=tag&data-lang=SQL-->
|
||||
[Redis](./docs/redis.md)<!--rehype:style=background: rgb(198 47 44);-->
|
||||
@ -177,6 +180,7 @@ Quick Reference
|
||||
[Gitlab](./docs/gitlab.md)<!--rehype:style=background: rgb(226 67 41);-->
|
||||
[Google Chrome](./docs/google-chrome.md)<!--rehype:style=background: rgb(29 116 232);-->
|
||||
[IntelliJ IDEA](./docs/intelli-j-idea.md)<!--rehype:style=background: rgb(223 148 0);&class=tag&data-lang=Java-->
|
||||
[PyCharm](./docs/pycharm.md)<!--rehype:style=background: rgb(36 215 137);&class=tag&data-lang=Python-->
|
||||
[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);-->
|
||||
@ -232,18 +236,30 @@ Quick Reference
|
||||
<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/LiuYuan-SHU" title="Liuyuan">
|
||||
<img src="https://avatars.githubusercontent.com/u/96400967?v=4" width="42;" alt="Liuyuan"/>
|
||||
</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/heStudio-Network" title="醉、倾城">
|
||||
<img src="https://avatars.githubusercontent.com/u/119711513?v=4" width="42;" alt="醉、倾城"/>
|
||||
</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/LufsX" title="LufsX">
|
||||
<img src="https://avatars.githubusercontent.com/u/33221883?v=4" width="42;" alt="LufsX"/>
|
||||
<a href="https://github.com/XYZscratcher" title="XYZ">
|
||||
<img src="https://avatars.githubusercontent.com/u/108533817?v=4" width="42;" alt="XYZ"/>
|
||||
</a>
|
||||
<a href="https://github.com/1834423612" title="kjch">
|
||||
<img src="https://avatars.githubusercontent.com/u/49981661?v=4" width="42;" alt="kjch"/>
|
||||
</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/pangxiaoli" title="pangxiaoli">
|
||||
<img src="https://avatars.githubusercontent.com/u/54620953?v=4" width="42;" alt="pangxiaoli"/>
|
||||
</a>
|
||||
<a href="https://github.com/partoneplay" title="partoneplay">
|
||||
<img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"/>
|
||||
</a>
|
||||
@ -256,11 +272,14 @@ Quick Reference
|
||||
<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/Country-If" title="Maylon">
|
||||
<img src="https://avatars.githubusercontent.com/u/62837275?v=4" width="42;" alt="Maylon"/>
|
||||
</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="dousha">
|
||||
<img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="dousha"/>
|
||||
<a href="https://github.com/dousha0w0" title="dousha0w0">
|
||||
<img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="dousha0w0"/>
|
||||
</a>
|
||||
<a href="https://github.com/Brid9e" title="Brid9e">
|
||||
<img src="https://avatars.githubusercontent.com/u/85558909?v=4" width="42;" alt="Brid9e"/>
|
||||
@ -274,12 +293,21 @@ Quick Reference
|
||||
<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/Damao2250" title="Damao">
|
||||
<img src="https://avatars.githubusercontent.com/u/19251992?v=4" width="42;" alt="Damao"/>
|
||||
</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/eeeeeio" title="EEEEE">
|
||||
<img src="https://avatars.githubusercontent.com/u/20723545?v=4" width="42;" alt="EEEEE"/>
|
||||
</a>
|
||||
<a href="https://github.com/gongyeheyu" title="GONGYE Heyu">
|
||||
<img src="https://avatars.githubusercontent.com/u/85177605?v=4" width="42;" alt="GONGYE Heyu"/>
|
||||
</a>
|
||||
<a href="https://github.com/Ding-Kyoma" title="HooinKyoma">
|
||||
<img src="https://avatars.githubusercontent.com/u/44542198?v=4" width="42;" alt="HooinKyoma"/>
|
||||
</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>
|
||||
@ -298,14 +326,26 @@ Quick Reference
|
||||
<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/malcolmyu" title="Minghao Yu">
|
||||
<img src="https://avatars.githubusercontent.com/u/3203962?v=4" width="42;" alt="Minghao Yu"/>
|
||||
</a>
|
||||
<a href="https://github.com/Mo3et" title="Monet Lee">
|
||||
<img src="https://avatars.githubusercontent.com/u/34803812?v=4" width="42;" alt="Monet Lee"/>
|
||||
</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/Perzch" title="Perzch">
|
||||
<img src="https://avatars.githubusercontent.com/u/67987641?v=4" width="42;" alt="Perzch"/>
|
||||
</a>
|
||||
<a href="https://github.com/PipecraftNet" title="Pipecraft">
|
||||
<img src="https://avatars.githubusercontent.com/u/88728670?v=4" width="42;" alt="Pipecraft"/>
|
||||
</a>
|
||||
<a href="https://github.com/QDelta" title="QDelta">
|
||||
<img src="https://avatars.githubusercontent.com/u/60222316?v=4" width="42;" alt="QDelta"/>
|
||||
<a href="https://github.com/QDelta" title="Jianxing Qin">
|
||||
<img src="https://avatars.githubusercontent.com/u/60222316?v=4" width="42;" alt="Jianxing Qin"/>
|
||||
</a>
|
||||
<a href="https://github.com/qinxiongzhou" title="Ryan Zhou">
|
||||
<img src="https://avatars.githubusercontent.com/u/33239096?v=4" width="42;" alt="Ryan Zhou"/>
|
||||
</a>
|
||||
<a href="https://github.com/whb1998a" title="WHB">
|
||||
<img src="https://avatars.githubusercontent.com/u/44045064?v=4" width="42;" alt="WHB"/>
|
||||
@ -313,9 +353,15 @@ Quick Reference
|
||||
<a href="https://github.com/hi-liyan" title="Yan Li">
|
||||
<img src="https://avatars.githubusercontent.com/u/40056492?v=4" width="42;" alt="Yan Li"/>
|
||||
</a>
|
||||
<a href="https://github.com/yikuaibro" title="YuGan">
|
||||
<img src="https://avatars.githubusercontent.com/u/44493045?v=4" width="42;" alt="YuGan"/>
|
||||
</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/Lmmmmmm-bb" title="_lmmmmmm">
|
||||
<img src="https://avatars.githubusercontent.com/u/54026110?v=4" width="42;" alt="_lmmmmmm"/>
|
||||
</a>
|
||||
<a href="https://github.com/chyok" title="chyok">
|
||||
<img src="https://avatars.githubusercontent.com/u/32629225?v=4" width="42;" alt="chyok"/>
|
||||
</a>
|
||||
@ -325,15 +371,27 @@ Quick Reference
|
||||
<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/fjqz177" title="fjqz177">
|
||||
<img src="https://avatars.githubusercontent.com/u/83070583?v=4" width="42;" alt="fjqz177"/>
|
||||
</a>
|
||||
<a href="https://github.com/gi-b716" title="gi-b716">
|
||||
<img src="https://avatars.githubusercontent.com/u/78394473?v=4" width="42;" alt="gi-b716"/>
|
||||
</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/sunny0826" title="guoxudong">
|
||||
<img src="https://avatars.githubusercontent.com/u/24563928?v=4" width="42;" alt="guoxudong"/>
|
||||
</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/yanxuplay" title="hupilan">
|
||||
<img src="https://avatars.githubusercontent.com/u/69749541?v=4" width="42;" alt="hupilan"/>
|
||||
</a>
|
||||
<a href="https://github.com/hweining" title="hweining">
|
||||
<img src="https://avatars.githubusercontent.com/u/8973985?v=4" width="42;" alt="hweining"/>
|
||||
</a>
|
||||
@ -358,8 +416,8 @@ Quick Reference
|
||||
<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 href="https://github.com/miclon-dev" title="miclon-dev">
|
||||
<img src="https://avatars.githubusercontent.com/u/111753685?v=4" width="42;" alt="miclon-dev"/>
|
||||
</a>
|
||||
<a href="https://github.com/onewesong" title="onewesong">
|
||||
<img src="https://avatars.githubusercontent.com/u/17920822?v=4" width="42;" alt="onewesong"/>
|
||||
@ -382,6 +440,9 @@ Quick Reference
|
||||
<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/LuckyJie12" title="夜未央">
|
||||
<img src="https://avatars.githubusercontent.com/u/102901105?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>
|
||||
@ -404,7 +465,7 @@ Quick Reference
|
||||
[laoleng.vip](http://bbs.laoleng.vip/reference/)<!--rehype:target=_blank-->
|
||||
[liujiapeng.com](https://www.liujiapeng.com/)<!--rehype:target=_blank-->
|
||||
[dbyun.net](https://www.dbyun.net/reference/index.html)<!--rehype:target=_blank-->
|
||||
[dc6.fun](https://dc6.fun/reference/)<!--rehype:target=_blank-->
|
||||
[dc6.fun](http://reference.dc6.fun)<!--rehype:target=_blank-->
|
||||
[if010.com](https://quickref.if010.com/)<!--rehype:target=_blank-->
|
||||
[pipecraft.net](https://quickref.pipecraft.net/)<!--rehype:target=_blank&class=contributing&data-info=👆需要梯子-->
|
||||
[isteed.cc](https://ref.isteed.cc/)<!--rehype:target=_blank-->
|
||||
@ -412,17 +473,25 @@ Quick Reference
|
||||
[linzhe.top](https://linzhe.top/)<!--rehype:target=_blank-->
|
||||
[xushanxiang.com](https://xushanxiang.com/ref/)<!--rehype:target=_blank-->
|
||||
[winnerzr01.github.io](https://winnerzr01.github.io/Quick-Reference/index.html)<!--rehype:target=_blank&class=contributing&data-info=👆需要梯子-->
|
||||
[isteed.cc](https://ref.isteed.cc/)<!--rehype:target=_blank-->
|
||||
[quickref.hestudio.org](https://quickref.hestudio.org)<!--rehype:target=_blank&class=contributing&data-info=👆整点自动同步-->
|
||||
[hestudio.org](https://quickref.hestudio.org)<!--rehype:target=_blank&class=contributing&data-info=👆整点自动同步-->
|
||||
[surcode.cn](https://ref.surcode.cn)<!--rehype:target=_blank-->
|
||||
[cms.im](https://quickref.cms.im/)<!--rehype:target=_blank-->
|
||||
[nuomiphp.com](https://reference.tool.nuomiphp.com/)<!--rehype:target=_blank-->
|
||||
[eryajf.net](https://ref.eryajf.net/)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[kjchmc.cn](https://ref.kjchmc.cn/)<!--rehype:target=_blank&class=contributing&data-info=👆实时同步,多线路-->
|
||||
[likeadmin.cn](https://www.likeadmin.cn/quickref/)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[qiubit.cc](http://ref.qiubit.cc)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[aoh.cc](https://aoh.cc/)<!--rehype:target=_blank-->
|
||||
[reference.code05.com](https://reference.code05.com/)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[kyoma.top](https://reference.kyoma.top/)<!--rehype:target=_blank&class=contributing&data-info=👆实时同步-->
|
||||
[quickreference.pages.dev](https://quickreference.pages.dev/)<!--rehype:target=_blank-->
|
||||
[code05.com](https://reference.code05.com/)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[xhfun.cn](https://ref.xhfun.cn/)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[caitou.org](https://quickref.caitou.org/)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[guoxudong.io](https://reference.guoxudong.io/)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
<!--rehype:class=home-card home-links-->
|
||||
|
||||
如果你有资源,可以很方便部署 web 版,这非常简单,只需要克隆 [gh-pages](https://github.com/jaywcjlove/reference/tree/gh-pages) 分支代码到你的静态服务就可以了,还可以使用 [docker](https://hub.docker.com/r/wcjiang/reference) 快捷部署 web 版。
|
||||
如果你有资源,可以很方便[部署 web 版](https://github.com/jaywcjlove/reference/issues/102#issue-1451649637),这非常简单,只需要克隆 [gh-pages](https://github.com/jaywcjlove/reference/tree/gh-pages) 分支代码到你的静态服务就可以了,还可以使用 [docker](https://hub.docker.com/r/wcjiang/reference) 快捷部署 web 版。
|
||||
|
||||
<!--rehype:ignore:start-->
|
||||
## License
|
||||
|
5
assets/kubernetes.svg
Normal file
5
assets/kubernetes.svg
Normal file
@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" height="1em" width="1em">
|
||||
<path d="m10.013 13.738-2.254.387a4.475 4.475 0 0 0 1.753 2.231l.865-2.095a.27.27 0 0 0 .022-.228c-.022-.18-.204-.295-.386-.295zm.865-2.914c.205 0 .387-.159.387-.364l.114-2.277-.456.091a4.516 4.516 0 0 0-2.118 1.162l1.89 1.343c.069.022.115.045.183.045zm-1.002 1.48a.366.366 0 0 0-.045-.524l-1.685-1.503a4.797 4.797 0 0 0-.661 2.778l2.209-.637c.091-.023.137-.046.182-.114zm1.457.797.616.296.614-.296.16-.661-.433-.546h-.683l-.433.546zm1.344-2.436c.114.159.341.182.5.091l1.867-1.32a4.286 4.286 0 0 0-2.573-1.23l.137 2.3a.215.215 0 0 0 .069.159z"/>
|
||||
<path d="m21.944 14.103-1.73-7.446c-.113-.364-.387-.66-.729-.842L12.541 2.49c-.182-.091-.387-.114-.569-.114s-.387 0-.569.045L4.457 5.769a1.22 1.22 0 0 0-.683.842l-1.708 7.492c-.068.387.023.774.25 1.093l4.805 5.943c.273.273.66.456 1.047.479h7.651c.41.045.797-.137 1.048-.479l4.805-5.943c.227-.319.318-.706.272-1.093zm-2.845.501c-.046 0-.068 0-.114-.023-.022-.023-.022-.023-.045-.023-.046 0-.068-.022-.092-.022-.091-.023-.159-.068-.25-.114a.32.32 0 0 1-.137-.045h-.022a3.91 3.91 0 0 0-.729-.205h-.022a.26.26 0 0 0-.182.068s0 .023-.023.023l-.183-.024a5.628 5.628 0 0 1-2.46 3.097l.068.182s-.022 0-.022.022a.264.264 0 0 0-.022.228c.091.228.205.455.364.66v.045a.396.396 0 0 1 .091.114.81.81 0 0 1 .159.228c.023.022.046.045.046.068 0 0 .022 0 .022.022a.582.582 0 0 1 .023.342.38.38 0 0 1-.205.25c-.068.022-.114.045-.183.045a.511.511 0 0 1-.433-.273c-.022 0-.022-.022-.022-.022-.022-.023-.022-.045-.046-.068-.045-.068-.068-.159-.091-.25l-.046-.137v-.022a3.816 3.816 0 0 0-.296-.706.353.353 0 0 0-.182-.137c0-.023 0-.023-.023-.023l-.091-.159c-.228.068-.479.159-.729.205-.41.114-.82.159-1.229.159a5.368 5.368 0 0 1-1.981-.364l-.091.182c0 .023 0 .023-.023.023a.35.35 0 0 0-.182.137c-.114.228-.228.455-.296.706l-.045.137c-.023.091-.068.159-.091.25-.022.023-.045.045-.045.068-.023 0-.023.022-.023.022a.508.508 0 0 1-.433.273.434.434 0 0 1-.159-.045.469.469 0 0 1-.182-.615c.023 0 .023-.023.023-.023.022-.023.022-.045.045-.068.068-.091.114-.182.159-.228s.068-.068.091-.114v-.023a3.73 3.73 0 0 0 .364-.66.268.268 0 0 0-.023-.228s-.022 0-.022-.022l.114-.16a3.578 3.578 0 0 1-.615-.41 5.493 5.493 0 0 1-1.867-2.664l-.205.022s0-.022-.023-.022a.256.256 0 0 0-.182-.068h-.022a4.015 4.015 0 0 0-.751.205h-.024c-.045 0-.091.023-.137.046-.068.022-.159.068-.25.091-.022 0-.091-.022-.091 0 0 .023 0 .023-.023.023-.045.023-.068.023-.114.023a.424.424 0 0 1-.456-.319.445.445 0 0 1 .364-.524c.023-.023.023-.023.046-.023.045 0 .068-.022.091-.022.091 0 .182-.023.273-.023.045-.022.091-.022.137-.022a4.2 4.2 0 0 0 .774-.137c.068-.046.137-.091.16-.16 0 0 .022 0 .022-.022l.182-.046c-.205-1.298.091-2.618.797-3.734.022-.045.045-.068.068-.114l-.131-.132a.106.106 0 0 1-.004.019v-.023l.004.004c.01-.065-.031-.145-.072-.186-.182-.182-.41-.319-.638-.455l-.136-.069a2.587 2.587 0 0 1-.251-.136c-.022 0-.068-.045-.068-.045s0-.023-.022-.023a.49.49 0 0 1-.092-.639c.068-.114.182-.159.319-.159a.54.54 0 0 1 .319.114l.023.023c.022.022.045.022.068.045.068.069.114.137.182.205.023.022.068.045.091.091.159.182.364.364.569.524.045.022.091.045.137.045.045 0 .068-.023.091-.023h.023l.137.091a5.426 5.426 0 0 1 2.801-1.594c.273-.046.523-.091.774-.114l.023-.182v-.045c.068-.045.091-.114.114-.182 0-.273 0-.524-.045-.774v-.023c0-.045 0-.091-.023-.137a1.129 1.129 0 0 1-.045-.273v-.113c0-.114.045-.228.137-.319.114-.114.25-.182.387-.159a.45.45 0 0 1 .387.478v.137c-.023.091-.023.182-.045.273 0 .045-.023.091-.023.136v.023c-.048.273-.048.524-.048.774.023.068.045.136.114.182v-.023l.023.182a5.84 5.84 0 0 1 2.96 1.184c.183.182.387.364.569.546l.183-.114h.022c.022.023.068.023.091.023.046 0 .091-.023.137-.045.205-.137.41-.319.569-.501.022-.023.068-.046.091-.091.046-.068.114-.137.183-.205.022 0 .045-.022.068-.045l.022-.023a.546.546 0 0 1 .318-.114c.114 0 .251.068.319.16.159.205.113.478-.091.637 0 .023.022.023 0 .046-.023.022-.046.022-.068.045-.092.045-.16.091-.251.137l-.137.068a4.104 4.104 0 0 0-.638.455c-.045.046-.068.137-.068.205v.023l-.136.137c.364.569.638 1.207.797 1.867.137.66.182 1.343.091 2.003l.182.046a.278.278 0 0 0 .16.159c.25.068.523.114.773.137h.023a.297.297 0 0 0 .137.022c.091 0 .182 0 .272.023.046 0 .092 0 .092.023 0 .022.022.022.045.022a.537.537 0 0 1 .41.479.49.49 0 0 1-.453.32z"/>
|
||||
<path d="M12.085 14.718a.352.352 0 0 0-.455.091l-1.116 2.027c.456.136.957.228 1.435.228.341 0 .66-.045.979-.114.159-.045.296-.068.433-.091l-1.093-1.981c-.069-.069-.115-.115-.183-.16zm3.644-4.441-1.708 1.548a.36.36 0 0 0-.091.16c-.046.205.068.41.273.455l2.163.615a4.375 4.375 0 0 0-.092-1.435 4.63 4.63 0 0 0-.545-1.343zm-2.073 3.484a.371.371 0 0 0-.205.433l.889 2.141a4.366 4.366 0 0 0 1.366-1.366c.182-.25.318-.547.433-.865l-2.277-.387a.634.634 0 0 0-.206.044z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 4.7 KiB |
3
assets/mongodb.svg
Normal file
3
assets/mongodb.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg viewBox="0 0 120 257" fill="none" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
|
||||
<path d="M82.323 28.644C71.537 15.847 62.249 2.85 60.35.15c-.2-.2-.5-.2-.7 0-1.897 2.7-11.185 15.697-21.971 28.494C-54.902 146.721 52.26 226.406 52.26 226.406l.9.6C53.958 239.303 55.955 257 55.955 257h7.99s1.998-17.597 2.797-29.994l.899-.7c.1.1 107.263-79.585 14.68-197.662ZM59.95 224.606s-4.793-4.099-6.092-6.198v-.201l5.793-128.574c0-.4.6-.4.6 0l5.792 128.574v.201c-1.299 2.099-6.093 6.198-6.093 6.198Z" fill="currentColor"/>
|
||||
</svg>
|
After Width: | Height: | Size: 537 B |
3
assets/pycharm.svg
Normal file
3
assets/pycharm.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em">
|
||||
<path d="M7.833 6.666v-.055c0-1-.667-1.5-1.778-1.5H4.389v3.055h1.723c1.111 0 1.721-.666 1.721-1.5zM0 0v24h24V0H0zm2.223 3.167h4c2.389 0 3.833 1.389 3.833 3.445v.055c0 2.278-1.778 3.5-4.001 3.5H4.389v2.945H2.223V3.167zM11.277 21h-9v-1.5h9V21zm4.779-7.777c-2.944.055-5.111-2.223-5.111-5.057C10.944 5.333 13.056 3 16.111 3c1.889 0 3 .611 3.944 1.556l-1.389 1.61c-.778-.722-1.556-1.111-2.556-1.111-1.658 0-2.873 1.375-2.887 3.084.014 1.709 1.174 3.083 2.887 3.083 1.111 0 1.833-.445 2.61-1.167l1.39 1.389c-.999 1.112-2.166 1.779-4.054 1.779z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 656 B |
131
docs/adb.md
131
docs/adb.md
@ -1,7 +1,7 @@
|
||||
Android ADB 备忘清单
|
||||
Android Debug Bridge 备忘清单
|
||||
===
|
||||
|
||||
[ADB](https://developer.android.com/studio/command-line/adb.html),Android Debug Bridge,包含在 Google 的 Android SDK 中,可用于从计算机控制您的 Android 设备。以下是您可以与 [ADB](https://developer.android.com/studio/command-line/adb.html) 一起使用的一些最常见的命令及其用法
|
||||
[ADB](https://developer.android.com/studio/command-line/adb.html) 既 Android Debug Bridge,是 Google 的 Android SDK 中的一个命令行工具,可让您的计算机控制 Android 设备执行各种设备操作。以下是您可以与 [ADB](https://developer.android.com/studio/command-line/adb.html) 一起使用的一些最常见的命令及其用法
|
||||
|
||||
入门
|
||||
----
|
||||
@ -11,15 +11,18 @@ Android ADB 备忘清单
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb devices` | 列出连接的设备
|
||||
`adb devices -l` | 列出连接的设备和种类
|
||||
`adb devices` | 列出已连接的设备
|
||||
`adb devices -l` | 列出已连接的设备和种类
|
||||
`adb connect [IP:PORT]` | 连接到指定 IP 和端口的设备
|
||||
`adb disconnect [IP:PORT]` | 断开指定 IP 和端口的设备连接,若未指定,则断开所有连接
|
||||
`adb root` | 以 `root` 权限重新启动 `adbd`
|
||||
`adb start-server` | 启动 `adb` 服务器
|
||||
`adb kill-server` | 杀死 `adb` 服务器
|
||||
`adb start-server` | 启动 `adb` 服务
|
||||
`adb kill-server` | 停止 `adb` 服务器
|
||||
`adb remount` | 重新挂载具有读/写访问权限的文件系统
|
||||
`adb reboot` | 重启设备
|
||||
`adb reboot bootloader` | 将设备重新启动到快速启动
|
||||
`adb disable-verity` | 将设备重新启动到快速启动
|
||||
`adb reboot bootloader` | 将设备重启到 fastboot 模式
|
||||
`adb reboot recovery` | 将设备重启到恢复模式
|
||||
`adb disable-verity` | 禁用设备的 dm-verity 安全特性
|
||||
<!--rehype:className=left-align code-nowrap-->
|
||||
|
||||
---
|
||||
@ -45,12 +48,12 @@ $ adb -s somedevice-1234 root
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb logcat` | 开始将日志消息打印到标准输出
|
||||
`adb logcat` | 将日志消息打印到标准输出
|
||||
`adb logcat -g` | 显示当前日志缓冲区大小
|
||||
`adb logcat -G <size>` | 设置缓冲区大小(K 或 M)
|
||||
`adb logcat -c` | 清除日志缓冲区
|
||||
`adb logcat *:V` | 启用所有日志消息(详细)
|
||||
`adb logcat -f <filename>` | 转储到指定文件
|
||||
`adb logcat -f <filename>` | 将日志转储到指定文件
|
||||
<!--rehype:className=left-align code-nowrap-->
|
||||
|
||||
#### 示例
|
||||
@ -62,16 +65,16 @@ $ adb logcat *:V > output.log
|
||||
|
||||
#### 过滤日志输出
|
||||
|
||||
- `V` 详细(最低优先级)
|
||||
- `D` 调试
|
||||
- `I` 信息
|
||||
- `W` 警告
|
||||
- `E` 错误
|
||||
- `F` 严重错误
|
||||
- `V` 最详细的信息(最低优先级)
|
||||
- `D` 调试信息
|
||||
- `I` 普通信息
|
||||
- `W` 警告信息
|
||||
- `E` 错误信息
|
||||
- `F` 致命错误信息
|
||||
- `S` 静默(最高优先级)
|
||||
<!--rehype:className=cols-2 shortcuts style-none-->
|
||||
|
||||
过滤器表达式显示了优先级不低于 `警告` 的所有标记的所有日志消息:
|
||||
例如,要显示优先级不低于 `警告` 的所有标记的所有日志消息,可以使用以下命令:
|
||||
|
||||
```bash
|
||||
$ adb logcat *:W
|
||||
@ -81,8 +84,8 @@ $ adb logcat *:W
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb push <local> <remote>` | 将本地复制到远程设备
|
||||
`adb pull <remote> <local>` | 将远程设备从设备复制到本地
|
||||
`adb push <local> <remote>` | 将本地文件复制到远程设备
|
||||
`adb pull <remote> <local>` | 将远程设备文件复制到本地
|
||||
<!--rehype:className=left-align code-nowrap-->
|
||||
|
||||
#### 示例
|
||||
@ -97,22 +100,22 @@ $ adb pull /sdcard/test.txt pulledTest.txt
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb shell <command>` | 在设备上运行指定的命令(大多数 unix 命令在这里工作)
|
||||
`adb shell <command>` | 在设备上运行指定的命令(大多数 Unix 命令在这里工作)
|
||||
`adb shell wm size` | 显示当前屏幕分辨率
|
||||
`adb shell wm size WxH` | 将分辨率设置为 WxH
|
||||
`adb shell pm list packages` | 列出所有已安装的包
|
||||
`adb shell pm list packages -3` | 列出所有已安装的 3rd 方包
|
||||
`adb shell monkey -p app.package.name` | 启动指定包
|
||||
`adb shell pm list packages` | 列出所有已安装的应用包
|
||||
`adb shell pm list packages -3` | 列出所有已安装的第三方的应用包
|
||||
`adb shell monkey -p app.package.name` | 启动指定包名的应用程序
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### 包安装
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb shell install <apk>` | 安装应用程序
|
||||
`adb shell install <path>` | 手机路径安装应用
|
||||
`adb shell install -r <path>` | 手机路径安装应用
|
||||
`adb shell uninstall <name>` | 删除应用程序
|
||||
`adb shell install <apk>` | 安装应用程序
|
||||
`adb shell install <path>` | 从手机路径安装应用
|
||||
`adb shell install -r <path>` | 从手机路径安装应用(允许覆盖安装)
|
||||
`adb shell uninstall <name>` | 卸载应用程序
|
||||
<!--rehype:className=left-align code-nowrap-->
|
||||
|
||||
### Paths
|
||||
@ -121,10 +124,10 @@ $ adb pull /sdcard/test.txt pulledTest.txt
|
||||
:-- | --
|
||||
:-- | --
|
||||
`/data/data/<package>/databases` | 应用程序数据库
|
||||
`/data/data/<package>/shared_prefs/` | 共享偏好
|
||||
`/data/app` | 用户安装的apk
|
||||
`/system/app` | 预装的 APK 文件
|
||||
`/mmt/asec` | 加密的应用程序\|App2SD
|
||||
`/data/data/<package>/shared_prefs/` | 共享偏好设置
|
||||
`/data/app` | 用户安装的 APK
|
||||
`/system/app` | 系统预装的 APK 文件
|
||||
`/mmt/asec` | 加密的应用程序(App2SD)
|
||||
`/mmt/emmc` | 内部 SD 卡
|
||||
`/mmt/adcard` | 外部/内部 SD 卡
|
||||
`/mmt/adcard/external_sd` | 外置 SD 卡
|
||||
@ -145,17 +148,17 @@ $ adb pull /sdcard/test.txt pulledTest.txt
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb get-statе` | 打印设备状态
|
||||
`adb get-serialno` | 获取序列号
|
||||
`adb shell dumpsys iphonesybinfo` | 获取 IMEI
|
||||
`adb shell netstat` | 列出 TCP 连接
|
||||
`adb get-serialno` | 获取设备的序列号
|
||||
`adb shell dumpsys iphonesybinfo` | 获取设备的 IMEI 信息
|
||||
`adb shell netstat` | 列出设备上的所有 TCP 连接
|
||||
`adb shell pwd` | 打印当前工作目录
|
||||
`adb shell dumpsys battery` | 电池状态
|
||||
`adb shell pm list features` | 列出电话功能
|
||||
`adb shell service list` | 列出所有服务
|
||||
`adb shell dumpsys activity <package>/<activity>` | 活动信息
|
||||
`adb shell ps` | 打印进程状态
|
||||
`adb shell wm size` | 显示当前屏幕分辨率
|
||||
`dumpsys window windows` \| `grep -E 'mCurrentFocus\|mFocusedApp'` | 打印当前应用程序的打开活动
|
||||
`adb shell dumpsys battery` | 获取设备电池状态
|
||||
`adb shell pm list features` |列出设备支持的所有功能
|
||||
`adb shell service list` | 列出设备上运行的所有服务
|
||||
`adb shell dumpsys activity <package>/<activity>` | 获取指定包和活动的信息
|
||||
`adb shell ps` | 打印设备上所有运行的进程状态
|
||||
`adb shell wm size` | 显示当前设备的屏幕分辨率
|
||||
`dumpsys window windows` \| `grep -E 'mCurrentFocus\|mFocusedApp'` | 打印当前应用程序的打开活动的信息
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### 包信息
|
||||
@ -168,8 +171,8 @@ $ adb pull /sdcard/test.txt pulledTest.txt
|
||||
`adb shell list packages -s` | 仅列出系统包
|
||||
`adb shell list packages -u` | 列出包名称 + 已卸载
|
||||
`adb shell dumpsys package packages` | 列出所有应用程序的信息
|
||||
`adb shell dump <name>` | 列出一个包裹的信息
|
||||
`adb shell path <package>` | apk文件的路径
|
||||
`adb shell dump <name>` | 列出一个包的信息
|
||||
`adb shell path <package>` | 列出 APK 文件的路径
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### 设备相关命令
|
||||
@ -177,7 +180,7 @@ $ adb pull /sdcard/test.txt pulledTest.txt
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb reboot-recovery` | 重启设备进入恢复模式
|
||||
`adb reboot recovery` | 重启设备进入恢复模式
|
||||
`adb reboot fastboot` | 重启设备进入恢复模式
|
||||
`adb shell screencap -p "/path/to/screenshot.png"` | 截图
|
||||
`adb shell screenrecord "/path/to/record.mp4"` | 录制设备屏幕
|
||||
@ -193,8 +196,8 @@ $ adb pull /sdcard/test.txt pulledTest.txt
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb shell permissions groups` | 列出权限组定义
|
||||
`adb shell list permissions -g -r` | 列出权限详细信息
|
||||
`adb shell permissions groups` | 列出所有已定义的权限组
|
||||
`adb shell list permissions -g -r` | 列出了所有权限的详细信息
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### Logs
|
||||
@ -211,7 +214,7 @@ $ adb pull /sdcard/test.txt pulledTest.txt
|
||||
### 将文件推送到 Android 设备的下载文件夹
|
||||
|
||||
```bash
|
||||
$ adb push example.apk /mnt/Download/
|
||||
$ adb push example.apk /sdcard/Download/
|
||||
```
|
||||
|
||||
### 列出所有已安装的包并获取完整路径
|
||||
@ -223,19 +226,19 @@ $ adb shell pm list packages -f
|
||||
### 从安卓设备中提取文件
|
||||
|
||||
```bash
|
||||
$ adb pull /mnt/Download/example.apk
|
||||
$ adb pull /sdcard/Download/example.apk
|
||||
```
|
||||
|
||||
### 从主机安装 apk 到 Android 设备
|
||||
### 从主机安装 APK 到 Android 设备
|
||||
|
||||
```bash
|
||||
$ adb shell install example.apk
|
||||
```
|
||||
|
||||
### 从 Android 设备存储安装 apk
|
||||
### 从 Android 设备存储安装 APK
|
||||
|
||||
```bash
|
||||
$ adb shell install /mnt/Download/example.apk
|
||||
$ adb shell install /sdcard/Download/example.apk
|
||||
```
|
||||
|
||||
### 设置网络代理
|
||||
@ -250,7 +253,7 @@ $ adb shell settings put global http_proxy <address>:<port>
|
||||
$ adb shell settings put global http_proxy :0
|
||||
```
|
||||
|
||||
### 显示连接的设备并选择一个设备和外壳
|
||||
### 显示连接的设备并指定一个设备进行 Shell
|
||||
|
||||
```bash
|
||||
$ adb devices
|
||||
@ -259,16 +262,16 @@ $ adb -s 7f1c864e shell
|
||||
|
||||
`7f1c864e` 是设备 `ID`
|
||||
|
||||
### 通过 ip 地址无线连接到设备
|
||||
### 通过 IP 地址连接到设备
|
||||
|
||||
```bash
|
||||
$ adb connect 192.168.56.101:5555
|
||||
```
|
||||
|
||||
### adb 通过 wifi
|
||||
### 通过 Wi-Fi 连接 ADB
|
||||
<!--rehype:wrap-class=row-span-5-->
|
||||
|
||||
我们可以通过 `wifi` 或专门使用 `tcp` 连接使用 `adb`。 要通过 `wifi` 使用 `adb`,首先通过 `usb` 连接手机并启用 `usb` 调试。然后列出所有设备:
|
||||
我们可以通过 `Wi-Fi` 或专门使用 `tcp` 连接使用 `adb`。 要通过 `Wi-Fi` 使用 `adb`,首先通过 `USB` 连接手机并启用 `USB` 调试。然后列出所有设备:
|
||||
|
||||
```bash
|
||||
$ adb devices
|
||||
@ -276,7 +279,7 @@ $ adb devices
|
||||
# device_id device
|
||||
```
|
||||
|
||||
现在检查 `android` 设备的 `ip`:
|
||||
现在检查 `Android` 设备的 `IP`:
|
||||
|
||||
```bash
|
||||
$ adb shell ifconfig
|
||||
@ -286,7 +289,7 @@ wlan0 Link encap:UNSPEC Driver icnss
|
||||
inet addr:XXX.XXX.X.XX Bcast:XXX.XXX.X.XXX
|
||||
```
|
||||
|
||||
记下 `inet addr` 后面的 `ip` 地址。我们稍后会需要它。现在在某个端口重新启动 `tcpip`:
|
||||
记下 `inet addr` 后的 `IP` 地址。稍后要用。现在在某个端口重新启动 `tcpip`:
|
||||
|
||||
```bash
|
||||
$ adb tcpip $port
|
||||
@ -298,25 +301,25 @@ $ adb tcpip $port
|
||||
$ adb tcpip 5555
|
||||
```
|
||||
|
||||
您现在可以断开使用。 现在连接到设备只需给出以下命令:
|
||||
您现在可以断开 USB 线缆使用。 若要连接到设备请键入以下命令:
|
||||
|
||||
```bash
|
||||
$ adb connect $ip:$port
|
||||
```
|
||||
|
||||
like:
|
||||
例如:
|
||||
|
||||
```bash
|
||||
$ adb connect 192.168.1.4:5555
|
||||
```
|
||||
|
||||
### 从计算机上的 apk 文件安装应用程序
|
||||
### 将计算机上的 APK 文件安装到设备
|
||||
|
||||
```bash
|
||||
$ adb install /Users/dev/projects/myapp.apk
|
||||
```
|
||||
|
||||
### 查找应用的 apk 路径
|
||||
### 查找应用的 APK 路径
|
||||
|
||||
```bash
|
||||
$ adb shell pm path com.example.myapp
|
||||
@ -324,13 +327,13 @@ $ adb shell pm path com.example.myapp
|
||||
|
||||
将 `com.example.myapp` 替换为您自己的应用程序包名称
|
||||
|
||||
### 按名称查找应用的包名
|
||||
### 通过名称查找应用的包名
|
||||
|
||||
```bash
|
||||
$ adb shell pm list package | grep app_name
|
||||
```
|
||||
|
||||
### 将 apk 从设备提取到您的计算机
|
||||
### 从设备提取 APK 到您的计算机
|
||||
|
||||
```bash
|
||||
$ adb pull /data/app/com.example.myapp.apk ./
|
||||
@ -366,7 +369,7 @@ $ adb shell input keyevent 66
|
||||
|
||||
### 发送点击
|
||||
|
||||
点击又名点击屏幕:
|
||||
点击屏幕:
|
||||
|
||||
```bash
|
||||
$ adb shell input tap x y
|
||||
|
410
docs/cpp.md
410
docs/cpp.md
@ -545,6 +545,416 @@ int main() {
|
||||
}
|
||||
```
|
||||
|
||||
### Lambda 表达式
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
Lambda 表达式可以在函数内定义,可以理解为在函数内定义的临时函数。格式:
|
||||
|
||||
```cpp
|
||||
auto func = []() -> return_type { };
|
||||
```
|
||||
|
||||
- `[]`为捕获列表,能够捕获其所在函数的局部变量
|
||||
- 一个空的捕获列表代表Lambda表达式不捕获任何的变量
|
||||
- 对于值捕获,直接在中括号中填写要捕获的变量即可:
|
||||
|
||||
```cpp
|
||||
int val = 5;
|
||||
auto func = [val]() -> return_type { };
|
||||
```
|
||||
|
||||
- 对于引用捕获,需要在捕获的变量前添加`&`:
|
||||
|
||||
```cpp
|
||||
string str("hello world!");
|
||||
auto func = [&str]() -> return_type { };
|
||||
```
|
||||
|
||||
- 如果变量太多,需要编译器根据我们编写的代码自动捕获,可以采用隐式捕获的方式。
|
||||
|
||||
- 全部值捕获:
|
||||
|
||||
```cpp
|
||||
int val1, val2;
|
||||
auto func = [=]() -> int
|
||||
{
|
||||
return val1 + val2;
|
||||
};
|
||||
```
|
||||
|
||||
- 全部引用捕获:
|
||||
|
||||
```cpp
|
||||
string str1("hello"), str2("word!");
|
||||
auto func = [&]() -> string
|
||||
{
|
||||
return str1 + str2;
|
||||
};
|
||||
```
|
||||
|
||||
- 混合隐式捕获:
|
||||
|
||||
如果希望对一部分变量采用值捕获,对其他变量采用引用捕获,可以混合使用:
|
||||
|
||||
```cpp
|
||||
int val1 = 123, val2 = 456;
|
||||
string str1("123"), str2(456);
|
||||
|
||||
auto func1 = [=, &str1]() -> int
|
||||
{
|
||||
return val1 == std::stoi(str1)
|
||||
? val1 : val2;
|
||||
};
|
||||
|
||||
auto func2 = [&, val1]() -> int
|
||||
{
|
||||
return str1 == std::to_string(val1)
|
||||
? str1 : str2;
|
||||
};
|
||||
```
|
||||
|
||||
- `()` 是参数列表,我们只需要按照普通函数的使用方法来使用即可
|
||||
- `return_type` 是函数的返回类型,`-> return_type` 可以不写,编译器会自动推导
|
||||
- `{}` 中的内容就是函数体,依照普通函数的使用方法使用即可
|
||||
<!--rehype:className=style-timeline-->
|
||||
|
||||
此处给出一个 Lambda 表达式的实际使用例子(当然可以使用 `str::copy`):
|
||||
|
||||
```cpp
|
||||
// vec中包含1, 2, 3, 4, 5
|
||||
std::vector<int> vec({1, 2, 3, 4, 5});
|
||||
std::for_each(vec.begin(), vec.end(),
|
||||
[](int& ele) -> void
|
||||
{
|
||||
std::cout << ele
|
||||
<< " ";
|
||||
});
|
||||
```
|
||||
|
||||
## C++多线程
|
||||
|
||||
### 多线程介绍
|
||||
|
||||
g++编译选项:`-std=c++11`。包含头文件:
|
||||
|
||||
- `#include <thread>`:C++多线程库
|
||||
- `#include <mutex>`:C++互斥量库
|
||||
- `#include <future>`:C++异步库
|
||||
|
||||
### 线程的创建
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
以普通函数作为线程入口函数:
|
||||
|
||||
```cpp
|
||||
void entry_1() { }
|
||||
void entry_2(int val) { }
|
||||
|
||||
std::thread my_thread_1(entry_1);
|
||||
std::thread my_thread_2(entry_2, 5);
|
||||
```
|
||||
|
||||
以类对象作为线程入口函数:
|
||||
|
||||
```cpp
|
||||
class Entry
|
||||
{
|
||||
void operator()() { }
|
||||
void entry_function() { }
|
||||
};
|
||||
|
||||
Entry entry;
|
||||
// 调用operator()()
|
||||
std::thread my_thread_1(entry);
|
||||
// 调用Entry::entry_function
|
||||
std::thread my_thread_2(&Entry::entry_function, &entry);
|
||||
```
|
||||
|
||||
以lambda表达式作为线程入口函数:
|
||||
|
||||
```cpp
|
||||
std::thread my_thread([]() -> void
|
||||
{
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
### 线程的销毁
|
||||
|
||||
```cpp
|
||||
thread my_thread;
|
||||
// 阻塞
|
||||
my_thread.join();
|
||||
// 非阻塞
|
||||
my_thread.detach();
|
||||
```
|
||||
|
||||
### `this_thread`
|
||||
|
||||
```cpp
|
||||
// 获取当前线程ID
|
||||
std::this_thread::get_id();
|
||||
// 使当前线程休眠一段指定时间
|
||||
std::this_thread::sleep_for();
|
||||
// 使当前线程休眠到指定时间
|
||||
std::this_thread::sleep_until();
|
||||
// 暂停当前线程的执行,让别的线程执行
|
||||
std::this_thread::yield();
|
||||
```
|
||||
|
||||
### 锁
|
||||
<!--rehype:wrap-class=row-span-3-->
|
||||
|
||||
> `#include <mutex>`
|
||||
|
||||
#### 锁的基本操作
|
||||
|
||||
创建锁
|
||||
|
||||
```cpp
|
||||
std::mutex m;
|
||||
```
|
||||
|
||||
上锁
|
||||
|
||||
```cpp
|
||||
m.lock();
|
||||
```
|
||||
|
||||
解锁
|
||||
|
||||
```cpp
|
||||
m.unlock();
|
||||
```
|
||||
|
||||
尝试上锁:成功返回`true`,失败返回`false`
|
||||
|
||||
```cpp
|
||||
m.try_lock();
|
||||
```
|
||||
|
||||
解锁
|
||||
|
||||
```cpp
|
||||
m.unlock();
|
||||
```
|
||||
|
||||
#### 更简单的锁 —— `std::lock_guard<Mutex>`
|
||||
|
||||
构造时上锁,析构时解锁
|
||||
|
||||
```cpp
|
||||
std::mutex m;
|
||||
std::lock_guard<std::mutex> lock(m);
|
||||
```
|
||||
|
||||
额外参数:`std::adopt_lock`:只需解锁,无需上锁
|
||||
|
||||
```cpp
|
||||
// 手动上锁
|
||||
m.lock();
|
||||
std::lock_guard<mutex> lock(m,
|
||||
std::adopt_lock);
|
||||
```
|
||||
|
||||
#### `unique_lock<Mutex>`
|
||||
|
||||
构造上锁,析构解锁
|
||||
|
||||
```cpp
|
||||
std::mutex m;
|
||||
std::unique_lock<mutex> lock(m);
|
||||
```
|
||||
|
||||
##### `std::adopt_lock`
|
||||
|
||||
只需解锁,无需上锁
|
||||
|
||||
```cpp
|
||||
// 手动上锁
|
||||
m.lock();
|
||||
std::unique_lock<mutex> lock(m,
|
||||
std::adopt_lock);
|
||||
```
|
||||
|
||||
##### `std::try_to_lock`
|
||||
|
||||
尝试上锁,可以通过`std::unique_lock<Mutex>::owns_lock()`查看状态
|
||||
|
||||
```cpp
|
||||
std::unique_lock<mutex> lock(m,
|
||||
std::try_to_lock);
|
||||
if (lock.owns_lock())
|
||||
{
|
||||
// 拿到了锁
|
||||
}
|
||||
else
|
||||
{
|
||||
// 没有
|
||||
}
|
||||
```
|
||||
|
||||
##### `std::defer_lock`
|
||||
|
||||
绑定锁,但不上锁
|
||||
|
||||
```cpp
|
||||
std::unique_lock<mutex> lock(m,
|
||||
std::defer_lock);
|
||||
lock.lock();
|
||||
lock.unlock();
|
||||
```
|
||||
|
||||
##### `std::unique_lock<Mutex>::release`
|
||||
|
||||
返回所管理的`mutex`对象指针,**释放所有权。**一旦释放了所有权,那么如果原来互斥量处于互斥状态,程序员有责任手动解锁。
|
||||
|
||||
#### `std::call_once`
|
||||
|
||||
当多个线程通过这个函数调用一个可调用对象时,只会有一个线程成功调用。
|
||||
|
||||
```cpp
|
||||
std::once_flag flag;
|
||||
|
||||
void foo() { }
|
||||
|
||||
std::call_once(flag, foo);
|
||||
```
|
||||
|
||||
### `std::condition_variable`
|
||||
|
||||
#### 创建条件变量
|
||||
|
||||
```cpp
|
||||
std::condition_variable cond;
|
||||
```
|
||||
|
||||
#### 等待条件变量被通知
|
||||
|
||||
```cpp
|
||||
std::unique_lock<std::mutex>
|
||||
lock;
|
||||
extern bool predicate();
|
||||
|
||||
// 调用方式 1
|
||||
cond.wait(lock);
|
||||
// 调用方式 2
|
||||
cond.wait(lock, predicate);
|
||||
```
|
||||
|
||||
----
|
||||
|
||||
- `wait`不断地尝试重新获取并加锁该互斥量,如果获取不到,它就卡在这里并反复尝试重新获取,如果获取到了,执行流程就继续往下走
|
||||
- `wait`在获取到互斥量并加锁了互斥量之后:
|
||||
- 如果`wait`被提供了可调用对象,那么就执行这个可调用对象:
|
||||
- 如果返回值为`false`,那么`wait`继续加锁,直到再次被 notified
|
||||
- 如果返回值为`true`,那么`wait`返回,继续执行流程
|
||||
- 如果`wait`没有第二个参数,那么直接返回,继续执行
|
||||
|
||||
#### `std::condition_variable::notify_one`
|
||||
|
||||
`notify_one` 唤醒一个调用 `wait` 的线程。注意在唤醒之前要解锁,否则调用 `wait` 的线程也会因为无法加锁而阻塞。
|
||||
|
||||
#### `std::condition_variable::notify_all`
|
||||
|
||||
唤醒所有调用 `wait` 的线程。
|
||||
|
||||
### 获取线程的运行结果
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
> `#include <future>`
|
||||
|
||||
#### 创建异步任务
|
||||
|
||||
```cpp
|
||||
double func(int val);
|
||||
|
||||
// 使用std::async创建异步任务
|
||||
// 使用std::future获取结果
|
||||
// future模板中存放返回值类型
|
||||
std::future<double> result =
|
||||
std::async(func, 5);
|
||||
```
|
||||
|
||||
#### 获取异步任务的返回值
|
||||
|
||||
等待异步任务结束,但是不获取返回值:
|
||||
|
||||
```cpp
|
||||
result.wait();
|
||||
```
|
||||
|
||||
获取异步任务的返回值:
|
||||
|
||||
```cpp
|
||||
int val = result.get();
|
||||
```
|
||||
|
||||
注:
|
||||
|
||||
- `get()`返回右值,因此只可调用一次
|
||||
- 只要调用上述任意函数,线程就会一直阻塞到返回值可用(入口函数运行结束)
|
||||
|
||||
#### `std::async` 的额外参数
|
||||
|
||||
额外参数可以被放在 `std::async` 的第一个参数位置,用于设定 `std::async` 的行为:
|
||||
|
||||
- `std::launch::deferred`:入口函数的运行会被推迟到`std::future<T>::get()`或者`std::future<T>::wait()`被调用时。此时调用线程会直接运行线程入口函数,换言之,**不会创建子线程**
|
||||
- `std::launch::async`:立即创建子线程,并运行线程入口函数
|
||||
- `std::launch::deferred | std::launch::async`:默认值,由系统自行决定
|
||||
|
||||
#### 返回值的状态
|
||||
|
||||
让当前线程等待一段时间(等待到指定时间点),以期待返回值准备好:
|
||||
|
||||
```cpp
|
||||
extern double foo(int val) {}
|
||||
|
||||
std::future<double> result =
|
||||
async(foo, 5);
|
||||
|
||||
//返回值类型
|
||||
std::future_status status;
|
||||
// 等待一段时间
|
||||
status = result.wait_for(
|
||||
std::chrono::seconds(1)
|
||||
);
|
||||
// 等待到某一时间点
|
||||
status = result.wait_for(
|
||||
std::chrono::now() +
|
||||
std::chrono::seconds(1)
|
||||
);
|
||||
```
|
||||
|
||||
在指定的时间过去后,可以获取等待的结果:
|
||||
|
||||
```cpp
|
||||
// 返回值已经准备好
|
||||
if (status ==
|
||||
std::future_status::ready)
|
||||
{
|
||||
|
||||
}
|
||||
// 超时:尚未准备好
|
||||
else if (status ==
|
||||
std::future_status::timeout)
|
||||
{ }
|
||||
// 尚未启动: std::launch::deferred
|
||||
else if (status ==
|
||||
std::future_status::deferred)
|
||||
{ }
|
||||
```
|
||||
|
||||
#### 多个返回值
|
||||
|
||||
```cpp
|
||||
std::shared_future<T> result;
|
||||
```
|
||||
|
||||
如果要多次获取结果,可以使用`std::shared_future`,其会返回结果的一个**拷贝**。
|
||||
|
||||
对于不可拷贝对象,可以在`std::shared_future`中存储对象的指针,而非指针本身。
|
||||
|
||||
C++ 预处理器
|
||||
------------
|
||||
|
||||
|
25
docs/cs.md
25
docs/cs.md
@ -213,6 +213,31 @@ string multiLine = """
|
||||
Console.WriteLine(multiLine); // => Content begin "Hello World!" /\n<>"" end.
|
||||
```
|
||||
|
||||
### 字符串操作
|
||||
|
||||
```cs
|
||||
//字符串分割
|
||||
string Name = "字A符A串A分A割";
|
||||
string[] Names=Name.Split(new char[] { 'A' });
|
||||
//会以A为媒介把字符串分成若干份
|
||||
for (int i = 0; i < Names.Length; i++)
|
||||
{
|
||||
Console.Write(Names[i]);
|
||||
}
|
||||
//-----------------------------------
|
||||
//字符串截取
|
||||
string Str = "字符串截取";
|
||||
Str = Str.Substring(2, 1);
|
||||
Console.WriteLine(Str);
|
||||
//输出结果“串”,意为从第二个下标开始截取一位字符
|
||||
//-----------------------------------
|
||||
//字符串替换
|
||||
string Rep = "字符1替换";
|
||||
Rep = Rep.Replace("1", "串");
|
||||
Console.WriteLine(Rep);
|
||||
//会把字符中的 “1”替换成“串”
|
||||
```
|
||||
|
||||
杂项
|
||||
-----------
|
||||
|
||||
|
16
docs/css.md
16
docs/css.md
@ -1795,6 +1795,22 @@ br + br {
|
||||
}
|
||||
```
|
||||
|
||||
### 子元素选中父元素
|
||||
|
||||
```css
|
||||
div:has(img) {
|
||||
background: black;
|
||||
}
|
||||
```
|
||||
|
||||
设置包含子元素 `img` 的 `div` 元素样式,还可以嵌套:
|
||||
|
||||
```css
|
||||
div:has(h2):has(ul) {
|
||||
background: black;
|
||||
}
|
||||
```
|
||||
|
||||
另见
|
||||
---------
|
||||
|
||||
|
@ -142,7 +142,7 @@ Docker 镜像
|
||||
`docker load --input ubuntu.tar` | 加载一个 tarred 存储库
|
||||
`docker save busybox > ubuntu.tar` | 将镜像保存到 tar 存档
|
||||
`docker history` | 显示镜像的历史
|
||||
`docker commit nginx` | 将容器另存为镜像。
|
||||
`docker commit nginx my_nginx` | 将容器另存为镜像
|
||||
`docker tag nginx eon01/nginx` | 标记镜像
|
||||
`docker push eon01/nginx` | 推送镜像
|
||||
|
||||
@ -232,10 +232,10 @@ docker network create -d overlay \
|
||||
|
||||
| Docker 语法 | 说明 |
|
||||
|------------|------|
|
||||
`docker search search_word` | 在 docker hub 中搜索镜像。
|
||||
`docker pull user/image` | 从 docker hub 下载镜像。
|
||||
`docker search search_word` | 在 docker hub 中搜索镜像
|
||||
`docker pull user/image` | 从 docker hub 下载镜像
|
||||
`docker login` | 向 docker hub 进行身份验证
|
||||
`docker push user/image` | 将镜像上传到 docker hub。
|
||||
`docker push user/image` | 将镜像上传到 docker hub
|
||||
|
||||
### 镜像仓库命令
|
||||
<!--rehype:wrap-class=row-span-3-->
|
||||
@ -312,7 +312,7 @@ $ docker volume prune
|
||||
`docker-compose config` | 验证并查看 Compose 文件
|
||||
`docker-compose scale <service_name>=<replica>` | 为服务指定容器个数
|
||||
`docker-compose top` | 显示正在运行的进程
|
||||
`docker-compose run -rm -p 2022:22 web bash` | 启动 Web 服务并运行 bash 作为其命令,删除旧容器。
|
||||
`docker-compose run -rm -p 2022:22 web bash` | 启动 Web 服务并运行 bash 作为其命令,删除旧容器
|
||||
|
||||
### Docker Services
|
||||
|
||||
|
@ -118,9 +118,8 @@ CSS 工具
|
||||
在线代码编辑器工具
|
||||
---
|
||||
|
||||
[CodePen](http://codepen.io/)<!--rehype:target=_blank-->
|
||||
[CodeSandbox](https://codesandbox.io/)<!--rehype:target=_blank-->
|
||||
[CodePen](https://codepen.io/)<!--rehype:target=_blank-->
|
||||
[CodeSandbox](https://codesandbox.io/)<!--rehype:target=_blank-->
|
||||
[StackBlitz](https://stackblitz.com/)<!--rehype:target=_blank-->
|
||||
[esbuild](https://esbuild.github.io/)<!--rehype:target=_blank-->
|
||||
[JSFiddle](https://jsfiddle.net/)<!--rehype:target=_blank-->
|
||||
|
198
docs/golang.md
198
docs/golang.md
@ -33,6 +33,8 @@ s1 = "Learn Go!"
|
||||
// 一次声明多个变量
|
||||
var b, c int = 1, 2
|
||||
var d = true
|
||||
// 匿名赋值
|
||||
_ , e = 10, 20
|
||||
```
|
||||
|
||||
简短声明
|
||||
@ -139,7 +141,6 @@ fmt.Println(!true) // false
|
||||
参见:[更多操作符](#运算符和标点符号)
|
||||
|
||||
### 数组 Arrays
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
```go
|
||||
┌────┬────┬────┬────┬─────┬─────┐
|
||||
@ -183,6 +184,7 @@ fmt.Println("2d: ", twoDimension)
|
||||
```
|
||||
|
||||
### 指针(Pointers)
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
```go
|
||||
func main () {
|
||||
@ -194,9 +196,30 @@ func getPointer () (myPointer *int) {
|
||||
a := 234
|
||||
return &a
|
||||
}
|
||||
//申明指针的时候,如果没有指向某个变量,默认值为nil
|
||||
//不能直接进行操作,包括读写
|
||||
var p *int
|
||||
*p = 123 // panic nil pointer
|
||||
```
|
||||
|
||||
a := new(int)
|
||||
*a = 234
|
||||
---
|
||||
|
||||
```go
|
||||
//而用new返回的是有默认值的指针, 为数据类型的默认值
|
||||
func main(){
|
||||
//有一块内存存放了10,它的地址由系统自动分配,别名是a
|
||||
a := 10
|
||||
//内存存放的10变成了20
|
||||
a = 20
|
||||
var p *int
|
||||
p = &a //或者直接写 p := &a
|
||||
//上面的p是一个指针,通过 *p 的方式同样可以访问 变量a指向 的内存
|
||||
|
||||
/*当你动态申请内存的时候,指针的存在意义之一就被体现出来了*/
|
||||
ptr := new(int)
|
||||
//申请了一块内存空间,没有办法指定别名,new()返回内存地址,用指针接收
|
||||
//此时并没有变量能直接指向这块内存,所以只能通过内存地址来访问
|
||||
}
|
||||
```
|
||||
|
||||
参见:[指针(Pointers)](https://tour.golang.org/moretypes/1)
|
||||
@ -225,11 +248,29 @@ const s string = "constant"
|
||||
const Phi = 1.618
|
||||
const n = 500000000
|
||||
const d = 3e20 / n
|
||||
fmt.Println(d)
|
||||
```
|
||||
|
||||
常量声明可以使用 iota常量生成器 初始化,它用于
|
||||
生成一组以相似规则初始化的常量,但是不用每行都
|
||||
写一遍初始化表达式。
|
||||
注意:
|
||||
|
||||
1. 在一个const声明语句中,在第一个声明的常量所在的行,iota被置为0,然后在每一个有常量声明的行加一。
|
||||
2. 写在同一行的值是相同的
|
||||
|
||||
```go
|
||||
const (
|
||||
a = iota
|
||||
b
|
||||
c
|
||||
)
|
||||
// a = 0, b = 1, c = 2
|
||||
```
|
||||
|
||||
### 类型转换
|
||||
|
||||
Go语言中不允许隐式转换,所有类型转换必须显式声明(强制转换),而且转换只能发生在两种相互兼容的类型之间。
|
||||
|
||||
```go
|
||||
i := 90
|
||||
f := float64(i)
|
||||
@ -561,6 +602,8 @@ sum(1, 2) // => [1 2] 3
|
||||
sum(1, 2, 3) // => [1 2 3] 6
|
||||
nums := []int{1, 2, 3, 4}
|
||||
sum(nums...) // => [1 2 3 4] 10
|
||||
// 不定参在内存中是连续存储的
|
||||
// 不定参内部再传递的时候,参数也要是不定的
|
||||
```
|
||||
|
||||
### 初始化函数
|
||||
@ -597,20 +640,8 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
### 关闭 1
|
||||
|
||||
```go
|
||||
func scope() func() int{
|
||||
outer_var := 2
|
||||
foo := func() int {return outer_var}
|
||||
return foo
|
||||
}
|
||||
// Outpus: 2
|
||||
fmt.Println(scope()())
|
||||
```
|
||||
|
||||
### 关闭 2
|
||||
|
||||
### 闭包
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
```go
|
||||
func outer() (func() int, int) {
|
||||
outer_var := 2
|
||||
@ -622,8 +653,25 @@ func outer() (func() int, int) {
|
||||
return inner, outer_var
|
||||
}
|
||||
inner, val := outer()
|
||||
fmt.Println(inner()) // => 200
|
||||
fmt.Println(val) // => 101
|
||||
fmt.Println(val)
|
||||
// => 101
|
||||
fmt.Println(inner())
|
||||
// => 200,这里涉及到golang中闭包和内存逃逸的概念,inner()实际上执行了两次,outer()中一次,fmt又一次,
|
||||
//但为什么是200呢,编译器不能确定outer_var在后续会不会使用,
|
||||
//所以outer_var不会随着outer()结束而释放它的栈(Stack)空间,
|
||||
//而会‘逃逸到’堆(Heap)上,那么第二次的inner()中outer_var就会是101。
|
||||
```
|
||||
|
||||
### 关闭 1
|
||||
|
||||
```go
|
||||
func scope() func() int{
|
||||
outer_var := 2
|
||||
foo := func() int {return outer_var}
|
||||
return foo
|
||||
}
|
||||
// Outpus: 2
|
||||
fmt.Println(scope()())
|
||||
```
|
||||
|
||||
Golang 包(Packages)
|
||||
@ -835,8 +883,21 @@ Golang 方法(Methods)
|
||||
<!--rehype:body-class=cols-2-->
|
||||
|
||||
### 接收器
|
||||
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
```go
|
||||
//Go语言中的方法(Method)是一种作用于特定类型变量的函数。
|
||||
//这种特定类型变量叫做接收者(Receiver)。
|
||||
//接收者的概念就类似于其他语言中的 this 或者 self。
|
||||
//方法的定义格式如下:
|
||||
func (接收者变量 接收者类型) 方法名(参数列表) (返回参数) {
|
||||
函数体
|
||||
}
|
||||
// 其中,
|
||||
// 1.接收者变量:接收者中的参数变量名在命名时,官方建议使用接收者类型名
|
||||
//的第一个小写字母,而不是self、this之类的命名。例如,Person类型的接收者变量
|
||||
// 应该命名为 p,Connector类型的接收者变量应该命名为c等。
|
||||
// 2.接收者类型:接收者类型和参数类似,可以是指针类型和非指针类型。
|
||||
// 3.方法名、参数列表、返回参数:具体格式与函数定义相同。
|
||||
type Vertex struct {
|
||||
X, Y float64
|
||||
}
|
||||
@ -844,27 +905,82 @@ type Vertex struct {
|
||||
func (v Vertex) Abs() float64 {
|
||||
return math.Sqrt(v.X * v.X + v.Y * v.Y)
|
||||
}
|
||||
func (v Vertex) valuechange() float64 {
|
||||
v.X += 1
|
||||
return v.X
|
||||
}
|
||||
func (v *Vertex) pointerchange() float64 {
|
||||
v.X += 1
|
||||
return v.X
|
||||
}
|
||||
func main() {
|
||||
v := Vertex{1, 2}
|
||||
v.Abs()
|
||||
|
||||
v = Vertex{1, 2}
|
||||
fmt.Println(v.valuechange()) // 2
|
||||
fmt.Println(v) // {1 2}
|
||||
|
||||
v = Vertex{1, 2}
|
||||
fmt.Println(v.pointerchange())// 2
|
||||
fmt.Println(v) // {2 2}
|
||||
}
|
||||
//如果在方法里修改receiver的值要对caller生效,使用 pointer receiver。
|
||||
|
||||
v := Vertex{1, 2}
|
||||
v.Abs()
|
||||
```
|
||||
|
||||
参见:[Methods](https://tour.golang.org/methods/1)
|
||||
参见:[Methods](https://tour.golang.org/methods/1),[指针接收器](https://tour.golang.org/methods/4)
|
||||
|
||||
### Mutation
|
||||
### 方法表达式
|
||||
|
||||
方法表达式相当于提供一种语法将类型方法调用显式地转换为函数调用,接收者(receiver)必须显式地传递进去。
|
||||
|
||||
```go
|
||||
func (v *Vertex) Scale(f float64) {
|
||||
v.X = v.X * f
|
||||
v.Y = v.Y * f
|
||||
func (t T) Get(){
|
||||
return t.a
|
||||
}
|
||||
|
||||
v := Vertex{6, 12}
|
||||
v.Scale(0.5)
|
||||
// `v` 已更新
|
||||
func (t *T) Set(i int){
|
||||
t.a = i
|
||||
}
|
||||
//表达式`T.Get`和`(*T).Set`被称为方法表达式,
|
||||
//需要注意的是在方法表达式中编译器不会做自动转换。
|
||||
//值调用会自动转换,表达式调用则不会,例如:
|
||||
type Data struct{}
|
||||
func (Data) TestValue () {}
|
||||
func (*Data) TestPointer () {}
|
||||
//声明一个类型变量a
|
||||
var a Data= struct{}{}
|
||||
//表达式调用编译器不会进行自动转换
|
||||
Data.TestValue(a)
|
||||
//Data.TestValue(&a)
|
||||
(*Data).TestPointer (&a)
|
||||
//Data.TestPointer(&a) //type Data has no method TestPointer
|
||||
//值调用编译器会进行自动转换
|
||||
y : = (&a).TestValue //编译器帮助转换a.TestValue
|
||||
g : = a.TestPointer //会转换为(&a).TestPointer
|
||||
```
|
||||
|
||||
参见:[指针接收器](https://tour.golang.org/methods/4)
|
||||
#### 组合结构的方法集
|
||||
|
||||
内嵌字段的访问不需要使用全路径,只要保证命名是唯一的就可以,尽量避免同名。如果外层字段和内层字段有相同的方法,则使用简化模式访问外层方法会覆盖内层的方法。
|
||||
|
||||
```go
|
||||
x : = X{a: 1}
|
||||
y : = Y{
|
||||
X : x ,
|
||||
b : 2 ,
|
||||
}
|
||||
z : = z {
|
||||
Y : y ,
|
||||
c : 3 ,
|
||||
}//组合结构,内嵌字段
|
||||
```
|
||||
|
||||
组合结构的方法集有如下规则:
|
||||
|
||||
- 若类型 T 包含匿名字段 S ,则 T 的方法集包含S的方法集
|
||||
- 若类型 T 包含匿名字段 *S ,则 T 的方法集包含 S 和*S方法集
|
||||
- 不管类型 T 中嵌入的匿名字段是 S 还是 *S ,*T 方法集总是包含 S 和 *S 方法集
|
||||
|
||||
Golang 接口(Interfaces)
|
||||
--------
|
||||
@ -1006,11 +1122,11 @@ Go 命令
|
||||
另见
|
||||
--------
|
||||
|
||||
- [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)_
|
||||
- [Effective Go](https://golang.org/doc/effective_go.html) _(golang.org)_
|
||||
- [Go by Example](https://gobyexample.com/) _(gobyexample.com)_
|
||||
- [Awesome Go](https://awesome-go.com/) _(awesome-go.com)_
|
||||
- [JustForFunc Youtube](https://www.youtube.com/channel/UC_BzFbxG2za3bp5NRRRXJSw) _(youtube.com)_
|
||||
- [Style Guide](https://github.com/golang/go/wiki/CodeReviewComments) _(github.com)_
|
||||
- [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)*
|
||||
- [Effective Go](https://golang.org/doc/effective_go.html) *(golang.org)*
|
||||
- [Go by Example](https://gobyexample.com/) *(gobyexample.com)*
|
||||
- [Awesome Go](https://awesome-go.com/) *(awesome-go.com)*
|
||||
- [JustForFunc Youtube](https://www.youtube.com/channel/UC_BzFbxG2za3bp5NRRRXJSw) *(youtube.com)*
|
||||
- [Style Guide](https://github.com/golang/go/wiki/CodeReviewComments) *(github.com)*
|
||||
|
@ -206,7 +206,41 @@ Chrome 开发者工具键盘快捷键
|
||||
`Enter` | 执行
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
Chrome 搜索引擎查询语法
|
||||
---
|
||||
|
||||
### 语法
|
||||
|
||||
语法 | 阐述
|
||||
:- | -
|
||||
`site:` | 指定网站
|
||||
`inurl:` | URL 中存在的关键字页面
|
||||
`intext:` | 网页内容里的关键字
|
||||
`Filetype:` | 指定文件的类型
|
||||
`intitle:` | 网页辩题中的关键字
|
||||
`link:` | 返回所有你指定的域名链接
|
||||
`info:` | 查找指定站点信息
|
||||
`cache:` | 搜索 Google 中的内容缓存
|
||||
`related:` | 搜索相关的网站
|
||||
|
||||
<span style="color:red">注意:</span>搜索语法的 `:` 后不应该存在空格,像这样 `site:google.com`,而不是这样 `site: google.com`。
|
||||
|
||||
### 指令
|
||||
|
||||
指令 | 阐述
|
||||
:- | -
|
||||
`@` | 用于搜索社交媒体,如:`@twitter`
|
||||
`*` | 通配符省略,如:`wlop *`
|
||||
`$` | 用于搜索指定的价格,如:`phone $400`
|
||||
`#` | 搜索 `#` 标签,如:`#疯狂星期四`
|
||||
`-` | 排除特定关键字,如:`中国美食 -麻辣`
|
||||
`""` | 完全匹配的结果,如:`"最高的建筑"`
|
||||
`..` | 某个数字范围之内的,如:`phone $50..$100`
|
||||
`OR` | 组合搜索,如:`疯狂星期四 OR 肯德基`
|
||||
`AND` | 空格默认是 AND 指令
|
||||
|
||||
另见
|
||||
----
|
||||
|
||||
- [Keyboard shortcuts for Google Chrome](https://support.google.com/chrome/answer/157179?hl=en) _(support.google.com)_
|
||||
- [Search Help for Google Chrome](https://support.google.com/websearch/answer/2466433?hl=en)
|
||||
|
@ -37,27 +37,28 @@ export HOMEBREW_INSTALL_FROM_API=1
|
||||
|
||||
命令 | 说明
|
||||
:--- :---
|
||||
`brew install git` | `安装`一个包
|
||||
`brew reinstall git` | 重新`安装`一个包
|
||||
`brew install git` | `安装`一个软件包
|
||||
`brew reinstall git` | 重新`安装`一个软件包
|
||||
`brew uninstall git` | `删除`/`卸载`软件包
|
||||
`brew upgrade git` | 升级包
|
||||
`brew upgrade git` | 升级一个软件包
|
||||
`brew upgrade` | 升级所有可升级的包
|
||||
:--- :---
|
||||
`brew unlink git` | `取消`链接
|
||||
`brew link git` | 关联
|
||||
`brew switch git 2.5.0` | 更改版本
|
||||
`brew unlink git` | 取消软件包的链接
|
||||
`brew link git` | 链接已有的软件包
|
||||
`brew switch git 2.5.0` | 切换软件包的版本
|
||||
:--- :---
|
||||
`brew list --versions git` | 看看你有什么版本
|
||||
`brew list --versions git` | 查看安装的软件包及其版本信息
|
||||
|
||||
### 更多包命令
|
||||
|
||||
命令 | 说明
|
||||
:--- :---
|
||||
`brew info git` | 列出版本、注意事项等
|
||||
`brew cleanup git` | 删除旧版本
|
||||
`brew edit git` | 编辑此软件包
|
||||
`brew cat git` | 打印这个软件包
|
||||
`brew home git` | 打开主页
|
||||
`brew search git` | 搜索公式
|
||||
`brew info git` | 显示软件包的版本、依赖、注意事项等信息
|
||||
`brew cleanup git` | 删除旧版本的软件包及其依赖
|
||||
`brew edit git` | 编辑此软件包的安装脚本
|
||||
`brew cat git` | 打印此软件包的安装脚本
|
||||
`brew home git` | 打开此软件包的主页
|
||||
`brew search git` | 搜索软件包公式并显示相关信息
|
||||
|
||||
### Brew Cask 命令
|
||||
|
||||
@ -66,20 +67,20 @@ export HOMEBREW_INSTALL_FROM_API=1
|
||||
`brew install --cask firefox` | 安装火狐浏览器
|
||||
`brew list --cask` | 列出已安装应用
|
||||
|
||||
Cask 命令用于与图形应用程序交互
|
||||
Cask 命令用于与图形界面应用程序交互,可以安装和管理 macOS 上的图形界面应用程序
|
||||
|
||||
### 全局命令
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
命令 | 说明
|
||||
:--- :---
|
||||
`brew update` | 更新 `brew` 和 `cask`
|
||||
`brew upgrade` | 升级所有软件包
|
||||
`brew list` | 已安装列表
|
||||
`brew outdated` | 升级需要什么?
|
||||
`brew doctor` | 诊断 brew 问题
|
||||
`brew pin <formula>` | 防止指定软件包升级
|
||||
`brew unpin <formula>` | 允许升级指定的软件包
|
||||
`brew update` | 更新 `Homebrew` 和 `Cask`
|
||||
`brew upgrade` | 升级所有可升级的软件包
|
||||
`brew list` | 列出已安装的软件包
|
||||
`brew outdated` | 列出需要升级的软件包
|
||||
`brew doctor` | 诊断 Homebrew 是否存在问题
|
||||
`brew pin <formula>` | 防止指定软件包被升级
|
||||
`brew unpin <formula>` | 允许指定软件包被升级
|
||||
|
||||
### Brew 清理
|
||||
|
||||
@ -127,6 +128,27 @@ $ brew info <formula>
|
||||
`brew help` | 打印帮助信息
|
||||
`brew help <sub-command>` | 打印子命令的帮助信息
|
||||
|
||||
### 依赖
|
||||
|
||||
显示`包`的依赖关系。 特定于`包`的其他选项可能是附加到命令
|
||||
|
||||
```bash
|
||||
# 您还可以看到包和依赖关系图
|
||||
$ brew deps --tree --installed
|
||||
$ brew deps git # 显示 git 依赖
|
||||
```
|
||||
|
||||
### 卸载 Homebrew
|
||||
|
||||
- 使用官方卸载脚本卸载 Homebrew
|
||||
- 验证文件是否已删除
|
||||
|
||||
```bash
|
||||
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
|
||||
$ sudo rm -rf /opt/homebrew
|
||||
```
|
||||
<!--rehype:className=wrap-text -->
|
||||
|
||||
另见
|
||||
---
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
iptables 备忘清单
|
||||
====
|
||||
|
||||
iptables 是一个配置 Linux 内核 防火墙(opens new window)的命令行工具,是 [netfilter](https://en.wikipedia.org/wiki/Netfilter)(opens new window)项目的一部分。这个快速参考备忘单显示了它的常用命令使用清单
|
||||
iptables 是一个配置 Linux 内核防火墙的命令行工具,是 [netfilter](https://en.wikipedia.org/wiki/Netfilter) 项目的一部分。这个快速参考备忘单显示了它的常用命令使用清单
|
||||
|
||||
入门
|
||||
---
|
||||
|
35
docs/java.md
35
docs/java.md
@ -89,7 +89,7 @@ boolean[] answers = {true, false};
|
||||
|
||||
查看: [Arrays](#java-数组)
|
||||
|
||||
### Swap
|
||||
### 交换变量 Swap
|
||||
|
||||
```java
|
||||
int a = 1;
|
||||
@ -101,7 +101,7 @@ b = temp;
|
||||
System.out.println(a + " " + b); // 2 1
|
||||
```
|
||||
|
||||
### Type Casting
|
||||
### 类型转换 Type Casting
|
||||
|
||||
```java
|
||||
// Widening
|
||||
@ -344,7 +344,7 @@ for (int a: arr) {
|
||||
// 输出: a b c
|
||||
```
|
||||
|
||||
### Multidimensional Arrays
|
||||
### 二维数组 Multidimensional Arrays
|
||||
|
||||
```java
|
||||
int[][] matrix = { {1, 2, 3}, {4, 5} };
|
||||
@ -359,7 +359,7 @@ for (int i = 0; i < a.length; ++i) {
|
||||
// 输出: 1 2 3 4 5 6 7
|
||||
```
|
||||
|
||||
### Sort
|
||||
### 排序 Sort
|
||||
|
||||
```java
|
||||
char[] chars = {'b', 'a', 'c'};
|
||||
@ -547,10 +547,10 @@ for (int i = 0; i < 5; i++) {
|
||||
Java 框架搜集
|
||||
--------------------
|
||||
|
||||
### Java 搜集
|
||||
### Java 集合
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
搜集 | Interface | 有序 | 已排序 | 线程安全 | 复制 | Nullable
|
||||
集合 | 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
|
||||
@ -615,6 +615,25 @@ m.forEach((key, value) -> {
|
||||
});
|
||||
```
|
||||
|
||||
### ConcurrentHashMap
|
||||
|
||||
```java
|
||||
ConcurrentHashMap<Integer, String> m
|
||||
= new ConcurrentHashMap<>();
|
||||
m.put(100, "Hello");
|
||||
m.put(101, "Geeks");
|
||||
m.put(102, "Geeks");
|
||||
// 移除
|
||||
m.remove(101, "Geeks");
|
||||
|
||||
// 如果不存在,就添加,存在就不变更
|
||||
m.putIfAbsent(103, "Hello");
|
||||
|
||||
// 替换
|
||||
m.replace(101, "Hello", "For");
|
||||
System.out.println(m);
|
||||
```
|
||||
|
||||
### HashSet
|
||||
|
||||
```java
|
||||
@ -771,7 +790,7 @@ text.split(Pattern.quote("|"));
|
||||
`Math.toDegrees(rad)` | 以度为单位的角度弧度
|
||||
`Math.toRadians(deg)` | 以弧度为单位的角度度
|
||||
|
||||
### Try/Catch/Finally
|
||||
### 异常 Try/Catch/Finally
|
||||
|
||||
```java
|
||||
try {
|
||||
@ -823,4 +842,4 @@ method.invoke(classLoader, url);
|
||||
另见
|
||||
---
|
||||
|
||||
- [Java 官网](https://www.java.com/zh-CN/) _(java.com)_
|
||||
- [Java 官网](https://www.oracle.com/cn/java/) _(oracle.com/cn/java)_
|
||||
|
@ -88,7 +88,7 @@ console.log(single.length);
|
||||
|
||||
```javascript
|
||||
5 + 5 = 10 // 加法 Addition
|
||||
10 - 5 = 5 // 加法 Subtraction
|
||||
10 - 5 = 5 // 减法 Subtraction
|
||||
5 * 10 = 50 // 乘法 Multiplication
|
||||
10 / 5 = 2 // 除法 Division
|
||||
10 % 5 = 0 // 取模 Modulo
|
||||
@ -469,6 +469,15 @@ function sum(num1, num2) {
|
||||
sum(2, 4); // 6
|
||||
```
|
||||
|
||||
### 立即执行函数
|
||||
|
||||
```javascript
|
||||
//命名函数并立即执行一次
|
||||
(function sum(num1, num2) {
|
||||
return num1 + num2;
|
||||
})(2,4)//6
|
||||
```
|
||||
|
||||
### 函数表达式
|
||||
|
||||
```javascript
|
||||
@ -1190,6 +1199,99 @@ console.log(myCat.name);
|
||||
myCat.name = 'Yankee';
|
||||
```
|
||||
|
||||
### Proxy
|
||||
|
||||
Proxy 对象用于创建一个对象的代理,从而实现基本操作的拦截和自定义(如属性查找、赋值、枚举、函数调用等)。
|
||||
|
||||
```javascript
|
||||
// 用于拦截对象的读取属性操作。
|
||||
const handler = {
|
||||
get: function(obj, prop) {
|
||||
return prop in obj ? obj[prop] : 37;
|
||||
}
|
||||
};
|
||||
|
||||
const p = new Proxy({}, handler);
|
||||
p.a = 1;
|
||||
p.b = undefined;
|
||||
|
||||
console.log(p.a, p.b); // 1, undefined
|
||||
console.log('c' in p, p.c); // false, 37
|
||||
```
|
||||
|
||||
#### 语法
|
||||
|
||||
```javascript
|
||||
const p = new Proxy(target, handler)
|
||||
```
|
||||
|
||||
- target 要使用 Proxy 包装的目标对象(可以是任何类型的对象,包括原生数组,函数,甚至另一个代理)。
|
||||
- handler 一个通常以函数作为属性的对象,各属性中的函数分别定义了在执行各种操作时代理 p 的行为。
|
||||
|
||||
#### 方法
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`Proxy.revocable()` | 创建一个可撤销的Proxy对象 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/revocable)
|
||||
|
||||
#### handler 对象的方法
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`handler.getPrototypeOf()` | Object.getPrototypeOf 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getPrototypeOf)
|
||||
`handler.setPrototypeOf()` | Object.setPrototypeOf 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/setPrototypeOf)
|
||||
`handler.isExtensible()` | Object.isExtensible 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/isExtensible)
|
||||
`handler.preventExtensions()` | Object.preventExtensions 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/preventExtensions)
|
||||
`handler.getOwnPropertyDescriptor()` | Object.getOwnPropertyDescriptor 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor)
|
||||
`handler.defineProperty()` | Object.defineProperty 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/defineProperty)
|
||||
`handler.has()` | in 操作符的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/has)
|
||||
`handler.get()` | 属性读取操作的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/get)
|
||||
`handler.set()` | 属性设置操作的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/set)
|
||||
`handler.deleteProperty()` | delete 操作符的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/deleteProperty)
|
||||
`handler.ownKeys()` | Object.getOwnPropertyNames 方法和 Object.getOwnPropertySymbols 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/ownKeys)
|
||||
`handler.apply()` | 函数调用操作的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/apply)
|
||||
`handler.construct()` | new 操作符的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/construct)
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### Reflect
|
||||
|
||||
Reflect 是一个内置的对象,它提供拦截 JavaScript 操作的方法。这些方法与proxy handlers (en-US)的方法相同。Reflect不是一个函数对象,因此它是不可构造的。
|
||||
|
||||
```javascript
|
||||
// 检测一个对象是否存在特定属性
|
||||
const duck = {
|
||||
name: 'Maurice',
|
||||
color: 'white',
|
||||
greeting: function() {
|
||||
console.log(`Quaaaack! My name is ${this.name}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reflect.has(duck, 'color');
|
||||
// true
|
||||
Reflect.has(duck, 'haircut');
|
||||
// false
|
||||
```
|
||||
|
||||
#### 静态方法
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`Reflect.apply(target, thisArgument, argumentsList)` | 对一个函数进行调用操作,同时可以传入一个数组作为调用参数。和 Function.prototype.apply() 功能类似 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/apply)
|
||||
`Reflect.construct(target, argumentsList[, newTarget])` | 对构造函数进行 new 操作,相当于执行 new target(...args) [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct)
|
||||
`Reflect.defineProperty(target, propertyKey, attributes)` | 和 Object.defineProperty() 类似。如果设置成功就会返回 true [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/defineProperty)
|
||||
`Reflect.deleteProperty(target, propertyKey)` | 作为函数的delete操作符,相当于执行 delete target[name] [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/deleteProperty)
|
||||
`Reflect.get(target, propertyKey[, receiver])` | 获取对象身上某个属性的值,类似于 target[name] [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/get)
|
||||
`Reflect.getOwnPropertyDescriptor(target, propertyKey)` | 类似于 Object.getOwnPropertyDescriptor()。如果对象中存在该属性,则返回对应的属性描述符,否则返回 undefined [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getOwnPropertyDescriptor)
|
||||
`Reflect.getPrototypeOf(target)` | 类似于 Object.getPrototypeOf() [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getPrototypeOf)
|
||||
`Reflect.has(target, propertyKey)` | 判断一个对象是否存在某个属性,和 in 运算符 的功能完全相同 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/has)
|
||||
`Reflect.isExtensible(target)` | 类似于 Object.isExtensible() [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/isExtensible)
|
||||
`Reflect.ownKeys(target)` | 返回一个包含所有自身属性(不包含继承属性)的数组。(类似于 Object.keys(), 但不会受enumerable 影响) [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys)
|
||||
`Reflect.preventExtensions(target)` | 类似于 Object.preventExtensions()。返回一个Boolean [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/preventExtensions)
|
||||
`Reflect.set(target, propertyKey, value[, receiver])` | 将值分配给属性的函数。返回一个Boolean,如果更新成功,则返回true [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set)
|
||||
`Reflect.setPrototypeOf(target, prototype)` | 设置对象原型的函数。返回一个 Boolean,如果更新成功,则返回 true [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/setPrototypeOf)
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
JavaScript this 绑定
|
||||
----
|
||||
|
||||
|
@ -113,7 +113,7 @@ $("selector1, selector2 ...selectorn")
|
||||
- [[name!="value"]](https://api.jquery.com/attribute-not-equal-selector/) _选择不具有指定属性或具有指定属性但不具有特定值的元素_<!--rehype:tooltips-->
|
||||
- [[name^="value"]](https://api.jquery.com/attribute-starts-with-selector/) _选择具有指定属性且值恰好以给定字符串开头的元素_<!--rehype:tooltips-->
|
||||
- [[name]](https://api.jquery.com/has-attribute-selector/) _选择具有指定属性和任意值的元素_<!--rehype:tooltips-->
|
||||
- [[name="value"][name2="value2"]](https://api.jquery.com/multiple-attribute-selector/) _匹配匹配所有指定属性过滤器的元素_<!--rehype:tooltips-->
|
||||
- [[name="value"]](https://api.jquery.com/multiple-attribute-selector/) _匹配匹配所有指定属性过滤器的元素_<!--rehype:tooltips-->
|
||||
<!--rehype:className=cols-2 style-none-->
|
||||
|
||||
### 子过滤器
|
||||
|
@ -1,7 +1,7 @@
|
||||
Julia 备忘清单
|
||||
===
|
||||
|
||||
本备忘清单旨在快速理解 [Julia](https://mysql.com) 一份简单而粗略的语言概览,供您参考。
|
||||
本备忘清单旨在快速理解 [Julia](https://julialang.org/) 一份简单而粗略的语言概览,供您参考。
|
||||
|
||||
入门
|
||||
---
|
||||
@ -678,4 +678,5 @@ names(ModuleName, all::Bool, imported::Bool)
|
||||
另见
|
||||
---
|
||||
|
||||
- [快速入门一份简单而粗略的语言概览](https://cheatsheet.juliadocs.org/zh-cn/)
|
||||
- [Julia 官方网站](https://julialang.org/) _(julialang.org)_
|
||||
- [快速入门一份简单而粗略的语言概览](https://cheatsheet.juliadocs.org/zh-cn/) _(juliadocs.org)_
|
||||
|
@ -350,7 +350,7 @@ when(grade) {
|
||||
var height = 46 // inches
|
||||
|
||||
if (height in 1..53) {
|
||||
println("抱歉,您必须至少 54 英寸才能乘坐过山车")
|
||||
println("抱歉,您必须至少 54 英寸才能乘坐过山车")
|
||||
}
|
||||
// Prints: 抱歉,您必须至少 54 英寸才能乘坐过山车
|
||||
```
|
||||
|
342
docs/kubernetes.md
Normal file
342
docs/kubernetes.md
Normal file
@ -0,0 +1,342 @@
|
||||
Kubernetes 备忘清单
|
||||
===
|
||||
|
||||
查看资源信息
|
||||
---
|
||||
|
||||
### 节点
|
||||
|
||||
资源名称: nodes, 缩写: no
|
||||
|
||||
```bash
|
||||
$ kubectl get no # 显示所有节点信息
|
||||
$ kubectl get no -o wide # 显示所有节点的更多信息
|
||||
$ kubectl describe no # 显示节点详情
|
||||
$ kubectl get no -o yaml # 以yaml格式,显示节点详情
|
||||
$ kubectl get node --selector=[label_name] # 筛选指定标签的节点
|
||||
$ kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'
|
||||
# 输出jsonpath表达式定义的字段信息
|
||||
$ kubectl top node [node_name] # 显示节点(CPU/内存/存储)使用情况
|
||||
```
|
||||
|
||||
### 容器组
|
||||
|
||||
资源名称: pods, 缩写: po
|
||||
|
||||
```bash
|
||||
$ kubectl get po # 显示所有容器组信息
|
||||
$ kubectl get po -o wide
|
||||
$ kubectl describe po
|
||||
$ kubectl get po --show-labels # 查看容器组的labels
|
||||
$ kubectl get po -l app=nginx
|
||||
$ kubectl get po -o yaml
|
||||
$ kubectl get pod [pod_name] -o yaml --export
|
||||
$ kubectl get pod [pod_name] -o yaml --export > nameoffile.yaml
|
||||
# 以yaml格式导出容器组信息到yaml文件
|
||||
$ kubectl get pods --field-selector status.phase=Running
|
||||
# 使用字段选择器筛选出容器组信息
|
||||
```
|
||||
|
||||
### 命名空间
|
||||
|
||||
资源名称: namespaces, 缩写: ns
|
||||
|
||||
```bash
|
||||
$ kubectl get ns
|
||||
$ kubectl get ns -o yaml
|
||||
$ kubectl describe ns
|
||||
```
|
||||
|
||||
### 无状态
|
||||
|
||||
资源名称: deployments, 缩写: deploy
|
||||
|
||||
```bash
|
||||
$ kubectl get deploy
|
||||
$ kubectl describe deploy
|
||||
$ kubectl get deploy -o wide
|
||||
$ kubectl get deploy -o yaml
|
||||
```
|
||||
|
||||
### 服务
|
||||
|
||||
资源名称: services, 缩写: svc
|
||||
|
||||
```bash
|
||||
$ kubectl get svc
|
||||
$ kubectl describe svc
|
||||
$ kubectl get svc -o wide
|
||||
$ kubectl get svc -o yaml
|
||||
$ kubectl get svc --show-labels
|
||||
```
|
||||
|
||||
### 守护进程集
|
||||
|
||||
资源名称: daemonsets, 缩写: ds
|
||||
|
||||
```bash
|
||||
$ kubectl get ds
|
||||
$ kubectl describe ds --all-namespaces
|
||||
$ kubectl describe ds [daemonset_name] -n [namespace_name]
|
||||
$ kubectl get ds [ds_name] -n [ns_name] -o yaml
|
||||
```
|
||||
|
||||
### 事件
|
||||
|
||||
资源名称: events, 缩写: ev
|
||||
|
||||
```bash
|
||||
$ kubectl get events
|
||||
$ kubectl get events -n kube-system
|
||||
$ kubectl get events -w
|
||||
```
|
||||
|
||||
### 日志
|
||||
|
||||
```bash
|
||||
$ kubectl logs [pod_name]
|
||||
$ kubectl logs --since=1h [pod_name]
|
||||
$ kubectl logs --tail=20 [pod_name]
|
||||
$ kubectl logs -f -c [container_name] [pod_name]
|
||||
$ kubectl logs [pod_name] > pod.log
|
||||
```
|
||||
|
||||
### 服务帐户
|
||||
|
||||
资源名称: serviceaccounts, 缩写: sa
|
||||
|
||||
```bash
|
||||
$ kubectl get sa
|
||||
$ kubectl get sa -o yaml
|
||||
$ kubectl get serviceaccounts default -o yaml >./sa.yaml
|
||||
$ kubectl replace serviceaccount default -f ./sa.yaml
|
||||
```
|
||||
|
||||
### 副本集
|
||||
|
||||
资源名称: replicasets, 缩写: rs
|
||||
|
||||
```bash
|
||||
$ kubectl get rs
|
||||
$ kubectl describe rs
|
||||
$ kubectl get rs -o wide
|
||||
$ kubectl get rs -o yaml
|
||||
```
|
||||
|
||||
### 角色
|
||||
|
||||
```bash
|
||||
$ kubectl get roles --all-namespaces
|
||||
$ kubectl get roles --all-namespaces -o yaml
|
||||
```
|
||||
|
||||
### 保密字典
|
||||
|
||||
```bash
|
||||
$ kubectl get secrets
|
||||
$ kubectl get secrets --all-namespaces
|
||||
$ kubectl get secrets -o yaml
|
||||
```
|
||||
|
||||
### 配置项
|
||||
|
||||
资源名称: configmaps, 缩写: cm
|
||||
|
||||
```bash
|
||||
$ kubectl get cm
|
||||
$ kubectl get cm --all-namespaces
|
||||
$ kubectl get cm --all-namespaces -o yaml
|
||||
```
|
||||
|
||||
### 路由
|
||||
|
||||
资源名称: ingresses, 缩写: ing
|
||||
|
||||
```bash
|
||||
$ kubectl get ing
|
||||
$ kubectl get ing --all-namespaces
|
||||
```
|
||||
|
||||
### 持久卷
|
||||
|
||||
资源名称: persistentvolumes, 缩写: pv
|
||||
|
||||
```bash
|
||||
$ kubectl get pv
|
||||
$ kubectl describe pv
|
||||
```
|
||||
|
||||
### 持久卷声明
|
||||
|
||||
资源名称: persistentvolumeclaims, 缩写: pvc
|
||||
|
||||
```bash
|
||||
$ kubectl get pvc
|
||||
$ kubectl describe pvc
|
||||
```
|
||||
|
||||
### 存储类
|
||||
|
||||
资源名称: storageclasses, 缩写: sc
|
||||
|
||||
```bash
|
||||
$ kubectl get sc
|
||||
$ kubectl get sc -o yaml
|
||||
```
|
||||
|
||||
### 多个资源
|
||||
|
||||
```bash
|
||||
$ kubectl get svc, po
|
||||
$ kubectl get deploy, no
|
||||
$ kubectl get all
|
||||
$ kubectl get all --all-namespaces
|
||||
```
|
||||
|
||||
变更资源属性
|
||||
---
|
||||
|
||||
### 污点
|
||||
|
||||
```bash
|
||||
$ kubectl taint [node_name] [taint_name]
|
||||
```
|
||||
|
||||
### 标签
|
||||
|
||||
```bash
|
||||
$ kubectl label [node_name] disktype=ssd
|
||||
$ kubectl label [pod_name] env=prod
|
||||
```
|
||||
|
||||
### 维护/可调度
|
||||
|
||||
```bash
|
||||
$ kubectl cordon [node_name] # 节点维护
|
||||
$ kubectl uncordon [node_name] # 节点可调度
|
||||
```
|
||||
|
||||
### 清空节点
|
||||
|
||||
```bash
|
||||
$ kubectl drain [node_name] # 清空节点
|
||||
```
|
||||
|
||||
### 节点/容器组
|
||||
|
||||
```bash
|
||||
$ kubectl delete node [node_name]
|
||||
$ kubectl delete pod [pod_name]
|
||||
$ kubectl edit node [node_name]
|
||||
$ kubectl edit pod [pod_name]
|
||||
```
|
||||
|
||||
### 无状态/命名空间
|
||||
|
||||
```bash
|
||||
$ kubectl edit deploy [deploy_name]
|
||||
$ kubectl delete deploy [deploy_name]
|
||||
$ kubectl expose deploy [deploy_name] --port=80 --type=NodePort
|
||||
$ kubectl scale deploy [deploy_name] --replicas=5
|
||||
$ kubectl delete ns
|
||||
$ kubectl edit ns [ns_name]
|
||||
```
|
||||
|
||||
### 服务
|
||||
|
||||
```bash
|
||||
$ kubectl edit svc [svc_name]
|
||||
$ kubectl delete svc [svc_name]
|
||||
```
|
||||
|
||||
### 守护进程集
|
||||
|
||||
```bash
|
||||
$ kubectl edit ds [ds_name] -n kube-system
|
||||
$ kubectl delete ds [ds_name]
|
||||
```
|
||||
|
||||
### 服务账号
|
||||
|
||||
```bash
|
||||
$ kubectl edit sa [sa_name]
|
||||
$ kubectl delete sa [sa_name]
|
||||
```
|
||||
|
||||
### 注释
|
||||
|
||||
```bash
|
||||
$ kubectl annotatepo [pod_name] [annotation]
|
||||
$ kubectl annotateno [node_name]
|
||||
```
|
||||
|
||||
添加资源
|
||||
---
|
||||
|
||||
### 创建容器组
|
||||
|
||||
```bash
|
||||
$ kubectl create -f [name_of_file]
|
||||
$ kubectl apply -f [name_of_file]
|
||||
$ kubectl run [pod_name] --image=nginx --restart=Never
|
||||
$ kubectl run [pod_name] --generator=run-pod/v1 --image=nginx
|
||||
$ kubectl run [pod_name] --image=nginx --restart=Never
|
||||
```
|
||||
|
||||
### 创建服务
|
||||
|
||||
```bash
|
||||
$ kubectl create svc nodeport [svc_name] --tcp=8080:80
|
||||
```
|
||||
|
||||
### 创建无状态应用
|
||||
|
||||
```bash
|
||||
$ kubectl create -f [name_of_file]
|
||||
$ kubectl apply -f [name_of_file]
|
||||
$ kubectl create deploy [deploy_name] --image=nginx
|
||||
```
|
||||
|
||||
### 容器交互
|
||||
|
||||
```bash
|
||||
$ kubectl run [pod_name] --image=busybox --rm -it --restart=Never -- sh
|
||||
```
|
||||
|
||||
### 输出YAML文件
|
||||
|
||||
```bash
|
||||
$ kubectl create deploy [deploy_name] --image=nginx --dry-run -o yaml > deploy.yaml
|
||||
$ kubectl get po [pod_name] -o yaml --export > pod.yaml
|
||||
```
|
||||
|
||||
### 获取帮助
|
||||
|
||||
```bash
|
||||
$ kubectl -h
|
||||
$ kubectl create -h
|
||||
$ kubectl run -h
|
||||
$ kubectl explain deploy.spec
|
||||
```
|
||||
|
||||
请求
|
||||
---
|
||||
|
||||
### API调用
|
||||
|
||||
```bash
|
||||
$ kubectl get --raw /apis/metrics.k8s.io/
|
||||
```
|
||||
|
||||
### 集群信息
|
||||
|
||||
```bash
|
||||
$ kubectl config
|
||||
$ kubectl cluster-info
|
||||
$ kubectl get componentstatus
|
||||
```
|
||||
|
||||
另见
|
||||
---
|
||||
|
||||
- [Kubernetes 官方文档 命令行工具 (kubectl)](https://kubernetes.io/zh-cn/docs/reference/kubectl/) _(kubernetes.io)_
|
434
docs/mongodb.md
Normal file
434
docs/mongodb.md
Normal file
@ -0,0 +1,434 @@
|
||||
MongoDB 备忘清单
|
||||
===
|
||||
|
||||
[MongoDB](https://www.mongodb.com/developer/products/mongodb/cheat-sheet/#connect-mongodb-shell) 此备忘单包含一些方便的提示、命令和快速参考,可让您立即连接并进行 CRUD
|
||||
|
||||
入门
|
||||
---
|
||||
|
||||
### 连接 MongoDB Shell
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
```bash
|
||||
mongo # 默认连接到 mongodb://127.0.0.1:27017
|
||||
mongo --host <host> --port <port> -u <user> -p <pwd> # 如果需要提示,请省略密码
|
||||
mongo "mongodb://192.168.1.1:27017"
|
||||
# MongoDB 地图集
|
||||
mongo "mongodb+srv://cluster-name.abcde.mongodb.net/<dbname>" --username <username>
|
||||
```
|
||||
|
||||
### 显示数据库
|
||||
|
||||
```mongodb
|
||||
show dbs
|
||||
db // 打印当前数据库
|
||||
```
|
||||
|
||||
### 切换数据库
|
||||
|
||||
```mongodb
|
||||
use <database_name>
|
||||
```
|
||||
|
||||
### 显示收藏
|
||||
|
||||
```mongodb
|
||||
show collections
|
||||
```
|
||||
|
||||
### 运行 JavaScript 文件
|
||||
|
||||
```mongodb
|
||||
load("myScript.js")
|
||||
```
|
||||
|
||||
CRUD
|
||||
---
|
||||
|
||||
### 创建
|
||||
<!--rehype:wrap-class=col-span-3-->
|
||||
|
||||
```mongodb
|
||||
db.coll.insertOne({ name: "Max" })
|
||||
db.coll.insert([{ name: "Max"}, {name:"Alex"}]) // 订购批量插入
|
||||
db.coll.insert([{ name: "Max"}, {name:"Alex"}], {ordered: false}) // 无序批量插入
|
||||
db.coll.insert({ date: ISODate()})
|
||||
db.coll.insert({ name: "Max"}, {"writeConcern": {"w": "majority", "wtimeout": 5000}})
|
||||
```
|
||||
|
||||
### 寻找文件
|
||||
|
||||
Commands | Description
|
||||
:-- | ---
|
||||
`db.docx.findOne()` | 查找一个随机文档
|
||||
`db.docx.find().prettyPrint()` | 查找所有文档
|
||||
`db.docx.find({}, {name:true, _id:false})` | 仅显示文档 Docx 的名称
|
||||
`db.docx.find({}, {name:true, _id:false})` | 可以在多个文件中按属性查找一个文件
|
||||
|
||||
### 使用运算符查找文档
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
Operator | Description | Commands
|
||||
:-- | --- | ---
|
||||
`$gt` | 比...更棒 | `db.docx.find({class:{$gt:'T'}`
|
||||
`$gte` | 大于等于 | `db.docx.find({class:{$gt:'T'}`
|
||||
`$lt` | 小于 | `db.docx.find({class:{$lt:'T'}`
|
||||
`$lte` | 小于等于 | `db.docx.find({class:{$lte:'T'}`
|
||||
`$exists` | 属性是否存在 | `db.docx.find({class:{$gt:'T'}`
|
||||
`$regex` | 正则表达式匹配 | `db.docx.find({name:{$regex:'^USS\\sE'}})`
|
||||
`$type` | 按元素类型搜索 | `db.docx.find({name : {$type:4}})`
|
||||
|
||||
### 读取
|
||||
<!--rehype:wrap-class=col-span-3-->
|
||||
|
||||
```mongodb
|
||||
db.coll.findOne() // 返回单个文档
|
||||
db.coll.find() // 返回一个游标 - 显示 20 个结果 - "it" 显示更多
|
||||
db.coll.find().pretty()
|
||||
db.coll.find({name: "Max", age: 32}) // 隐式逻辑“与”。
|
||||
db.coll.find({date: ISODate("2020-09-25T13:57:17.180Z")})
|
||||
|
||||
// 或“queryPlanner”或“allPlansExecution”
|
||||
db.coll.find({name: "Max", age: 32}).explain("executionStats")
|
||||
db.coll.distinct("name")
|
||||
|
||||
// 数数
|
||||
db.coll.count({age: 32}) // 基于馆藏元数据的估计
|
||||
db.coll.estimatedDocumentCount() // 基于馆藏元数据的估计
|
||||
db.coll.countDocuments({age: 32}) // 聚合管道的别名 - 准确计数
|
||||
|
||||
// Comparison 比较
|
||||
db.coll.find({"year": {$gt: 1970}})
|
||||
db.coll.find({"year": {$gte: 1970}})
|
||||
db.coll.find({"year": {$lt: 1970}})
|
||||
db.coll.find({"year": {$lte: 1970}})
|
||||
db.coll.find({"year": {$ne: 1970}})
|
||||
db.coll.find({"year": {$in: [1958, 1959]}})
|
||||
db.coll.find({"year": {$nin: [1958, 1959]}})
|
||||
|
||||
|
||||
// Logical 逻辑
|
||||
db.coll.find({name:{$not: {$eq: "Max"}}})
|
||||
db.coll.find({$or: [{"year" : 1958}, {"year" : 1959}]})
|
||||
db.coll.find({$nor: [{price: 1.99}, {sale: true}]})
|
||||
db.coll.find({
|
||||
$and: [
|
||||
{$or: [{qty: {$lt :10}}, {qty :{$gt: 50}}]},
|
||||
{$or: [{sale: true}, {price: {$lt: 5 }}]}
|
||||
]
|
||||
})
|
||||
|
||||
// Element 元素
|
||||
db.coll.find({name: {$exists: true}})
|
||||
db.coll.find({"zipCode": {$type: 2 }})
|
||||
db.coll.find({"zipCode": {$type: "string"}})
|
||||
|
||||
// Aggregation Pipeline 聚合管道
|
||||
db.coll.aggregate([
|
||||
{$match: {status: "A"}},
|
||||
{$group: {_id: "$cust_id", total: {$sum: "$amount"}}},
|
||||
{$sort: {total: -1}}
|
||||
])
|
||||
|
||||
// 使用“文本”索引进行文本搜索
|
||||
db.coll.find({$text: {$search: "cake"}}, {score: {$meta: "textScore"}})
|
||||
.sort({score: {$meta: "textScore"}})
|
||||
|
||||
// Regex 正则表达式
|
||||
db.coll.find({name: /^Max/}) // 正则表达式:以字母“M”开头
|
||||
db.coll.find({name: /^Max$/i}) // 正则表达式不区分大小写
|
||||
|
||||
// Array
|
||||
db.coll.find({tags: {$all: ["Realm", "Charts"]}})
|
||||
db.coll.find({field: {$size: 2}}) // 无法索引 - 更喜欢存储数组的大小并更新它
|
||||
db.coll.find({results: {$elemMatch: {product: "xyz", score: {$gte: 8}}}})
|
||||
|
||||
// Projections 预测
|
||||
db.coll.find({"x": 1}, {"actors": 1}) // actors + _id
|
||||
db.coll.find({"x": 1}, {"actors": 1, "_id": 0}) // actors
|
||||
db.coll.find({"x": 1}, {"actors": 0, "summary": 0}) // 除了“actors”和“summary”之外的所有内容
|
||||
|
||||
// Sort 排序, skip 跳过, limit 限制
|
||||
db.coll.find({}).sort({"year": 1, "rating": -1}).skip(10).limit(3)
|
||||
|
||||
// Read Concern 阅读关注
|
||||
db.coll.find().readConcern("majority")
|
||||
```
|
||||
|
||||
### 更新
|
||||
<!--rehype:wrap-class=col-span-3-->
|
||||
|
||||
```mongodb
|
||||
db.coll.update({"_id": 1}, {"year": 2016}) // 警告! 替换整个文档
|
||||
db.coll.update({"_id": 1}, {$set: {"year": 2016, name: "Max"}})
|
||||
db.coll.update({"_id": 1}, {$unset: {"year": 1}})
|
||||
db.coll.update({"_id": 1}, {$rename: {"year": "date"} })
|
||||
db.coll.update({"_id": 1}, {$inc: {"year": 5}})
|
||||
db.coll.update({"_id": 1}, {$mul: {price: NumberDecimal("1.25"), qty: 2}})
|
||||
db.coll.update({"_id": 1}, {$min: {"imdb": 5}})
|
||||
db.coll.update({"_id": 1}, {$max: {"imdb": 8}})
|
||||
db.coll.update({"_id": 1}, {$currentDate: {"lastModified": true}})
|
||||
db.coll.update({"_id": 1}, {$currentDate: {"lastModified": {$type: "timestamp"}}})
|
||||
|
||||
// Array
|
||||
db.coll.update({"_id": 1}, {$push :{"array": 1}})
|
||||
db.coll.update({"_id": 1}, {$pull :{"array": 1}})
|
||||
db.coll.update({"_id": 1}, {$addToSet :{"array": 2}})
|
||||
db.coll.update({"_id": 1}, {$pop: {"array": 1}}) // 最后一个元素
|
||||
db.coll.update({"_id": 1}, {$pop: {"array": -1}}) // 第一个元素
|
||||
db.coll.update({"_id": 1}, {$pullAll: {"array" :[3, 4, 5]}})
|
||||
db.coll.update({"_id": 1}, {$push: {scores: {$each: [90, 92, 85]}}})
|
||||
db.coll.updateOne({"_id": 1, "grades": 80}, {$set: {"grades.$": 82}})
|
||||
db.coll.updateMany({}, {$inc: {"grades.$[]": 10}})
|
||||
db.coll.update({}, {$set: {"grades.$[element]": 100}}, {multi: true, arrayFilters: [{"element": {$gte: 100}}]})
|
||||
|
||||
// 更新很多
|
||||
db.coll.update({"year": 1999}, {$set: {"decade": "90's"}}, {"multi":true})
|
||||
db.coll.updateMany({"year": 1999}, {$set: {"decade": "90's"}})
|
||||
|
||||
// FindOneAndUpdate 查找并更新
|
||||
db.coll.findOneAndUpdate({"name": "Max"}, {$inc: {"points": 5}}, {returnNewDocument: true})
|
||||
|
||||
// Upsert 更新插入
|
||||
db.coll.update({"_id": 1}, {$set: {item: "apple"}, $setOnInsert: {defaultQty: 100}}, {upsert: true})
|
||||
|
||||
// Replace 代替
|
||||
db.coll.replaceOne({"name": "Max"}, {"firstname": "Maxime", "surname": "Beugnet"})
|
||||
|
||||
// Save 保存
|
||||
db.coll.save({"item": "book", "qty": 40})
|
||||
|
||||
// Write concern 写关注
|
||||
db.coll.update({}, {$set: {"x": 1}}, {"writeConcern": {"w": "majority", "wtimeout": 5000}})
|
||||
```
|
||||
|
||||
### 删除
|
||||
<!--rehype:wrap-class=col-span-3-->
|
||||
|
||||
```mongodb
|
||||
db.coll.remove({name: "Max"})
|
||||
db.coll.remove({name: "Max"}, {justOne: true})
|
||||
db.coll.remove({}) // 警告!删除所有文档但不删除集合本身及其索引定义
|
||||
db.coll.remove({name: "Max"}, {"writeConcern": {"w": "majority", "wtimeout": 5000}})
|
||||
db.coll.findOneAndDelete({"name": "Max"})
|
||||
```
|
||||
|
||||
数据库和集合
|
||||
---
|
||||
|
||||
### Drop
|
||||
|
||||
```mongodb
|
||||
// 删除集合及其索引定义
|
||||
db.coll.drop()
|
||||
// 仔细检查你*不*在 PROD 集群上......:-)
|
||||
db.dropDatabase()
|
||||
```
|
||||
|
||||
### 创建集合
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
```mongodb
|
||||
// 使用 $jsonschema 创建集合
|
||||
db.createCollection("contacts", {
|
||||
validator: {$jsonSchema: {
|
||||
bsonType: "object",
|
||||
required: ["phone"],
|
||||
properties: {
|
||||
phone: {
|
||||
bsonType: "string",
|
||||
description: "必须是一个字符串并且是必需的"
|
||||
},
|
||||
email: {
|
||||
bsonType: "string",
|
||||
pattern: "@mongodb\.com$",
|
||||
description: "必须是字符串并匹配正则表达式模式"
|
||||
},
|
||||
status: {
|
||||
enum: [ "Unknown", "Incomplete" ],
|
||||
description: "只能是枚举值之一"
|
||||
}
|
||||
}
|
||||
}}
|
||||
})
|
||||
```
|
||||
|
||||
### 其他采集功能
|
||||
|
||||
```mongodb
|
||||
db.coll.stats()
|
||||
db.coll.storageSize()
|
||||
db.coll.totalIndexSize()
|
||||
db.coll.totalSize()
|
||||
db.coll.validate({full: true})
|
||||
// 第二个参数用于删除目标集合(如果存在)
|
||||
db.coll.renameCollection("new_coll", true)
|
||||
```
|
||||
|
||||
索引
|
||||
---
|
||||
|
||||
### 列表索引
|
||||
|
||||
```mongodb
|
||||
db.coll.getIndexes()
|
||||
db.coll.getIndexKeys()
|
||||
```
|
||||
|
||||
### 创建索引
|
||||
<!--rehype:wrap-class=col-span-2 row-span-3-->
|
||||
|
||||
```mongodb
|
||||
// 索引类型
|
||||
db.coll.createIndex({"name": 1}) // 单字段索引
|
||||
db.coll.createIndex({"name": 1, "date": 1}) // 复合索引
|
||||
db.coll.createIndex({foo: "text", bar: "text"}) // 文本索引
|
||||
db.coll.createIndex({"$**": "text"}) // 通配符文本索引
|
||||
db.coll.createIndex({"userMetadata.$**": 1}) // 通配符索引
|
||||
db.coll.createIndex({"loc": "2d"}) // 二维索引
|
||||
db.coll.createIndex({"loc": "2dsphere"}) // 2dsphere 索引
|
||||
db.coll.createIndex({"_id": "hashed"}) // 哈希索引
|
||||
|
||||
// Index Options
|
||||
db.coll.createIndex({"lastModifiedDate": 1}, {expireAfterSeconds: 3600}) // TTL指数
|
||||
db.coll.createIndex({"name": 1}, {unique: true})
|
||||
db.coll.createIndex({"name": 1}, {partialFilterExpression: {age: {$gt: 18}}}) // 部分索引
|
||||
// 强度为 1 或 2 的不区分大小写的索引
|
||||
db.coll.createIndex({"name": 1}, {collation: {locale: 'en', strength: 1}})
|
||||
db.coll.createIndex({"name": 1 }, {sparse: true})
|
||||
```
|
||||
|
||||
### 删除索引
|
||||
|
||||
```mongodb
|
||||
db.coll.dropIndex("name_1")
|
||||
```
|
||||
|
||||
### 隐藏/取消隐藏索引
|
||||
|
||||
```mongodb
|
||||
db.coll.hideIndex("name_1")
|
||||
db.coll.unhideIndex("name_1")
|
||||
```
|
||||
|
||||
方便的命令
|
||||
---
|
||||
|
||||
###
|
||||
<!--rehype:wrap-class=col-span-3&style=display:none;&wrap-style=padding-top: 0;-->
|
||||
|
||||
```mongodb
|
||||
use admin
|
||||
db.createUser({"user": "root", "pwd": passwordPrompt(), "roles": ["root"]})
|
||||
db.dropUser("root")
|
||||
db.auth( "user", passwordPrompt() )
|
||||
|
||||
use test
|
||||
db.getSiblingDB("dbname")
|
||||
db.currentOp()
|
||||
db.killOp(123) // opid
|
||||
|
||||
db.fsyncLock()
|
||||
db.fsyncUnlock()
|
||||
|
||||
db.getCollectionNames()
|
||||
db.getCollectionInfos()
|
||||
db.printCollectionStats()
|
||||
db.stats()
|
||||
|
||||
db.getReplicationInfo()
|
||||
db.printReplicationInfo()
|
||||
db.isMaster()
|
||||
db.hostInfo()
|
||||
db.printShardingStatus()
|
||||
db.shutdownServer()
|
||||
db.serverStatus()
|
||||
|
||||
db.setSlaveOk()
|
||||
db.getSlaveOk()
|
||||
|
||||
db.getProfilingLevel()
|
||||
db.getProfilingStatus()
|
||||
db.setProfilingLevel(1, 200) // 0 == OFF, 1 == ON with slowms, 2 == ON
|
||||
|
||||
db.enableFreeMonitoring()
|
||||
db.disableFreeMonitoring()
|
||||
db.getFreeMonitoringStatus()
|
||||
|
||||
db.createView("viewName", "sourceColl", [{$project:{department: 1}}])
|
||||
```
|
||||
|
||||
各种各样的
|
||||
---
|
||||
|
||||
### 改变流
|
||||
|
||||
```mongodb
|
||||
watchCursor = db.coll.watch([
|
||||
{
|
||||
$match : {"operationType": "insert" }
|
||||
}
|
||||
])
|
||||
|
||||
while (!watchCursor.isExhausted()){
|
||||
if (watchCursor.hasNext()){
|
||||
print(tojson(watchCursor.next()));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 分片集群
|
||||
<!--rehype:wrap-class=col-span-2 row-span-3-->
|
||||
|
||||
```mongodb
|
||||
sh.status()
|
||||
sh.addShard("rs1/mongodbd1.example.net:27017")
|
||||
sh.shardCollection("mydb.coll", {zipcode: 1})
|
||||
|
||||
sh.moveChunk("mydb.coll", { zipcode: "53187" }, "shard0019")
|
||||
sh.splitAt("mydb.coll", {x: 70})
|
||||
sh.splitFind("mydb.coll", {x: 70})
|
||||
sh.disableAutoSplit()
|
||||
sh.enableAutoSplit()
|
||||
|
||||
sh.startBalancer()
|
||||
sh.stopBalancer()
|
||||
sh.disableBalancing("mydb.coll")
|
||||
sh.enableBalancing("mydb.coll")
|
||||
sh.getBalancerState()
|
||||
sh.setBalancerState(true/false)
|
||||
sh.isBalancerRunning()
|
||||
|
||||
sh.addTagRange("mydb.coll", {state: "NY",zip: MinKey}, {state: "NY",zip: MaxKey}, "NY")
|
||||
sh.removeTagRange("mydb.coll", {state: "NY",zip: MinKey}, {state: "NY",zip: MaxKey}, "NY")
|
||||
sh.addShardTag("shard0000", "NYC")
|
||||
sh.removeShardTag("shard0000", "NYC")
|
||||
|
||||
sh.addShardToZone("shard0000", "JFK")
|
||||
sh.removeShardFromZone("shard0000", "NYC")
|
||||
sh.removeRangeFromZone("mydb.coll", {a: 1, b: 1}, {a: 10, b: 10})
|
||||
```
|
||||
|
||||
### 副本集
|
||||
|
||||
```mongodb
|
||||
rs.status()
|
||||
rs.initiate({"_id": "replicaTest",
|
||||
members: [
|
||||
{ _id: 0, host: "127.0.0.1:27017" },
|
||||
{ _id: 1, host: "127.0.0.1:27018" },
|
||||
{ _id: 2, host: "127.0.0.1:27019",
|
||||
arbiterOnly:true }]
|
||||
})
|
||||
rs.add("mongodbd1.example.net:27017")
|
||||
rs.addArb("mongodbd2.example.net:27017")
|
||||
rs.remove("mongodbd1.example.net:27017")
|
||||
rs.conf()
|
||||
rs.isMaster()
|
||||
rs.printReplicationInfo()
|
||||
rs.printSlaveReplicationInfo()
|
||||
rs.reconfig(<valid_conf>)
|
||||
rs.slaveOk()
|
||||
rs.stepDown(20, 5)
|
||||
// (stepDownSecs, secondaryCatchUpPeriodSecs)
|
||||
```
|
@ -201,7 +201,7 @@ export default Blog
|
||||
- Next.js 在后台触发页面的重新生成
|
||||
- 一旦页面生成成功,Next.js 将使缓存失效并显示更新后的页面。如果后台重新生成失败,旧页面仍将保持不变
|
||||
|
||||
### 使用 useeffect 客户端数据获取
|
||||
### 使用 useEffect 客户端数据获取
|
||||
|
||||
```jsx
|
||||
import { useState, useEffect } from 'react'
|
||||
|
248
docs/ps.md
Normal file
248
docs/ps.md
Normal file
@ -0,0 +1,248 @@
|
||||
ps 备忘清单
|
||||
===
|
||||
|
||||
Linux 为我们提供了一个名为 `ps` 的实用程序,用于查看与系统上的进程相关的信息,它是 `Process Status` 的缩写
|
||||
这份 `ps` 命令备忘清单的快速参考列表,包含常用选项和示例。
|
||||
|
||||
入门
|
||||
---
|
||||
|
||||
### 语法
|
||||
<!--rehype:wrap-class=row-span-4-->
|
||||
|
||||
```bash
|
||||
$ ps [options]
|
||||
```
|
||||
|
||||
命令运行示例,列出当前 shell 中的所有进程:
|
||||
|
||||
```bash
|
||||
$ ps
|
||||
|
||||
PID TTY TIME CMD
|
||||
12330 pts/0 00:00:00 bash
|
||||
21621 pts/0 00:00:00 ps
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`PID` | 唯一的进程 ID
|
||||
`TTY` | 用户登录的终端类型
|
||||
`TIME` | 进程运行的 CPU 数量,以分钟和秒为单位
|
||||
`CMD` | 启动进程的命令的名称
|
||||
|
||||
注意:有时当我们执行 `ps` 命令时,它显示 `TIME` 为 `00:00:00`
|
||||
|
||||
---
|
||||
|
||||
ps 命令支持 3 种使用语法风格
|
||||
|
||||
- `Unix` 可以分组并以连字符开头
|
||||
- `BSD` 可以分组但前面没有连字符
|
||||
- `GNU` 长选项,前面有双连字符
|
||||
|
||||
### 示例
|
||||
<!--rehype:wrap-class=row-span-3-->
|
||||
|
||||
Option | Function
|
||||
:-- | --
|
||||
`ps -ef / -aux` | 以完整格式列出当前正在运行的进程
|
||||
`ps -ax` | 列出当前正在运行的进程
|
||||
`ps -u <username>` | 列出特定用户的进程
|
||||
`ps -C <command>` | 列出给定命令的进程
|
||||
`ps -p <PID>` | 列出具有给定 PID 的进程
|
||||
`ps -ppid <PPID>` | 列出具有给定 ppid 的进程
|
||||
`pstree` | 在层次结构中显示过程
|
||||
`ps -L` | 列出特定进程的所有线程
|
||||
`ps --sort pmem` | 查找内存泄漏
|
||||
`ps -eo` | 显示安全信息
|
||||
`ps T` | 允许您仅选择与此终端关联的所有进程
|
||||
`ps -U root -u root u` | 显示由 root 运行的进程
|
||||
<!--rehype:className=code-nowrap-->
|
||||
|
||||
### 查看系统上的每个进程
|
||||
|
||||
要使用标准语法查看系统上的每个进程:
|
||||
|
||||
```bash
|
||||
$ ps -e # 列出所有进程
|
||||
$ ps -ef
|
||||
$ ps -eF
|
||||
$ ps -ely
|
||||
```
|
||||
|
||||
要使用 BSD 语法查看系统上的每个进程:
|
||||
|
||||
```bash
|
||||
$ ps ax # 以 BSD 格式列出所有进程
|
||||
$ ps axu
|
||||
```
|
||||
|
||||
### 打印进程树
|
||||
|
||||
```bash
|
||||
$ ps -ejH
|
||||
$ ps axjf
|
||||
```
|
||||
|
||||
### 仅打印 PID 42 的名称
|
||||
|
||||
```bash
|
||||
$ ps -q 42 -o comm=
|
||||
```
|
||||
|
||||
### 获取有关线程的信息
|
||||
|
||||
```bash
|
||||
$ ps -eLf
|
||||
$ ps axms
|
||||
```
|
||||
|
||||
### 列出当前用户拥有的所有进程
|
||||
|
||||
```bash
|
||||
$ ps x
|
||||
```
|
||||
|
||||
### 获取安全信息
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
```bash
|
||||
$ ps -eo euser,ruser,suser,fuser,f,comm,label
|
||||
$ ps axZ
|
||||
$ ps -eM
|
||||
```
|
||||
|
||||
### 查看以 root 身份运行的每个进程
|
||||
|
||||
查看以 root 身份运行的每个进程(真实且有效的 ID)用户格式:
|
||||
|
||||
```bash
|
||||
$ ps -U root -u root u
|
||||
```
|
||||
|
||||
### 查看具有用户定义格式的每个进程
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
```bash
|
||||
$ ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
|
||||
$ ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
|
||||
$ ps -Ao pid,tt,user,fname,tmout,f,wchan
|
||||
```
|
||||
|
||||
### 仅打印 syslogd 的进程 ID
|
||||
|
||||
```bash
|
||||
$ ps -C syslogd -o pid=
|
||||
```
|
||||
|
||||
### 显示面向用户的格式
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
```bash
|
||||
$ ps u
|
||||
|
||||
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
|
||||
refs 11400 1.1 0.0 34853544 5816 s025 Ss Tue02PM 0:02.82 /bin/zsh --login
|
||||
refs 34561 0.6 0.0 34822644 3152 s016 S+ 14Dec22 115:59.28 zsh (figterm)
|
||||
refs 21377 0.5 0.0 34973972 7076 s028 S+ Wed09AM 4:32.19 zsh (figterm)
|
||||
refs 78881 0.5 0.0 34843484 3256 s015 S+ 17Dec22 90:27.10 zsh (figterm)
|
||||
```
|
||||
|
||||
### 列出具有完整格式的进程
|
||||
|
||||
```bash
|
||||
$ ps f
|
||||
$ ps -F
|
||||
```
|
||||
|
||||
### 显示虚拟内存格式
|
||||
|
||||
```bash
|
||||
$ ps v
|
||||
```
|
||||
|
||||
### 按有效用户 ID 或名称显示进程
|
||||
|
||||
```bash
|
||||
$ ps -u user[name or id]
|
||||
# OR
|
||||
$ ps --user user[name or id]
|
||||
$ ps -u root
|
||||
```
|
||||
|
||||
按**真实**用户 ID 或名称显示进程
|
||||
|
||||
```bash
|
||||
$ ps -U user[name or id]
|
||||
# OR
|
||||
$ ps --User user[name or id]
|
||||
```
|
||||
|
||||
### 按实际组 ID 或名称显示进程
|
||||
|
||||
```bash
|
||||
$ ps -G group[name or id]
|
||||
# OR
|
||||
$ ps --Group group[name or id]
|
||||
```
|
||||
|
||||
### 隐藏 ps 命令输出的标题
|
||||
|
||||
```bash
|
||||
$ ps h
|
||||
|
||||
PID TT STAT TIME COMMAND
|
||||
33790 s000 S+ 104:10.45 zsh (figterm)
|
||||
33800 s001 Ss+ 0:02.76 /bin/zsh --login
|
||||
77830 s002 S+ 90:22.51 zsh (figterm)
|
||||
77840 s003 Ss 0:00.66 /bin/zsh --login
|
||||
```
|
||||
|
||||
### 显示命令后的环境
|
||||
|
||||
```bash
|
||||
$ ps e
|
||||
|
||||
PID TTY STAT TIME COMMAND
|
||||
886 tty2 Ssl+ 0:00 /usr/li....
|
||||
```
|
||||
|
||||
### 重复 ps 命令输出的标题行
|
||||
|
||||
```bash
|
||||
$ ps --headers -A
|
||||
PID TTY TIME CMD
|
||||
1 ? 00:00:01 systemd
|
||||
2 ? 00:00:00 kthreadd
|
||||
3 ? 00:00:00 rcu_gp
|
||||
```
|
||||
|
||||
### 显示进程树
|
||||
|
||||
```bash
|
||||
$ ps --forest -A
|
||||
PID TTY TIME CMD
|
||||
2 ? 00:00:00 kthreadd
|
||||
3 ? 00:00:00 \_ rcu_gp
|
||||
4 ? 00:00:00 \_ rcu_par_gp
|
||||
960 ? 00:00:00 \_ goa-identity-se
|
||||
1118 ? 00:00:00 \_ at-spi-bus-laun
|
||||
1124 ? 00:00:00 | \_ dbus-daemon
|
||||
```
|
||||
|
||||
您可以使用 -H 选项打印进程层次结构
|
||||
|
||||
```bash
|
||||
$ ps -H -A
|
||||
PID TTY TIME CMD
|
||||
2 ? 00:00:00 kthreadd
|
||||
3 ? 00:00:00 rcu_gp
|
||||
1832 ? 00:00:37 gnome-terminal-
|
||||
1840 pts/0 00:00:00 bash
|
||||
1925 pts/1 00:00:00 bash
|
||||
2867 pts/1 00:00:00 su
|
||||
2868 pts/1 00:00:00 bash
|
||||
```
|
163
docs/pycharm.md
Normal file
163
docs/pycharm.md
Normal file
@ -0,0 +1,163 @@
|
||||
PyCharm 键盘快捷键备忘清单
|
||||
===
|
||||
|
||||
这个 [PyCharm](https://resources.jetbrains.com/storage/products/pycharm/docs/PyCharm_ReferenceCard.pdf) 快速参考备忘单显示了它的键盘快捷键和命令
|
||||
|
||||
快捷键
|
||||
---
|
||||
|
||||
### 创建和编辑
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Alt` + `Enter` | 显示意图动作
|
||||
`Ctrl` + `Space` | 基本代码完成
|
||||
`Ctrl` + `Shift` + `Space` | 智能代码完成
|
||||
`Ctrl` + `Alt` + `Space` | 类型名称完成
|
||||
`Ctrl` + `Shift` + `Enter` | 完整声明
|
||||
`Ctrl` + `P` / `Alt` + `Q` | 参数信息/上下文信息
|
||||
`Ctrl` + `Shift` + `I` | 快速定义
|
||||
`Ctrl` + `Q` / `Shift` + `F1` | 快速/外部文档
|
||||
`Alt` + `Insert` | 生成代码
|
||||
`Ctrl` + `O` / `Ctrl` + `I` | 覆盖/实施成员
|
||||
`Ctrl` + `Alt` + `T` | 围绕着……
|
||||
`Ctrl` + `/` | 注释行注释
|
||||
`Ctrl` + `W` / `Ctrl` + `Shift` + `W` | 扩展/收缩选择
|
||||
`Ctrl` + `Alt` + `O` | 优化导入
|
||||
`Ctrl` + `Alt` + `I` | 自动缩进行
|
||||
`Ctrl` + `X` / `Ctrl` + `C` / `Ctrl` + `V` | 剪切/复制/粘贴
|
||||
`Ctrl` + `Shift` + `C` | 复制文档路径
|
||||
`Ctrl` + `Shift` + `V` | 从剪贴板历史粘贴
|
||||
`Ctrl` + `D` | 复制当前行或选择
|
||||
`Ctrl` + `Shift` + `Up` / `Down` | 向上/向下移动线
|
||||
`Ctrl` + `Y` | 删除插入符处的行
|
||||
`Ctrl` + `Shift` + `J` / `Ctrl` + `Enter` | 加入/分割线
|
||||
`Shift` + `Enter` | 开始新行
|
||||
`Ctrl` + `Shift` + `U` | 切换大小写
|
||||
`Ctrl` + `NumPad` `+` / `-` | 展开/折叠代码块
|
||||
`Ctrl` + `Shift` + `NumPad` `+` / `-` | 全部展开/折叠
|
||||
`Ctrl` + `S` | 保存全部
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 版本控制
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Alt` + <code>`</code> | VCS 操作弹出...
|
||||
`Ctrl` + `K` | 提交
|
||||
`Ctrl` + `T` | 更新项目
|
||||
`Alt` + `Shift` + `C` | 近期变动
|
||||
`Ctrl` + `Alt` + `Z` | 恢复
|
||||
`Ctrl` + `Shift` + `K` | 推…
|
||||
`Ctrl` + `Alt` + `Shift` + `Down` / `Up` | 下一个/上一个更改
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 掌握您的 IDE
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl`+`Shift`+`A` | 寻找行动...
|
||||
`Alt`+`[0-9]` | 打开一个工具窗口
|
||||
`Ctrl`+`Alt`+`Y` | 同步
|
||||
`Ctrl`+<code>`</code> | 快速切换方案...
|
||||
`Ctrl`+`Alt`+`S` | 设置...
|
||||
`F4` / `Alt`+`Home` | 跳转到源/导航栏
|
||||
`F12` | 跳转到最后一个工具窗口
|
||||
`Shift`+`Esc` / `Ctrl`+`Shift`+`F12` | 隐藏活动/所有工具窗口
|
||||
`Alt`+`Right` / `Alt`+`Left` | 转到下一个/上一个编辑器选项卡
|
||||
`Esc` | 转到编辑器(从工具窗口)
|
||||
`Ctrl`+`Shift`+`F4` / `Ctrl`+`F4` | 关闭活动标签/窗口
|
||||
<!--rehype:className=shortcuts left-align-->
|
||||
|
||||
### 找到一切
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Shift` + `Shift` | 到处搜索
|
||||
`Ctrl` + `F` / `R` | 查找/替换
|
||||
`Ctrl` + `Shift` + `F` / `R` | 在路径中查找/在路径中替换
|
||||
`F3` / `Shift` + `F3` | 下/上一个事件
|
||||
`Ctrl` + `F3` | 在插入符处查找单词
|
||||
`Ctrl` + `N` / `Ctrl` + `Shift` + `N` | 去班级/档案
|
||||
`Ctrl` + `F12` | 转到文件成员
|
||||
`Ctrl` + `Alt` + `Shift` + `N` | 转到符号
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 从符号导航
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl` + `B` | 声明
|
||||
`Ctrl` + `Shift` + `B` | 类型声明 _(仅限 JavaScript)_
|
||||
`Ctrl` + `U` | 超级方法
|
||||
`Ctrl` + `Alt` + `B` | 实施
|
||||
`Alt` + `F7` / `Ctrl` + `F7` | 查找用法/在文件中查找用法
|
||||
`Ctrl` + `Shift` + `F7` | 突出显示文件中的用法
|
||||
`Ctrl` + `Alt` + `F7` | 显示用法
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 重构和清理
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl` + `Alt` + `Shift` + `T` | 重构这个……
|
||||
`F5` /`F6` | 复制…/移动…
|
||||
`Alt` + `Delete` | 安全删除…
|
||||
`Shift` + `F6` | 改名…
|
||||
`Ctrl` + `F6` | 更改签名…
|
||||
`Ctrl` + `Alt` + `N` | 排队…
|
||||
`Ctrl` + `Alt` + `M` | 提取方法
|
||||
`Ctrl` + `Alt` + `V` / `P` | 引入变量/参数
|
||||
`Ctrl` + `Alt` + `F` / `C` | 引入字段/常量
|
||||
`Ctrl` + `Alt` + `L` | 重新格式化代码
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 分析和探索
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl` + `F1` | 显示错误描述
|
||||
`F2` / `Shift` + `F2` | 下一个/上一个突出显示的错误
|
||||
`Ctrl` + `Alt` + `Shift` + `I` | 按名称运行检查...
|
||||
`Ctrl` + `H` / `Ctrl` + `Alt` + `H` | 类型/调用层次结构
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 在上下文中导航
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Alt`+`F1` | 选择...
|
||||
`Ctrl`+`E` / `Ctrl`+`Shift`+`E` | 最近查看/最近位置
|
||||
`Ctrl`+`Shift`+`Back` | 最后编辑位置
|
||||
`Ctrl`+`Alt`+`Left` / `Right` | 向后/向前导航
|
||||
`Alt`+`Up` / `Down` | 转到上一个/下一个方法
|
||||
`Ctrl`+`G` | 转到行/列...
|
||||
`Ctrl`+`]` / `[` | 转到代码块结束/开始
|
||||
`Alt`+`Shift`+`F` | 添加到收藏夹
|
||||
`F11` | 切换书签
|
||||
`Ctrl`+`F11` | 使用助记符切换书签
|
||||
`Ctrl`+`[0-9]` | 转到编号书签
|
||||
`Shift`+`F11` | 显示书签
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 构建、运行和调试
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl` + `Shift` + `F10` | 运行上下文配置
|
||||
`Alt` + `Shift` + `F10`/`F9` | 运行/调试所选配置
|
||||
`Shift` + `F10`/`F9` | 运行/调试当前配置
|
||||
`F8` / `F7` | 跨过/进入
|
||||
`Shift` + `F7` | 智能步入
|
||||
`Shift` + `F8` | 走出去
|
||||
`Alt` + `F9` / `Ctrl` + `Alt` + `F9` | 运行到光标/强制运行到光标
|
||||
`Alt` + `F10` | 显示执行点
|
||||
`Alt` + `F8` | 评估表达...
|
||||
`Ctrl` + `F2` | 停止
|
||||
`Ctrl` + `Shift` + `F2` | 停止后台进程...
|
||||
`F9` | 恢复程序
|
||||
`Ctrl` + `F8` | 切换行断点
|
||||
`Ctrl` + `Alt` + `Shift` + `F8` | 切换临时行断点
|
||||
`Ctrl` + `Shift` + `F8` | 编辑/查看断点
|
||||
<!--rehype:className=shortcuts-->
|
@ -152,7 +152,7 @@ message += "Part 2."
|
||||
'10 + 10 = 20'
|
||||
```
|
||||
|
||||
查看: [Python F-Strings](#f-字符串(Python 3.6+))
|
||||
查看: [Python F-Strings](#python-f-字符串自-python-36-起)
|
||||
|
||||
Python 数据类型
|
||||
---------------
|
||||
@ -489,7 +489,7 @@ Python F 字符串(自 Python 3.6+ 起)
|
||||
'text '
|
||||
>>> f'{"test":*>10}' # 向左填充
|
||||
'******test'
|
||||
>>> f'{"test":*<10}' # 填写正确
|
||||
>>> f'{"test":*<10}' # 向右填充
|
||||
'test******'
|
||||
>>> f'{"test":*^10}' # 填充中心
|
||||
'***test***'
|
||||
@ -649,7 +649,7 @@ a_list[start:end:step]
|
||||
['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']
|
||||
```
|
||||
|
||||
#### 迈着大步
|
||||
#### 跳跃索引
|
||||
|
||||
```python
|
||||
['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']
|
||||
@ -678,7 +678,7 @@ a_list[start:end:step]
|
||||
['butter']
|
||||
```
|
||||
|
||||
### 使用权
|
||||
### 列表边界
|
||||
|
||||
```python
|
||||
>>> li = ['a', 'b', 'c', 'd']
|
||||
|
@ -297,7 +297,7 @@ RegEX 备忘清单
|
||||
|
||||
范例 | 说明
|
||||
:-|-
|
||||
`colou?r` | 匹配 <yel>color</yel> 或 <yel>color</yel>
|
||||
`colou?r` | 匹配 <yel>color</yel> 或 <yel>colour</yel>
|
||||
`[BW]ill[ieamy's]*` | 匹配 <yel>Bill</yel>、<yel>Willy</yel>、<yel>William's</yel> 等。
|
||||
`[a-zA-Z]+` | 匹配 1 个或多个字母
|
||||
`\d{3}-\d{2}-\d{4}` | 匹配 SSN
|
||||
@ -615,7 +615,7 @@ M(?(?=.*?\bher\b)s|r)\.
|
||||
|
||||
表达式 | 匹配示例
|
||||
:- | -
|
||||
`The` | The `fat` cat sat on the mat.
|
||||
`The` | `The` fat cat sat on the mat.
|
||||
`/The/gi` | `The` fat cat sat on `the` mat.
|
||||
<!--rehype:className=show-header-->
|
||||
|
||||
|
@ -180,7 +180,7 @@ let p = Point { x: 10, y: 11 };
|
||||
let px: i32 = p.x;
|
||||
```
|
||||
|
||||
#### 元祖结构体
|
||||
#### 元组结构体
|
||||
|
||||
```rust
|
||||
struct Color (i32, i32, i32);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wcj/reference",
|
||||
"version": "1.33.0",
|
||||
"version": "1.36.0",
|
||||
"description": "为开发人员分享快速参考备忘单(主要是方便自己)。",
|
||||
"author": "jaywcjlove",
|
||||
"license": "MIT",
|
||||
@ -30,9 +30,9 @@
|
||||
"husky": "^8.0.1",
|
||||
"lint-staged": "^13.0.3",
|
||||
"prettier": "^2.7.1",
|
||||
"refs-cli": "^1.2.12",
|
||||
"markdownlint": "^0.26.2",
|
||||
"markdownlint-cli": "^0.32.2"
|
||||
"refs-cli": "^1.3.2",
|
||||
"markdownlint": "^0.27.0",
|
||||
"markdownlint-cli": "^0.33.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
|
Reference in New Issue
Block a user