mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-17 04:31:22 +08:00
Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 |
@ -132,15 +132,81 @@ 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)
|
||||
- [isteed.cc](https://ref.isteed.cc/)
|
||||
- [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,6 +229,9 @@ 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/heStudio-Network" title="醉、倾城">
|
||||
<img src="https://avatars.githubusercontent.com/u/119711513?v=4" width="42;" alt="醉、倾城"/>
|
||||
</a>
|
||||
@ -193,8 +262,8 @@ REF_LABEL=网站首页
|
||||
<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"/>
|
||||
@ -214,6 +283,9 @@ REF_LABEL=网站首页
|
||||
<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/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,9 +301,6 @@ REF_LABEL=网站首页
|
||||
<a href="https://github.com/likeshop-github" title="LikeShop技术社区">
|
||||
<img src="https://avatars.githubusercontent.com/u/77180968?v=4" width="42;" alt="LikeShop技术社区"/>
|
||||
</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/mariuszmichalowski" title="Mariusz Michalowski">
|
||||
<img src="https://avatars.githubusercontent.com/u/92091891?v=4" width="42;" alt="Mariusz Michalowski"/>
|
||||
</a>
|
||||
@ -265,6 +334,12 @@ 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>
|
||||
@ -301,6 +376,9 @@ REF_LABEL=网站首页
|
||||
<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/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"/>
|
||||
</a>
|
||||
|
35
README.md
35
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);-->
|
||||
@ -234,6 +236,9 @@ 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/heStudio-Network" title="醉、倾城">
|
||||
<img src="https://avatars.githubusercontent.com/u/119711513?v=4" width="42;" alt="醉、倾城"/>
|
||||
</a>
|
||||
@ -264,8 +269,8 @@ Quick Reference
|
||||
<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"/>
|
||||
@ -285,6 +290,9 @@ Quick Reference
|
||||
<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/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>
|
||||
@ -300,9 +308,6 @@ Quick Reference
|
||||
<a href="https://github.com/likeshop-github" title="LikeShop技术社区">
|
||||
<img src="https://avatars.githubusercontent.com/u/77180968?v=4" width="42;" alt="LikeShop技术社区"/>
|
||||
</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/mariuszmichalowski" title="Mariusz Michalowski">
|
||||
<img src="https://avatars.githubusercontent.com/u/92091891?v=4" width="42;" alt="Mariusz Michalowski"/>
|
||||
</a>
|
||||
@ -336,6 +341,12 @@ 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>
|
||||
@ -372,6 +383,9 @@ Quick Reference
|
||||
<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/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"/>
|
||||
</a>
|
||||
@ -424,15 +438,20 @@ Quick Reference
|
||||
[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=👆每天自动同步-->
|
||||
[ref.qiubit.cc](http://ref.qiubit.cc)<!--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=👆每天自动同步-->
|
||||
<!--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 版。
|
||||
|
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 |
343
docs/cpp.md
343
docs/cpp.md
@ -602,12 +602,14 @@ auto func = []() -> return_type { };
|
||||
|
||||
auto func1 = [=, &str1]() -> int
|
||||
{
|
||||
return val1 == std::stoi(str1) ? val1 : val2;
|
||||
return val1 == std::stoi(str1)
|
||||
? val1 : val2;
|
||||
};
|
||||
|
||||
auto func2 = [&, val1]() -> int
|
||||
{
|
||||
return str1 == std::to_string(val1) ? str1 : str2;
|
||||
return str1 == std::to_string(val1)
|
||||
? str1 : str2;
|
||||
};
|
||||
```
|
||||
|
||||
@ -619,13 +621,340 @@ auto func = []() -> return_type { };
|
||||
此处给出一个 Lambda 表达式的实际使用例子(当然可以使用 `str::copy`):
|
||||
|
||||
```cpp
|
||||
std::vector<int> vec({1, 2, 3, 4, 5}); // vec中包含1, 2, 3, 4, 5
|
||||
std::for_each(vec.begin(), vec.end(), [](int& ele) -> void
|
||||
{
|
||||
std::cout << ele << " ";
|
||||
});
|
||||
// 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++ 预处理器
|
||||
------------
|
||||
|
||||
|
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;
|
||||
}
|
||||
```
|
||||
|
||||
另见
|
||||
---------
|
||||
|
||||
|
@ -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)_
|
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
|
||||
```
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wcj/reference",
|
||||
"version": "1.34.0",
|
||||
"version": "1.35.0",
|
||||
"description": "为开发人员分享快速参考备忘单(主要是方便自己)。",
|
||||
"author": "jaywcjlove",
|
||||
"license": "MIT",
|
||||
@ -31,7 +31,7 @@
|
||||
"lint-staged": "^13.0.3",
|
||||
"prettier": "^2.7.1",
|
||||
"refs-cli": "^1.2.12",
|
||||
"markdownlint": "^0.26.2",
|
||||
"markdownlint": "^0.27.0",
|
||||
"markdownlint-cli": "^0.32.2"
|
||||
},
|
||||
"engines": {
|
||||
|
Reference in New Issue
Block a user