Compare commits
80 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 | |||
bf962194da | |||
f5e2ad2c31 | |||
ff0cc58c1d | |||
b42883e3de | |||
931850d916 | |||
f4d2c99007 | |||
112a53c101 | |||
9e525009c9 | |||
f78562b95e | |||
63d846b35d | |||
afd924a928 | |||
fb19cda5bb | |||
c9834110cd | |||
98edffbca0 | |||
b3d206d981 | |||
9ec7595b83 | |||
ef823de9a5 | |||
da22b78d8f | |||
06978b1601 | |||
b768bd4e9b | |||
a143e30d93 | |||
7ac675e34c | |||
8e3307272c | |||
0c9fb086ee | |||
f1200c67e1 | |||
cc20a31a47 | |||
1f34ea3bc3 | |||
61b3b5deec | |||
3fed079194 | |||
c481bcdb7b | |||
96e752e809 | |||
01d238eaab | |||
07aaae0e2b | |||
247cd4d4e6 | |||
9945c1b16f | |||
8b151f891c | |||
9dd378128e | |||
6b286b6eb6 | |||
d280013c31 | |||
bdf0dc17cd | |||
4995e6f500 | |||
822e08a6de | |||
88f392c532 | |||
72766dfabe | |||
bfe5551acf | |||
c5792b7c7e | |||
81548feeef | |||
5e284e6f14 | |||
3c4540d248 | |||
e8ccba5cbb | |||
e6d2a48410 | |||
a82f7b948e | |||
7c17fe1222 | |||
e781a3b20e |
10
.github/workflows/ci.yml
vendored
@ -122,6 +122,8 @@ jobs:
|
||||
```
|
||||
|
||||
# Create Docker Image
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to Docker Hub
|
||||
@ -135,7 +137,7 @@ jobs:
|
||||
with:
|
||||
push: true
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/amd64,linux/arm64,linux/arm64/v7
|
||||
tags: ${{ secrets.DOCKER_USER }}/reference:latest
|
||||
|
||||
- name: Build and push image:tags
|
||||
@ -144,7 +146,7 @@ jobs:
|
||||
with:
|
||||
push: true
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/amd64,linux/arm64,linux/arm64/v7
|
||||
tags: ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}
|
||||
|
||||
# Create Docker Image in Github
|
||||
@ -160,7 +162,7 @@ jobs:
|
||||
with:
|
||||
push: true
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/amd64,linux/arm64,linux/arm64/v7
|
||||
tags: ghcr.io/jaywcjlove/reference:latest
|
||||
|
||||
- name: Build and push image:tags
|
||||
@ -169,7 +171,7 @@ jobs:
|
||||
with:
|
||||
push: true
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/amd64,linux/arm64,linux/arm64/v7
|
||||
tags: ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
|
||||
|
||||
# # Create Docker Image in Github
|
||||
|
111
CONTRIBUTING.md
@ -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>
|
||||
@ -175,6 +244,9 @@ REF_LABEL=网站首页
|
||||
<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/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>
|
||||
@ -190,12 +262,15 @@ 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"/>
|
||||
</a>
|
||||
<a href="https://github.com/ch3nnn" title="Ch3nnn">
|
||||
<img src="https://avatars.githubusercontent.com/u/40114564?v=4" width="42;" alt="Ch3nnn"/>
|
||||
</a>
|
||||
<a href="https://github.com/CharlotteZeng" title="hanchZ">
|
||||
<img src="https://avatars.githubusercontent.com/u/19461184?v=4" width="42;" alt="hanchZ"/>
|
||||
</a>
|
||||
@ -208,15 +283,24 @@ 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>
|
||||
<a href="https://github.com/JetSquirrel" title="JetSquirrel">
|
||||
<img src="https://avatars.githubusercontent.com/u/20291255?v=4" width="42;" alt="JetSquirrel"/>
|
||||
</a>
|
||||
<a href="https://github.com/LightQuanta" title="Light_Quanta">
|
||||
<img src="https://avatars.githubusercontent.com/u/18213217?v=4" width="42;" alt="Light_Quanta"/>
|
||||
</a>
|
||||
<a href="https://github.com/Lihuagreek" title="Lihuagreek">
|
||||
<img src="https://avatars.githubusercontent.com/u/51040740?v=4" width="42;" alt="Lihuagreek"/>
|
||||
</a>
|
||||
<a href="https://github.com/likeshop-github" title="LikeShop技术社区">
|
||||
<img src="https://avatars.githubusercontent.com/u/77180968?v=4" width="42;" alt="LikeShop技术社区"/>
|
||||
</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>
|
||||
@ -226,6 +310,12 @@ REF_LABEL=网站首页
|
||||
<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>
|
||||
<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"/>
|
||||
</a>
|
||||
@ -244,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>
|
||||
@ -256,6 +352,9 @@ REF_LABEL=网站首页
|
||||
<a href="https://github.com/hweining" title="hweining">
|
||||
<img src="https://avatars.githubusercontent.com/u/8973985?v=4" width="42;" alt="hweining"/>
|
||||
</a>
|
||||
<a href="https://github.com/joyfully-W" title="joyfully-W">
|
||||
<img src="https://avatars.githubusercontent.com/u/32212924?v=4" width="42;" alt="joyfully-W"/>
|
||||
</a>
|
||||
<a href="https://github.com/k983551019" title="k983551019">
|
||||
<img src="https://avatars.githubusercontent.com/u/48147837?v=4" width="42;" alt="k983551019"/>
|
||||
</a>
|
||||
@ -277,9 +376,15 @@ 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>
|
||||
<a href="https://github.com/phygerr" title="phygerr">
|
||||
<img src="https://avatars.githubusercontent.com/u/42068889?v=4" width="42;" alt="phygerr"/>
|
||||
</a>
|
||||
<a href="https://github.com/Mowmowj" title="shelton">
|
||||
<img src="https://avatars.githubusercontent.com/u/24759562?v=4" width="42;" alt="shelton"/>
|
||||
</a>
|
||||
|
62
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);-->
|
||||
@ -73,6 +74,7 @@ Quick Reference
|
||||
|
||||
## 前端
|
||||
|
||||
[前端导航](./docs/feds.md)<!--rehype:style=background: rgb(35 115 205);&class=tag&data-lang=导航-->
|
||||
[CSS 3](./docs/css.md)<!--rehype:style=background: rgb(35 115 205);&class=tag&data-lang=CSS-->
|
||||
[Electron](./docs/electron.md)<!--rehype:style=background: rgb(0 72 153);-->
|
||||
[Emmet](./docs/emmet.md)<!--rehype:style=background: rgb(122 203 23);-->
|
||||
@ -86,6 +88,7 @@ Quick Reference
|
||||
[Less.js](./docs/lessjs.md)<!--rehype:style=background: rgb(29 54 93);&class=tag&data-lang=CSS-->
|
||||
[Next.js](./docs/nextjs.md)<!--rehype:style=background: rgb(0 0 0);&class=tag&data-lang=React-->
|
||||
[React](./docs/react.md)<!--rehype:style=background: rgb(34 143 173);-->
|
||||
[React Router](./docs/reactrouter.md)<!--rehype:style=background: rgb(244 66 79);&class=tag&data-lang=React-->
|
||||
[React Native](./docs/react-native.md)<!--rehype:style=background: rgb(34 143 173);&class=tag&data-lang=React-->
|
||||
[RegEx 正则表达式](./docs/regex.md)<!--rehype:style=background: rgb(149 36 155);-->
|
||||
[TypeScript](./docs/typescript.md)<!--rehype:style=background: rgb(49 120 198);-->
|
||||
@ -120,6 +123,7 @@ Quick Reference
|
||||
|
||||
## 命令
|
||||
|
||||
[ADB, Android Debug Bridge](./docs/adb.md)<!--rehype:style=background: rgb(238 0 0);&class=contributing tag&data-lang=Android&data-info=👆看看还缺点儿什么?-->
|
||||
[Ansible](./docs/ansible.md)<!--rehype:style=background: rgb(238 0 0);&class=contributing tag&data-lang=RedHat&data-info=👆看看还缺点儿什么?-->
|
||||
[Awk](./docs/awk.md)<!--rehype:style=background: rgb(16 185 129);-->
|
||||
[Conan](./docs/conan.md)<!--rehype:style=background: rgb(0 193 9);&class=tag&data-lang=C/C++-->
|
||||
@ -144,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);-->
|
||||
@ -158,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);-->
|
||||
@ -174,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);-->
|
||||
@ -229,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>
|
||||
@ -241,6 +251,9 @@ Quick Reference
|
||||
<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/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,12 +269,15 @@ 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"/>
|
||||
</a>
|
||||
<a href="https://github.com/ch3nnn" title="Ch3nnn">
|
||||
<img src="https://avatars.githubusercontent.com/u/40114564?v=4" width="42;" alt="Ch3nnn"/>
|
||||
</a>
|
||||
<a href="https://github.com/CharlotteZeng" title="hanchZ">
|
||||
<img src="https://avatars.githubusercontent.com/u/19461184?v=4" width="42;" alt="hanchZ"/>
|
||||
</a>
|
||||
@ -274,15 +290,24 @@ 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>
|
||||
<a href="https://github.com/JetSquirrel" title="JetSquirrel">
|
||||
<img src="https://avatars.githubusercontent.com/u/20291255?v=4" width="42;" alt="JetSquirrel"/>
|
||||
</a>
|
||||
<a href="https://github.com/LightQuanta" title="Light_Quanta">
|
||||
<img src="https://avatars.githubusercontent.com/u/18213217?v=4" width="42;" alt="Light_Quanta"/>
|
||||
</a>
|
||||
<a href="https://github.com/Lihuagreek" title="Lihuagreek">
|
||||
<img src="https://avatars.githubusercontent.com/u/51040740?v=4" width="42;" alt="Lihuagreek"/>
|
||||
</a>
|
||||
<a href="https://github.com/likeshop-github" title="LikeShop技术社区">
|
||||
<img src="https://avatars.githubusercontent.com/u/77180968?v=4" width="42;" alt="LikeShop技术社区"/>
|
||||
</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>
|
||||
@ -292,6 +317,12 @@ Quick Reference
|
||||
<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>
|
||||
<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"/>
|
||||
</a>
|
||||
@ -310,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>
|
||||
@ -322,6 +359,9 @@ Quick Reference
|
||||
<a href="https://github.com/hweining" title="hweining">
|
||||
<img src="https://avatars.githubusercontent.com/u/8973985?v=4" width="42;" alt="hweining"/>
|
||||
</a>
|
||||
<a href="https://github.com/joyfully-W" title="joyfully-W">
|
||||
<img src="https://avatars.githubusercontent.com/u/32212924?v=4" width="42;" alt="joyfully-W"/>
|
||||
</a>
|
||||
<a href="https://github.com/k983551019" title="k983551019">
|
||||
<img src="https://avatars.githubusercontent.com/u/48147837?v=4" width="42;" alt="k983551019"/>
|
||||
</a>
|
||||
@ -343,9 +383,15 @@ 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>
|
||||
<a href="https://github.com/phygerr" title="phygerr">
|
||||
<img src="https://avatars.githubusercontent.com/u/42068889?v=4" width="42;" alt="phygerr"/>
|
||||
</a>
|
||||
<a href="https://github.com/Mowmowj" title="shelton">
|
||||
<img src="https://avatars.githubusercontent.com/u/24759562?v=4" width="42;" alt="shelton"/>
|
||||
</a>
|
||||
@ -392,12 +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=👆每天自动同步-->
|
||||
[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 版。
|
||||
|
3
assets/adb.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16" height="1em" width="1em">
|
||||
<path d="m10.213 1.471.691-1.26c.046-.083.03-.147-.048-.192-.085-.038-.15-.019-.195.058l-.7 1.27A4.832 4.832 0 0 0 8.005.941c-.688 0-1.34.135-1.956.404l-.7-1.27C5.303 0 5.239-.018 5.154.02c-.078.046-.094.11-.049.193l.691 1.259a4.25 4.25 0 0 0-1.673 1.476A3.697 3.697 0 0 0 3.5 5.02h9c0-.75-.208-1.44-.623-2.072a4.266 4.266 0 0 0-1.664-1.476ZM6.22 3.303a.367.367 0 0 1-.267.11.35.35 0 0 1-.263-.11.366.366 0 0 1-.107-.264.37.37 0 0 1 .107-.265.351.351 0 0 1 .263-.11c.103 0 .193.037.267.11a.36.36 0 0 1 .112.265.36.36 0 0 1-.112.264Zm4.101 0a.351.351 0 0 1-.262.11.366.366 0 0 1-.268-.11.358.358 0 0 1-.112-.264c0-.103.037-.191.112-.265a.367.367 0 0 1 .268-.11c.104 0 .19.037.262.11a.367.367 0 0 1 .107.265c0 .102-.035.19-.107.264ZM3.5 11.77c0 .294.104.544.311.75.208.204.46.307.76.307h.758l.01 2.182c0 .276.097.51.292.703a.961.961 0 0 0 .7.288.973.973 0 0 0 .71-.288.95.95 0 0 0 .292-.703v-2.182h1.343v2.182c0 .276.097.51.292.703a.972.972 0 0 0 .71.288.973.973 0 0 0 .71-.288.95.95 0 0 0 .292-.703v-2.182h.76c.291 0 .54-.103.749-.308.207-.205.311-.455.311-.75V5.365h-9v6.404Zm10.495-6.587a.983.983 0 0 0-.702.278.91.91 0 0 0-.293.685v4.063c0 .271.098.501.293.69a.97.97 0 0 0 .702.284c.28 0 .517-.095.712-.284a.924.924 0 0 0 .293-.69V6.146a.91.91 0 0 0-.293-.685.995.995 0 0 0-.712-.278Zm-12.702.283a.985.985 0 0 1 .712-.283c.273 0 .507.094.702.283a.913.913 0 0 1 .293.68v4.063a.932.932 0 0 1-.288.69.97.97 0 0 1-.707.284.986.986 0 0 1-.712-.284.924.924 0 0 1-.293-.69V6.146c0-.264.098-.491.293-.68Z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
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
@ -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
@ -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 |
4
assets/reactrouter.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg viewBox="0 0 256 140" fill="currentColor" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" height="1em" width="1em">
|
||||
<path d="M78.066 92.588c12.818 0 23.209-10.391 23.209-23.21 0-12.817-10.391-23.208-23.21-23.208-12.817 0-23.208 10.39-23.208 23.209 0 12.818 10.391 23.209 23.209 23.209Zm-54.857 46.417c12.818 0 23.209-10.39 23.209-23.209 0-12.817-10.391-23.208-23.21-23.208C10.392 92.588 0 102.978 0 115.796c0 12.818 10.39 23.21 23.209 23.21Zm209.582 0c12.818 0 23.209-10.39 23.209-23.209 0-12.817-10.39-23.208-23.209-23.208-12.818 0-23.209 10.39-23.209 23.208 0 12.818 10.391 23.21 23.21 23.21Z"/>
|
||||
<path d="M156.565 70.357c-.742-7.754-1.12-14.208-7.06-18.744-7.522-5.744-16.044-2.017-26.54-5.806C112.65 43.312 105 34.155 105 23.24 105 10.405 115.578 0 128.626 0c9.665 0 17.974 5.707 21.634 13.883 5.601 10.64 1.96 21.467 8.998 26.921 8.333 6.458 19.568 1.729 32.104 7.848a23.614 23.614 0 0 1 9.84 8.425A22.858 22.858 0 0 1 205 69.718c0 10.915-7.65 20.073-17.964 22.568-10.497 3.789-19.019.062-26.541 5.806-8.46 6.46-3.931 17.267-10.826 28.682-3.913 7.518-11.867 12.663-21.043 12.663-13.048 0-23.626-10.405-23.626-23.24 0-9.323 5.582-17.364 13.638-21.066 12.536-6.12 23.77-1.39 32.104-7.848 4.807-3.726 5.823-9.473 5.823-16.926Z" fill="currentColor"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
381
docs/adb.md
Normal file
@ -0,0 +1,381 @@
|
||||
Android ADB 备忘清单
|
||||
===
|
||||
|
||||
[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) 一起使用的一些最常见的命令及其用法
|
||||
|
||||
入门
|
||||
----
|
||||
|
||||
### 设备基础
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb devices` | 列出连接的设备
|
||||
`adb devices -l` | 列出连接的设备和种类
|
||||
`adb root` | 以 `root` 权限重新启动 `adbd`
|
||||
`adb start-server` | 启动 `adb` 服务器
|
||||
`adb kill-server` | 杀死 `adb` 服务器
|
||||
`adb remount` | 重新挂载具有读/写访问权限的文件系统
|
||||
`adb reboot` | 重启设备
|
||||
`adb reboot bootloader` | 将设备重新启动到快速启动
|
||||
`adb disable-verity` | 将设备重新启动到快速启动
|
||||
<!--rehype:className=left-align code-nowrap-->
|
||||
|
||||
---
|
||||
|
||||
- `wait-for-device` 可以在 `adb` 之后指定,以确保该命令在设备连接后运行
|
||||
- `-s` 可用于在多个连接时将命令发送到特定设备
|
||||
|
||||
#### 示例
|
||||
|
||||
```bash
|
||||
$ adb wait-for-device devices
|
||||
List of devices attached
|
||||
somedevice-1234 device
|
||||
someotherdevice-1234 device
|
||||
```
|
||||
|
||||
```bash
|
||||
$ adb -s somedevice-1234 root
|
||||
```
|
||||
|
||||
### Logcat
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb logcat` | 开始将日志消息打印到标准输出
|
||||
`adb logcat -g` | 显示当前日志缓冲区大小
|
||||
`adb logcat -G <size>` | 设置缓冲区大小(K 或 M)
|
||||
`adb logcat -c` | 清除日志缓冲区
|
||||
`adb logcat *:V` | 启用所有日志消息(详细)
|
||||
`adb logcat -f <filename>` | 转储到指定文件
|
||||
<!--rehype:className=left-align code-nowrap-->
|
||||
|
||||
#### 示例
|
||||
|
||||
```bash
|
||||
$ adb logcat -G 16M
|
||||
$ adb logcat *:V > output.log
|
||||
```
|
||||
|
||||
#### 过滤日志输出
|
||||
|
||||
- `V` 详细(最低优先级)
|
||||
- `D` 调试
|
||||
- `I` 信息
|
||||
- `W` 警告
|
||||
- `E` 错误
|
||||
- `F` 严重错误
|
||||
- `S` 静默(最高优先级)
|
||||
<!--rehype:className=cols-2 shortcuts style-none-->
|
||||
|
||||
过滤器表达式显示了优先级不低于 `警告` 的所有标记的所有日志消息:
|
||||
|
||||
```bash
|
||||
$ adb logcat *:W
|
||||
```
|
||||
|
||||
### 文件管理
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb push <local> <remote>` | 将本地复制到远程设备
|
||||
`adb pull <remote> <local>` | 将远程设备从设备复制到本地
|
||||
<!--rehype:className=left-align code-nowrap-->
|
||||
|
||||
#### 示例
|
||||
|
||||
```bash
|
||||
$ echo "This is a test" > test.txt
|
||||
$ adb push test.txt /sdcard/test.txt
|
||||
$ adb pull /sdcard/test.txt pulledTest.txt
|
||||
```
|
||||
|
||||
### 远程 Shell
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`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` | 启动指定包
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### 包安装
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb shell install <apk>` | 安装应用程序
|
||||
`adb shell install <path>` | 手机路径安装应用
|
||||
`adb shell install -r <path>` | 手机路径安装应用
|
||||
`adb shell uninstall <name>` | 删除应用程序
|
||||
<!--rehype:className=left-align code-nowrap-->
|
||||
|
||||
### Paths
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`/data/data/<package>/databases` | 应用程序数据库
|
||||
`/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 卡
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
---
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb shell ls` | 列出目录内容
|
||||
`adb shell ls -s` | 每个文件的打印尺寸
|
||||
`adb shell ls -R` | 递归列出子目录
|
||||
<!--rehype:className=left-align code-nowrap-->
|
||||
|
||||
### 手机信息
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb get-statе` | 打印设备状态
|
||||
`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'` | 打印当前应用程序的打开活动
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### 包信息
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb shell list packages` | 列出包名称
|
||||
`adb shell list packages -r` | 列出包名 + apks 的路径
|
||||
`adb shell list packages -3` | 列出第三方包名称
|
||||
`adb shell list packages -s` | 仅列出系统包
|
||||
`adb shell list packages -u` | 列出包名称 + 已卸载
|
||||
`adb shell dumpsys package packages` | 列出所有应用程序的信息
|
||||
`adb shell dump <name>` | 列出一个包裹的信息
|
||||
`adb shell path <package>` | apk文件的路径
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### 设备相关命令
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb reboot-recovery` | 重启设备进入恢复模式
|
||||
`adb reboot fastboot` | 重启设备进入恢复模式
|
||||
`adb shell screencap -p "/path/to/screenshot.png"` | 截图
|
||||
`adb shell screenrecord "/path/to/record.mp4"` | 录制设备屏幕
|
||||
`adb backup -apk -all -f backup.ab` | 备份设置和应用程序
|
||||
`adb backup -apk -shared -all -f backup.ab` | 备份设置、应用程序和共享存储
|
||||
`adb backup -apk -nosystem -all -f backup.ab` | 仅备份非系统应用程序
|
||||
`adb restore backup.ab` | 恢复以前的备份
|
||||
`adb shell am start -a android.intent.action.VIEW -d URL` | 打开网址
|
||||
`adb shell am start -t image/* -a android.intent.action.VIEW` | 打开画廊
|
||||
<!--rehype:className=code-nowrap left-align-->
|
||||
|
||||
### 权限
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb shell permissions groups` | 列出权限组定义
|
||||
`adb shell list permissions -g -r` | 列出权限详细信息
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### Logs
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`adb logcat [options] [filter] [filter]` | 查看设备日志
|
||||
`adb bugreport` | 打印错误报告
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
常见的 ADB 命令
|
||||
---
|
||||
|
||||
### 将文件推送到 Android 设备的下载文件夹
|
||||
|
||||
```bash
|
||||
$ adb push example.apk /mnt/Download/
|
||||
```
|
||||
|
||||
### 列出所有已安装的包并获取完整路径
|
||||
|
||||
```bash
|
||||
$ adb shell pm list packages -f
|
||||
```
|
||||
|
||||
### 从安卓设备中提取文件
|
||||
|
||||
```bash
|
||||
$ adb pull /mnt/Download/example.apk
|
||||
```
|
||||
|
||||
### 从主机安装 apk 到 Android 设备
|
||||
|
||||
```bash
|
||||
$ adb shell install example.apk
|
||||
```
|
||||
|
||||
### 从 Android 设备存储安装 apk
|
||||
|
||||
```bash
|
||||
$ adb shell install /mnt/Download/example.apk
|
||||
```
|
||||
|
||||
### 设置网络代理
|
||||
|
||||
```bash
|
||||
$ adb shell settings put global http_proxy <address>:<port>
|
||||
```
|
||||
|
||||
### 禁用网络代理
|
||||
|
||||
```bash
|
||||
$ adb shell settings put global http_proxy :0
|
||||
```
|
||||
|
||||
### 显示连接的设备并选择一个设备和外壳
|
||||
|
||||
```bash
|
||||
$ adb devices
|
||||
$ adb -s 7f1c864e shell
|
||||
```
|
||||
|
||||
`7f1c864e` 是设备 `ID`
|
||||
|
||||
### 通过 ip 地址无线连接到设备
|
||||
|
||||
```bash
|
||||
$ adb connect 192.168.56.101:5555
|
||||
```
|
||||
|
||||
### adb 通过 wifi
|
||||
<!--rehype:wrap-class=row-span-5-->
|
||||
|
||||
我们可以通过 `wifi` 或专门使用 `tcp` 连接使用 `adb`。 要通过 `wifi` 使用 `adb`,首先通过 `usb` 连接手机并启用 `usb` 调试。然后列出所有设备:
|
||||
|
||||
```bash
|
||||
$ adb devices
|
||||
# 这应该给出这样的输出:
|
||||
# device_id device
|
||||
```
|
||||
|
||||
现在检查 `android` 设备的 `ip`:
|
||||
|
||||
```bash
|
||||
$ adb shell ifconfig
|
||||
# 输出:
|
||||
|
||||
wlan0 Link encap:UNSPEC Driver icnss
|
||||
inet addr:XXX.XXX.X.XX Bcast:XXX.XXX.X.XXX
|
||||
```
|
||||
|
||||
记下 `inet addr` 后面的 `ip` 地址。我们稍后会需要它。现在在某个端口重新启动 `tcpip`:
|
||||
|
||||
```bash
|
||||
$ adb tcpip $port
|
||||
```
|
||||
|
||||
例如 5555:
|
||||
|
||||
```bash
|
||||
$ adb tcpip 5555
|
||||
```
|
||||
|
||||
您现在可以断开使用。 现在连接到设备只需给出以下命令:
|
||||
|
||||
```bash
|
||||
$ adb connect $ip:$port
|
||||
```
|
||||
|
||||
like:
|
||||
|
||||
```bash
|
||||
$ adb connect 192.168.1.4:5555
|
||||
```
|
||||
|
||||
### 从计算机上的 apk 文件安装应用程序
|
||||
|
||||
```bash
|
||||
$ adb install /Users/dev/projects/myapp.apk
|
||||
```
|
||||
|
||||
### 查找应用的 apk 路径
|
||||
|
||||
```bash
|
||||
$ adb shell pm path com.example.myapp
|
||||
```
|
||||
|
||||
将 `com.example.myapp` 替换为您自己的应用程序包名称
|
||||
|
||||
### 按名称查找应用的包名
|
||||
|
||||
```bash
|
||||
$ adb shell pm list package | grep app_name
|
||||
```
|
||||
|
||||
### 将 apk 从设备提取到您的计算机
|
||||
|
||||
```bash
|
||||
$ adb pull /data/app/com.example.myapp.apk ./
|
||||
```
|
||||
|
||||
### 将文件从计算机复制到设备
|
||||
|
||||
```bash
|
||||
$ adb push path/to/local/file /sdcard/foo.txt
|
||||
```
|
||||
|
||||
### 滚动屏幕
|
||||
|
||||
```bash
|
||||
$ adb shell input swipe 300 300 500 1000 # 上
|
||||
$ adb shell input swipe 500 1000 300 300 # 下
|
||||
```
|
||||
|
||||
### 发文本
|
||||
|
||||
使用虚拟键盘发送文本:
|
||||
|
||||
```bash
|
||||
$ adb shell input text "Hello World"
|
||||
```
|
||||
|
||||
### 发送按键事件
|
||||
|
||||
```bash
|
||||
$ adb shell input keyevent 66
|
||||
# 66 是回车键码
|
||||
```
|
||||
|
||||
### 发送点击
|
||||
|
||||
点击又名点击屏幕:
|
||||
|
||||
```bash
|
||||
$ adb shell input tap x y
|
||||
```
|
||||
|
||||
### 查看包的日志
|
||||
|
||||
```bash
|
||||
$ adb shell 'logcat --pid=$(pidof -s <package_name>)'
|
||||
```
|
||||
|
||||
查看特定包的日志
|
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++ 预处理器
|
||||
------------
|
||||
|
||||
|
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;
|
||||
}
|
||||
```
|
||||
|
||||
另见
|
||||
---------
|
||||
|
||||
|
156
docs/feds.md
Normal file
@ -0,0 +1,156 @@
|
||||
FED 前端导航
|
||||
===
|
||||
|
||||
前端开发导航快速参考备忘单展示了前端的一些工具
|
||||
|
||||
社区
|
||||
---
|
||||
|
||||
[CSDN](https://www.csdn.net/)<!--rehype:target=_blank&style=background: rgb(252 85 49/var(\-\-bg\-opacity));-->
|
||||
[GitHub](https://github.com/)<!--rehype:target=_blank&style=background: rgb(0 0 0/var(\-\-bg\-opacity));-->
|
||||
[InfoQ](http://www.infoq.com/cn)<!--rehype:target=_blank&style=background: rgb(66 133 244/var(\-\-bg\-opacity));-->
|
||||
[Medium](https://medium.com/topic/technology)<!--rehype:target=_blank-->
|
||||
[SegmentFault](https://segmentfault.com/)<!--rehype:target=_blank&style=background: rgb(0 150 94/var(\-\-bg\-opacity));-->
|
||||
[Stack Overflow](https://stackoverflow.com/)<!--rehype:target=_blank&style=background: rgb(244 130 37/var(\-\-bg\-opacity));-->
|
||||
[V2EX](https://www.v2ex.com/?tab=tech)<!--rehype:target=_blank&style=background: rgb(0 0 0/var(\-\-bg\-opacity));-->
|
||||
[博客园](https://www.cnblogs.com/)<!--rehype:target=_blank&style=background: rgb(46 122 203/var(\-\-bg\-opacity));-->
|
||||
[开源中国](https://www.oschina.net/)<!--rehype:target=_blank&style=background: rgb(43 179 81/var(\-\-bg\-opacity));-->
|
||||
[稀土掘金](https://juejin.im/)<!--rehype:target=_blank&style=background: rgb(30 128 255/var(\-\-bg\-opacity));-->
|
||||
[W3cplus](https://www.w3cplus.com/)<!--rehype:target=_blank-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
构建工具
|
||||
---
|
||||
|
||||
[Webpack](http://webpack.github.io/)<!--rehype:target=_blank&style=background: rgb(107 148 216/var(\-\-bg\-opacity));-->
|
||||
[NPM](https://www.npmjs.com/)<!--rehype:target=_blank&style=background: rgb(203 8 1/var(\-\-bg\-opacity));-->
|
||||
[Yarn](https://yarnpkg.com/zh-Hans/)<!--rehype:target=_blank&style=background: rgb(33 136 182/var(\-\-bg\-opacity));-->
|
||||
[pnpm](https://pnpm.io/)<!--rehype:target=_blank&style=background: rgb(246 146 32/var(\-\-bg\-opacity));-->
|
||||
[Lerna](https://lerna.js.org/)<!--rehype:target=_blank&style=background: rgb(147 51 234/var(\-\-bg\-opacity));-->
|
||||
[Vitejs](https://cn.vitejs.dev/)<!--rehype:target=_blank&style=background: rgb(188 52 254/var(\-\-bg\-opacity));-->
|
||||
[Gulp](https://gulpjs.com/)<!--rehype:target=_blank&style=background: rgb(207 70 71/var(\-\-bg\-opacity));-->
|
||||
[Parcel](https://en.parceljs.org/)<!--rehype:target=_blank&style=background: rgb(192 145 99/var(\-\-bg\-opacity));-->
|
||||
[Rollup](https://rollupjs.org/guide/en/)<!--rehype:target=_blank&style=background: rgb(239 51 53/var(\-\-bg\-opacity));-->
|
||||
[Turbopack](https://turbo.build/)<!--rehype:target=_blank&style=background: rgb(248 30 87/var(\-\-bg\-opacity));-->
|
||||
[Create React App](https://create-react-app.dev/)<!--rehype:target=_blank&style=background: rgb(60 106 146/var(\-\-bg\-opacity));-->
|
||||
[Browserify](http://browserify.org/)<!--rehype:target=_blank&style=background: rgb(60 106 146/var(\-\-bg\-opacity));-->
|
||||
[Yeoman](http://yeoman.io/)<!--rehype:target=_blank-->
|
||||
[Grunt](https://gruntjs.com/)<!--rehype:target=_blank-->
|
||||
[Babel](https://babeljs.io/)<!--rehype:target=_blank&style=background: rgb(245 218 85/var(\-\-bg\-opacity));-->
|
||||
[FIS3](https://fex-team.github.io/fis3/)<!--rehype:target=_blank-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
教程文档
|
||||
---
|
||||
|
||||
[MDN Web Docs](https://developer.mozilla.org/zh-CN/)<!--rehype:target=_blank&style=background: rgb(140 181 255/var(\-\-bg\-opacity));-->
|
||||
[ECMAScript 6 入门](https://es6.ruanyifeng.com/)<!--rehype:target=_blank-->
|
||||
[W3C 标准](http://w3help.org/)<!--rehype:target=_blank-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
JavaScript 工具
|
||||
---
|
||||
|
||||
[Chrome Dev Tools](https://www.google.cn/chrome/)<!--rehype:target=_blank-->
|
||||
[CoffeeScript](https://coffeescript.org/)<!--rehype:target=_blank-->
|
||||
[Firefox Developer Tools](https://www.mozilla.org/zh-CN/firefox/new/)<!--rehype:target=_blank-->
|
||||
[flow](https://flow.org/)<!--rehype:target=_blank&style=background: rgb(232 189 54/var(\-\-bg\-opacity));-->
|
||||
[TypeScript](https://www.typescriptlang.org/)<!--rehype:target=_blank&style=background: rgb(49 120 197/var(\-\-bg\-opacity));-->
|
||||
[JS 压缩,格式化](https://www.css-js.com/)<!--rehype:target=_blank-->
|
||||
[JSDoc](https://jsdoc.app/)<!--rehype:target=_blank&style=background: rgb(197 149 199/var(\-\-bg\-opacity));-->
|
||||
[UglifyJS](http://lisperator.net/uglifyjs/transform)<!--rehype:target=_blank-->
|
||||
[Prettier](https://prettier.io/)<!--rehype:target=_blank&style=background: rgb(197 149 199/var(\-\-bg\-opacity));-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
JavaScript 测试工具
|
||||
---
|
||||
|
||||
[Chai](http://chaijs.com/)<!--rehype:target=_blank&style=background: rgb(164 8 1/var(\-\-bg\-opacity));-->
|
||||
[ESLint](https://eslint.org/)<!--rehype:target=_blank&style=background: rgb(76 50 195/var(\-\-bg\-opacity));-->
|
||||
[JSHint](http://jshint.com/)<!--rehype:target=_blank-->
|
||||
[Jasmine](https://jasmine.github.io/)<!--rehype:target=_blank&style=background: rgb(138 65 130/var(\-\-bg\-opacity));-->
|
||||
[Jest](https://jestjs.io/)<!--rehype:target=_blank&style=background: rgb(158 79 101/var(\-\-bg\-opacity));-->
|
||||
[Mochajs](https://mochajs.org/)<!--rehype:target=_blank&style=background: rgb(141 103 72/var(\-\-bg\-opacity));-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
CSS 工具
|
||||
---
|
||||
|
||||
[30秒CSS](https://atomiks.github.io/30-seconds-of-css/)<!--rehype:target=_blank-->
|
||||
[Autoprefixer](https://github.com/postcss/autoprefixer)<!--rehype:target=_blank-->
|
||||
[ColorZilla](http://www.colorzilla.com/gradient-editor/)<!--rehype:target=_blank-->
|
||||
[CSS Protips](https://github.com/AllThingsSmitty/css-protips)<!--rehype:target=_blank-->
|
||||
[CSS3 Maker](http://www.css3maker.com/)<!--rehype:target=_blank-->
|
||||
[cssnano](http://cssnano.co/)<!--rehype:target=_blank-->
|
||||
[CSSPIN](https://webkul.github.io/csspin/)<!--rehype:target=_blank-->
|
||||
[CSSreference](https://cssreference.io/)<!--rehype:target=_blank-->
|
||||
[CSSTree](https://github.com/csstree/csstree)<!--rehype:target=_blank-->
|
||||
[CSS美化压缩](http://tool.css-js.com/)<!--rehype:target=_blank-->
|
||||
[Easing Functions Cheat Sheet](http://easings.net/zh-cn)<!--rehype:target=_blank-->
|
||||
[Emmet](https://www.emmet.io/)<!--rehype:target=_blank-->
|
||||
[est](http://ecomfe.github.io/est/)<!--rehype:target=_blank-->
|
||||
[Flex Layout Attribute](https://github.com/StefanKovac/flex-layout-attribute)<!--rehype:target=_blank-->
|
||||
[Grid.Guide](http://grid.guide/)<!--rehype:target=_blank-->
|
||||
[minireset.css](http://lesscss.org/)<!--rehype:target=_blank-->
|
||||
[Normalize.css](http://necolas.github.io/normalize.css/)<!--rehype:target=_blank-->
|
||||
[PostCSS](http://postcss.org/)<!--rehype:target=_blank-->
|
||||
[purifycss](https://github.com/purifycss/purifycss)<!--rehype:target=_blank-->
|
||||
[Less](https://lesscss.org/)<!--rehype:target=_blank&style=background: rgb(36 74 121/var(\-\-bg\-opacity));-->
|
||||
[SASS](http://sass-lang.com/)<!--rehype:target=_blank&style=background: rgb(191 64 128/var(\-\-bg\-opacity));-->
|
||||
[Sprite Cow](http://www.spritecow.com/)<!--rehype:target=_blank-->
|
||||
[Stylus](http://stylus-lang.com/)<!--rehype:target=_blank&style=background: rgb(126 194 66/var(\-\-bg\-opacity));-->
|
||||
[Stylelint](https://stylelint.io/)<!--rehype:target=_blank-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
框架类库
|
||||
---
|
||||
|
||||
[React](https://facebook.github.io/react/)<!--rehype:target=_blank&style=background: rgb(97 218 251/var(\-\-bg\-opacity));-->
|
||||
[Vue 中文](https://cn.vuejs.org/)<!--rehype:target=_blank&style=background: rgb(66 184 131/var(\-\-bg\-opacity));-->
|
||||
[Angular](https://angular.io/)<!--rehype:target=_blank&style=background: rgb(195 8 47/var(\-\-bg\-opacity));-->
|
||||
[jQuery](http://www.jquery123.com/)<!--rehype:target=_blank-->
|
||||
[Bootstrap](https://getbootstrap.com/)<!--rehype:target=_blank&style=background: rgb(113 44 249/var(\-\-bg\-opacity));-->
|
||||
[React Native 中文](https://reactnative.cn/)<!--rehype:target=_blank&style=background: rgb(36 120 194/var(\-\-bg\-opacity));-->
|
||||
[Flutter](https://flutter.dev/)<!--rehype:target=_blank&style=background: rgb(35 104 215/var(\-\-bg\-opacity));-->
|
||||
[RxJs](http://reactivex.io/rxjs/)<!--rehype:target=_blank-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
在线代码编辑器工具
|
||||
---
|
||||
|
||||
[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-->
|
||||
[Replit](https://replit.com/)<!--rehype:target=_blank-->
|
||||
[JSRUN.NET](https://jsrun.net/)<!--rehype:target=_blank-->
|
||||
[WebComponents.dev](https://webcomponents.dev/)<!--rehype:target=_blank-->
|
||||
[JS Bin](https://jsbin.com/)<!--rehype:target=_blank-->
|
||||
[RunKit](https://runkit.com/)<!--rehype:target=_blank-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
兼容、性能测试
|
||||
---
|
||||
|
||||
[Browser Sandbox](https://turbo.net/browsers)<!--rehype:target=_blank-->
|
||||
[Browserdiet](https://browserdiet.com/zh/)<!--rehype:target=_blank-->
|
||||
[browsershots](http://browsershots.org/)<!--rehype:target=_blank-->
|
||||
[BrowserStack](https://www.browserstack.com/)<!--rehype:target=_blank-->
|
||||
[Can I use](http://caniuse.com/)<!--rehype:target=_blank-->
|
||||
[httpstatus](https://httpstatus.io/)<!--rehype:target=_blank-->
|
||||
[Observatory](https://observatory.mozilla.org/)<!--rehype:target=_blank-->
|
||||
[PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights/?hl=zh-CN)<!--rehype:target=_blank-->
|
||||
[Security Headers](https://securityheaders.com/)<!--rehype:target=_blank-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
||||
CDN
|
||||
---
|
||||
|
||||
[cdnjs](https://cdnjs.com/)<!--rehype:target=_blank-->
|
||||
[jsDelivr](https://www.jsdelivr.com/)<!--rehype:target=_blank-->
|
||||
[前端静态资源库](https://cdn.baomitu.com/)<!--rehype:target=_blank-->
|
||||
[UNPKG](https://unpkg.com/)<!--rehype:target=_blank-->
|
||||
[Statically](https://statically.io/)<!--rehype:target=_blank-->
|
||||
[raw.githack.com](http://raw.githack.com/)<!--rehype:target=_blank-->
|
||||
<!--rehype:class=home-card-->
|
@ -157,12 +157,12 @@ with app.test_request_context():
|
||||
|
||||
### HTTP 方法
|
||||
|
||||
默认情况下,路由仅响应 `GET` 请求。您可以使用 `route()` 装饰器的方法参数来处理不同的 `HTTP` 方法
|
||||
默认路由仅响应 `GET` 请求。可以使用 `route()` 装饰器的方法参数来处理不同的 `HTTP` 方法
|
||||
|
||||
```py
|
||||
from flask import request
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
@app.route('/login',methods=['GET','POST'])
|
||||
def login():
|
||||
if request.method == 'POST':
|
||||
return do_the_login()
|
||||
@ -181,3 +181,75 @@ def login_get():
|
||||
def login_post():
|
||||
return do_the_login()
|
||||
```
|
||||
|
||||
### Blueprint
|
||||
|
||||
创建蓝图Bp1
|
||||
|
||||
```py
|
||||
from flask import Blueprint, abort, jsonify
|
||||
|
||||
# 定义Bp1,并定义url前缀为/img
|
||||
Bp1 = Blueprint('imgBlue', __name__, template_folder='templates', url_prefix='/img')
|
||||
|
||||
|
||||
@Bp1.route('/getimg')
|
||||
def getImg():
|
||||
try:
|
||||
return jsonify(name="img", size="100KB")
|
||||
except Exception as e:
|
||||
abort(e)
|
||||
```
|
||||
|
||||
创建蓝图Bp2
|
||||
|
||||
```py
|
||||
from flask import Blueprint, abort, jsonify
|
||||
|
||||
# 定义Bp2,并定义url前缀为/vedio
|
||||
Bp2 = Blueprint('vedioBlue', __name__, template_folder='templates', url_prefix='/vedio')
|
||||
|
||||
|
||||
@Bp2.route('/getvedio')
|
||||
def getVedio():
|
||||
try:
|
||||
return jsonify(name="vedio", size="100GB")
|
||||
except Exception as e:
|
||||
abort(e)
|
||||
```
|
||||
|
||||
在flask app中引用蓝图Bp1和Bp2
|
||||
|
||||
```py
|
||||
from flask import Flask, jsonify
|
||||
from lantu.img import Bp1
|
||||
from lantu.vedio import Bp2
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# 注册蓝图到app
|
||||
app.register_blueprint(Bp1)
|
||||
app.register_blueprint(Bp2)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return jsonify(name='phyger')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host="127.0.0.1", debug=True)
|
||||
```
|
||||
|
||||
简单测试
|
||||
|
||||
```bash
|
||||
curl http://127.0.0.1:5000/
|
||||
>> {"name":"phyger"}
|
||||
|
||||
curl http://127.0.0.1:5000/img/getimg
|
||||
>> {"name": "img", "size": "100KB"}
|
||||
|
||||
curl http://127.0.0.1:5000/vedio/getvedio
|
||||
>> {"name": "vedio", "size": "100GB"}
|
||||
```
|
||||
|
@ -70,7 +70,7 @@ func say(message string) {
|
||||
多行注释 */
|
||||
```
|
||||
|
||||
### 如果语句
|
||||
### if 语句
|
||||
|
||||
```go
|
||||
if true {
|
||||
@ -431,7 +431,7 @@ for {
|
||||
}
|
||||
```
|
||||
|
||||
Golang 结构和映射
|
||||
Golang 结构和Maps
|
||||
--------
|
||||
|
||||
### 定义
|
||||
@ -467,7 +467,7 @@ v := Vertex{X: 1}
|
||||
|
||||
您还可以输入字段名
|
||||
|
||||
### 映射
|
||||
### Maps
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
```go
|
||||
@ -511,7 +511,7 @@ fmt.Println(plus(1, 2))
|
||||
fmt.Println(plusPlus(1, 2, 3))
|
||||
```
|
||||
|
||||
### 多次返回
|
||||
### 多返回值
|
||||
|
||||
```go
|
||||
func vals() (int, int) {
|
||||
@ -533,7 +533,7 @@ r1, r2 := func() (string, string) {
|
||||
fmt.Println(r1, r2)
|
||||
```
|
||||
|
||||
### 命名返回
|
||||
### 命名返回值
|
||||
|
||||
```go
|
||||
func split(sum int) (x, y int) {
|
||||
@ -546,7 +546,7 @@ fmt.Println(x) // => 7
|
||||
fmt.Println(y) // => 10
|
||||
```
|
||||
|
||||
### 变量函数
|
||||
### 可变参数函数
|
||||
|
||||
```go
|
||||
func sum(nums ...int) {
|
||||
@ -557,7 +557,7 @@ func sum(nums ...int) {
|
||||
}
|
||||
fmt.Println(total)
|
||||
}
|
||||
sum(1, 2) //=> [1 2] 3
|
||||
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
|
||||
@ -987,7 +987,7 @@ Go 命令
|
||||
`GOOS` | 编译系统
|
||||
`GOARCH` | 编译arch
|
||||
`GO111MODULE` | gomod开关
|
||||
`GOPROXY` | go代理 <https://goproxy.io> <https://goproxy.cn>
|
||||
`GOPROXY` | go代理 <https://goproxy.io> <https://goproxy.cn> <https://mirrors.aliyun.com/goproxy/>
|
||||
`GOSSAFUNC` | 生成 `SSA.html` 文件,展示代码优化的每一步 `GOSSAFUNC=func_name go build`
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
|
@ -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) 项目的一部分。这个快速参考备忘单显示了它的常用命令使用清单
|
||||
|
||||
入门
|
||||
---
|
||||
|
36
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 {
|
||||
@ -816,6 +835,9 @@ method.invoke(classLoader, url);
|
||||
- `SecureRandom` 实例用于生成安全的伪随机数流
|
||||
- `UUID` 表示一个不可变的通用唯一标识符
|
||||
- `Vector` 实现了一个可增长的对象数组
|
||||
- `LocalDate` 表示没有时区的日期,只包含年月日,不可变并且线程安全的,java8 及以上版本可用
|
||||
- `LocalTime` 表示没有时区的时间,只包含时分秒,不可变并且线程安全的,java8 及以上版本可用
|
||||
- `LocalDateTime` 表示没有时区的日期时间,同时包含年月日时分秒,不可变并且线程安全的,java8 及以上版本可用
|
||||
|
||||
另见
|
||||
---
|
||||
|
@ -1190,6 +1190,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 绑定
|
||||
----
|
||||
|
||||
|
@ -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
@ -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)_
|
@ -293,7 +293,7 @@ print(a ^ b) -- 64.0
|
||||
---
|
||||
|
||||
### 运算符
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
<!--rehype:wrap-class=row-span-3-->
|
||||
|
||||
#### 关系运算符
|
||||
|
||||
|
@ -28,15 +28,15 @@ a.txt: b.txt c.txt
|
||||
|
||||
### 文件命令
|
||||
|
||||
文件会以 `GNUmakefile`(不推荐使用)、`Makefile`、`makefile` 查找目录下的名称。
|
||||
make命令会以 `GNUmakefile`(不推荐使用)、`makefile`、`Makefile`(推荐使用)的顺序查找当前目录下的文件。
|
||||
|
||||
#### 自定义文件名称
|
||||
#### 自定义文件路径
|
||||
|
||||
```bash
|
||||
$ make target -f NAME
|
||||
$ make target -f FILE
|
||||
```
|
||||
|
||||
我们可以使用 `-f NAME` 来指定需要编译的文件名
|
||||
我们可以使用 `-f FILE` 来指定makefile文件的路径
|
||||
|
||||
#### 隐式生成
|
||||
|
||||
|
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)
|
||||
```
|
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
@ -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-->
|
@ -838,6 +838,16 @@ H2 部分
|
||||
|
||||
默认表格末尾列`右对齐`,添加 `<!--rehype:className=left-align-->` 类让其`左对齐`
|
||||
|
||||
### 强制 code 不换行
|
||||
|
||||
| Command | Description |
|
||||
| ---- | ---- |
|
||||
| `adb remount` | Remounts file system with read/write access |
|
||||
| `adb reboot bootloader` | Reboots the device into fastboot |
|
||||
<!--rehype:className=show-header code-nowrap-->
|
||||
|
||||
添加 `<!--rehype:className=code-nowrap-->` 注释
|
||||
|
||||
列表
|
||||
---
|
||||
|
||||
|
1071
docs/reactrouter.md
Normal file
@ -1350,6 +1350,7 @@ const point = [3, 4] as const
|
||||
```
|
||||
|
||||
### satisfies
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
`satisfies` 允许将验证表达式的类型与某种类型匹配,而无需更改该表达式的结果类型。
|
||||
|
||||
@ -1385,10 +1386,10 @@ const palette = {
|
||||
// undefined | number
|
||||
const redComponent = palette.red.at(0)
|
||||
```
|
||||
|
||||
<!--rehype:className=wrap-text-->
|
||||
|
||||
### 范型实例化表达式
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
不使用的情况下:
|
||||
|
||||
@ -1432,6 +1433,207 @@ const makeStringBox = makeBox<string>;
|
||||
makeStringBox(42);
|
||||
```
|
||||
|
||||
### 识别全局修改模块
|
||||
|
||||
```ts
|
||||
declare global {
|
||||
interface String {
|
||||
fancyFormat(opts: FancyOption): string;
|
||||
}
|
||||
}
|
||||
export interface FancyOption {
|
||||
fancinessLevel: number;
|
||||
}
|
||||
```
|
||||
|
||||
.d.ts 模版
|
||||
---
|
||||
|
||||
### Module: Plugin
|
||||
|
||||
例如,当您想使用扩展另一个库的 JavaScript 代码时
|
||||
|
||||
```ts
|
||||
import { greeter } from "super-greeter";
|
||||
// 普通欢迎 API
|
||||
greeter(2);
|
||||
greeter("Hello world");
|
||||
// 现在我们在运行时用一个新函数扩展对象
|
||||
import "hyper-super-greeter";
|
||||
greeter.hyperGreet();
|
||||
```
|
||||
|
||||
"`super-greeter`" 的定义:
|
||||
|
||||
```ts
|
||||
/* 此示例说明如何为您的函数设置多个重载 */
|
||||
export interface GreeterFunction {
|
||||
(name: string): void
|
||||
(time: number): void
|
||||
}
|
||||
/* 此示例显示如何导出接口指定的函数 */
|
||||
export const greeter: GreeterFunction;
|
||||
```
|
||||
|
||||
我们可以像下面这样扩展现有模块:
|
||||
|
||||
```ts
|
||||
/* 导入这个模块添加到的模块 */
|
||||
import { greeter } from "super-greeter";
|
||||
/* 声明与上面导入的模块相同的模块,然后我们扩展 greeter 函数的现有声明 */
|
||||
export module "super-greeter" {
|
||||
export interface GreeterFunction {
|
||||
/** Greets even better! */
|
||||
hyperGreet(): void;
|
||||
}
|
||||
}
|
||||
```
|
||||
<!--rehype:className=wrap-text-->
|
||||
|
||||
### 全局库模板 Global .d.ts
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
全局库可能如下所示:
|
||||
|
||||
```ts
|
||||
function createGreeting(s) {
|
||||
return "Hello, " + s;
|
||||
}
|
||||
```
|
||||
|
||||
或者像这样:
|
||||
|
||||
```ts
|
||||
window.createGreeting = function (s) {
|
||||
return "Hello, " + s;
|
||||
};
|
||||
```
|
||||
|
||||
<pur>类型声明示例</pur>
|
||||
|
||||
```ts
|
||||
/* 可以作为 myLib(3) 此处包含这些调用签名 */
|
||||
declare function myLib(a: string): string;
|
||||
declare function myLib(a: number): number;
|
||||
/* 如果你希望这个库的名称是一个有效的类型名称,你可以在这里这样做例如,这允许我们写 'var x: myLib'; 确保这确实有意义! 如果没有,只需删除此声明并在下面的命名空间内添加类型 */
|
||||
interface myLib {
|
||||
name: string;
|
||||
length: number;
|
||||
extras?: string[];
|
||||
}
|
||||
/* 如果您的库在全局变量上公开了属性,请将它们放在此处。 您还应该在此处放置类型(接口和类型别名) */
|
||||
declare namespace myLib {
|
||||
// 我们可以写 'myLib.timeout = 50;'
|
||||
let timeout: number;
|
||||
// 我们可以访问 'myLib.version',但不能更改它
|
||||
const version: string;
|
||||
// 我们可以通过 'let c = new myLib.Cat(42)' 创建一些类或参考例如 '函数 f(c: myLib.Cat) { ... }
|
||||
class Cat {
|
||||
constructor(n: number);
|
||||
// 我们可以从 'Cat' 实例中读取 'c.age'
|
||||
readonly age: number;
|
||||
// 我们可以从 'Cat' 实例调用 'c.purr()'
|
||||
purr(): void;
|
||||
}
|
||||
// 我们可以将变量声明为
|
||||
// 'var s: myLib.CatSettings = { weight: 5, name: "Maru" };'
|
||||
interface CatSettings {
|
||||
weight: number;
|
||||
name: string;
|
||||
tailLength?: number;
|
||||
}
|
||||
// 我们可以写 'const v: myLib.VetID = 42;'
|
||||
// 或 'const v: myLib.VetID = "bob";'
|
||||
type VetID = string | number;
|
||||
// 我们可以调用 'myLib.checkCat(c)' 或 'myLib.checkCat(c, v);'
|
||||
function checkCat(c: Cat, s?: VetID);
|
||||
}
|
||||
```
|
||||
<!--rehype:className=wrap-text-->
|
||||
|
||||
### Module: Function
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
||||
```ts
|
||||
import greeter from "super-greeter";
|
||||
greeter(2);
|
||||
greeter("Hello world");
|
||||
```
|
||||
|
||||
要处理通过 `UMD` 和模块导入:
|
||||
|
||||
```ts
|
||||
/* 如果此模块是一个 UMD 模块,在模块加载器环境之外加载时公开全局变量“myFuncLib”,请在此处声明该全局变量。 否则,删除此声明 */
|
||||
export as namespace myFuncLib;
|
||||
/* 此声明指定该函数是从文件中导出的对象 */
|
||||
export = Greeter;
|
||||
/* 此示例说明如何为您的函数设置多个重载 */
|
||||
declare function Greeter(name: string): Greeter.NamedReturnType;
|
||||
declare function Greeter(length: number): Greeter.LengthReturnType;
|
||||
```
|
||||
<!--rehype:className=wrap-text-->
|
||||
|
||||
如果你也想从你的模块中公开类型,你可以把它们放在这个块中。 通常你会想要描述函数返回类型的形状; 如本例所示,应在此处声明该类型,请注意,如果您决定包含此命名空间,则模块可能会被错误地导入为命名空间对象,除非 `--esModuleInterop` 已打开: `import * as x from '[~THE MODULE~]';` 错误的!不要这样做!
|
||||
|
||||
```ts
|
||||
declare namespace Greeter {
|
||||
export interface LengthReturnType {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
export interface NamedReturnType {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
}
|
||||
/**
|
||||
* 如果模块也有属性,在这里声明它们。 例如,这个声明说这个代码是合法的:
|
||||
* import f = require('super-greeter');
|
||||
* console.log(f.defaultName);
|
||||
*/
|
||||
export const defaultName: string;
|
||||
export let defaultLength: number;
|
||||
}
|
||||
```
|
||||
<!--rehype:className=wrap-text-->
|
||||
|
||||
### Module: Class
|
||||
|
||||
例如,当您想要使用如下所示的 `JavaScript` 代码时:
|
||||
|
||||
```ts
|
||||
const Greeter = require("super-greeter");
|
||||
const greeter = new Greeter();
|
||||
greeter.greet();
|
||||
```
|
||||
|
||||
要处理通过 `UMD` 和模块导入:
|
||||
|
||||
```ts
|
||||
export as namespace "super-greeter";
|
||||
/* 此声明指定类构造函数是从文件中导出的对象 */
|
||||
export = Greeter;
|
||||
/* 在此类中编写模块的方法和属性 */
|
||||
declare class Greeter {
|
||||
constructor(customGreeting?: string);
|
||||
greet: void;
|
||||
myMethod(opts: MyClass.MyClassMethodOptions): number;
|
||||
}
|
||||
```
|
||||
<!--rehype:className=wrap-text-->
|
||||
|
||||
如果你也想从你的模块中公开类型,你可以把它们放在这个块中,如果您决定包含此命名空间,则模块可能会被错误地导入为命名空间对象,除非 --esModuleInterop 已打开:
|
||||
`import * as x from '[~THE MODULE~]';` 错误的! 不要这样做!
|
||||
|
||||
```ts
|
||||
declare namespace MyClass {
|
||||
export interface MyClassMethodOptions {
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
}
|
||||
```
|
||||
<!--rehype:className=wrap-text-->
|
||||
|
||||
CLI
|
||||
---
|
||||
|
||||
@ -1463,7 +1665,7 @@ $ tsc app.ts util.ts --target esnext --outfile index.js
|
||||
`--init` _boolean_ | 初始化 TypeScript 项目并创建 tsconfig.json 文件
|
||||
`--listFilesOnly` _boolean_ | 打印作为编译一部分的文件名,然后停止处理
|
||||
`--locale` _string_ | 设置来自 TypeScript 的消息传递语言。 这不影响发射
|
||||
`--project` _string_ | 编译项目给定其配置文件的路径,或带有“tsconfig.json”的文件夹
|
||||
`--project` _string_ | 编译项目给定其配置文件的路径,或带有 'tsconfig.json' 的文件夹
|
||||
`--showConfig` _boolean_ | 打印最终配置而不是构建
|
||||
`--version` _boolean_ | 打印编译器的版本
|
||||
<!--rehype:className=style-list-->
|
||||
|
@ -5,16 +5,16 @@ VSCode 备忘清单
|
||||
|
||||
## Windows
|
||||
|
||||
### 一般的
|
||||
### 通用
|
||||
|
||||
| - | - |
|
||||
|-----------------------------|------------------------|
|
||||
| `Ctrl` `Shift` `P` _/_ `F1` | 显示命令面板 |
|
||||
| `Ctrl` `P` | 快速打开,转到文件 |
|
||||
| `Ctrl` `Shift` `N` | 新窗户 |
|
||||
| `Ctrl` `Shift` `W` | 关闭窗口 |
|
||||
| `Ctrl` `,` | 用户设置 |
|
||||
| `Ctrl` `K` `Ctrl` `S` | 键盘快捷键 |
|
||||
| `Ctrl` `Shift` `N` | 打开新窗口 |
|
||||
| `Ctrl` `Shift` `W` | 关闭当前窗口 |
|
||||
| `Ctrl` `,` | 打开用户设置 |
|
||||
| `Ctrl` `K` `Ctrl` `S` | 打开键盘快捷键设置 |
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 基本编辑
|
||||
@ -36,16 +36,16 @@ VSCode 备忘清单
|
||||
| `Ctrl` `End` | 转到文件末尾 |
|
||||
| `Ctrl` `↑` _/_ `↓` | 向上/向下滚动行 |
|
||||
| `Alt` `PgUp` _/_ `PgDn` | 向上/向下滚动页面 |
|
||||
| `Ctrl` `Shift` `[` | 折叠(折叠)区域 |
|
||||
| `Ctrl` `Shift` `]` | 展开(展开)区域 |
|
||||
| `Ctrl` `K` `Ctrl` `[` | 折叠(折叠)所有子区域 |
|
||||
| `Ctrl` `K` `Ctrl` `]` | 展开(展开)所有子区域 |
|
||||
| `Ctrl` `K` `Ctrl` `0` | 折叠(折叠)所有区域 |
|
||||
| `Ctrl` `K` `Ctrl` `J` | 展开(展开)所有区域 |
|
||||
| `Ctrl` `Shift` `[` | 折叠区域 |
|
||||
| `Ctrl` `Shift` `]` | 展开区域 |
|
||||
| `Ctrl` `K` `Ctrl` `[` | 折叠所有子区域 |
|
||||
| `Ctrl` `K` `Ctrl` `]` | 展开所有子区域 |
|
||||
| `Ctrl` `K` `Ctrl` `0` | 折叠所有区域 |
|
||||
| `Ctrl` `K` `Ctrl` `J` | 展开所有区域 |
|
||||
| `Ctrl` `K` `Ctrl` `C` | 添加行注释 |
|
||||
| `Ctrl` `K` `Ctrl` `U` | 删除行注释 |
|
||||
| `Ctrl` `/` | 切换行注释 |
|
||||
| `Shift` `Alt` `A` | 切换块评论 |
|
||||
| `Shift` `Alt` `A` | 切换块注释 |
|
||||
| `Alt` `Z` | 切换自动换行 |
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
@ -54,28 +54,28 @@ VSCode 备忘清单
|
||||
| - | - |
|
||||
|----------------------|--------------------|
|
||||
| `Ctrl` `T` | 显示所有符号 |
|
||||
| `Ctrl` `G` | 去线 |
|
||||
| `Ctrl` `G` | 跳转到指定行数 |
|
||||
| `Ctrl` `P` | 转到文件 |
|
||||
| `Ctrl` `Shift` `O` | 转到符号 |
|
||||
| `Ctrl` `Shift` `M` | 显示问题面板 |
|
||||
| `F8` | 转到下一个错误 |
|
||||
| `Shift` `F8` | 转到上一个错误 |
|
||||
| `Ctrl` `Shift` `Tab` | 浏览编辑组历史 |
|
||||
| `Alt` `←` _/_ `→` | 后退/前进 |
|
||||
| `Ctrl` `M` | 切换 Tab 移动焦点 |
|
||||
| `Alt` `←` _/_ `→` | 后退/前进 |
|
||||
| `Ctrl` `M` | 切换按 Tab 移动焦点 |
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 搜索和替换
|
||||
|
||||
| - | - |
|
||||
|---------------------------|---------------------------------|
|
||||
| `Ctrl` `F` | 寻找 |
|
||||
| `Ctrl` `H` | 代替 |
|
||||
| `Ctrl` `F` | 查找 |
|
||||
| `Ctrl` `H` | 替换 |
|
||||
| `F3` _/_ `Shift` `F3` | 查找下一个/上一个 |
|
||||
| `Alt` `Enter` | 选择所有出现的查找匹配项 |
|
||||
| `Ctrl` `D` | 将选择添加到下一个查找匹配项 |
|
||||
| `Ctrl` `K` `Ctrl` `D` | 将最后一个选择移动到下一个查找匹配项 |
|
||||
| `Alt` `C` _/_ `R` _/_ `W` | 切换区分大小写/正则表达式/整个单词 |
|
||||
| `Ctrl` `D` | 将所选内容设置为查找关键词 |
|
||||
| `Ctrl` `K` `Ctrl` `D` | 将上一个选择移动到下一个查找匹配项 |
|
||||
| `Alt` `C` _/_ `R` _/_ `W` | 切换区分大小写/正则表达式/全字匹配 |
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 多光标和选择
|
||||
@ -90,7 +90,7 @@ VSCode 备忘清单
|
||||
| `Ctrl` `Shift` `L` | 选择当前选择的所有匹配项 |
|
||||
| `Ctrl` `F2` | 选择当前单词的所有出现 |
|
||||
| `Shift` `Alt` `→` | 展开选择 |
|
||||
| `Shift` `Alt` `←` | 收缩选择 |
|
||||
| `Shift` `Alt` `←` | 收起选择 |
|
||||
| `Shift` `Alt` `<Drag>` | 列(框)选择 |
|
||||
| `Ctrl` `Shift` `Alt` `<Arrow>` | 列(框)选择 |
|
||||
| `Ctrl` `Shift` `Alt` `PgUp` _/_ `PgDn` | 列(框)选择页上/下 |
|
||||
@ -100,17 +100,17 @@ VSCode 备忘清单
|
||||
|
||||
| - | - |
|
||||
|-----------------------------|-----------------|
|
||||
| `Ctrl` `<Space>` `Ctrl` `I` | 触发建议 |
|
||||
| `Ctrl` `Shift` `<Space>` | 触发参数提示 |
|
||||
| `Ctrl` `<Space>` `Ctrl` `I` | 显示建议 |
|
||||
| `Ctrl` `Shift` `<Space>` | 显示参数提示 |
|
||||
| `Shift` `Alt` `F` | 格式化文档 |
|
||||
| `Ctrl` `K` `Ctrl` `F` | 格式选择 |
|
||||
| `Ctrl` `K` `Ctrl` `F` | 格式化所选区域 |
|
||||
| `F12` | 转到定义 |
|
||||
| `Alt` `F12` | 窥视定义 |
|
||||
| `Ctrl` `K` `F12` | 打开定义到一边 |
|
||||
| `Ctrl` `.` | 快速解决 |
|
||||
| `Shift` `F12` | 显示参考 |
|
||||
| `Alt` `F12` | 速览定义 |
|
||||
| `Ctrl` `K` `F12` | 在侧边栏中打开定义 |
|
||||
| `Ctrl` `.` | 快速修复 |
|
||||
| `Shift` `F12` | 显示引用 |
|
||||
| `F2` | 重命名符号 |
|
||||
| `Ctrl` `K` `Ctrl` `X` | 修剪尾随空格 |
|
||||
| `Ctrl` `K` `Ctrl` `X` | 删除尾随空格 |
|
||||
| `Ctrl` `K` `M` | 更改文件语言 |
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
@ -121,8 +121,8 @@ VSCode 备忘清单
|
||||
| `Ctrl` `F4` `Ctrl` `W` | 关闭编辑器 |
|
||||
| `Ctrl` `K` `F` | 关闭文件夹 |
|
||||
| `Ctrl` `\` | 拆分编辑器 |
|
||||
| `Ctrl` `1` _/_ `2` _/_ `3` | 专注于第一、第二或第三编辑组 |
|
||||
| `Ctrl` `K` `Ctrl` `←` _/_ `→` | 专注于上一个/下一个编辑组 |
|
||||
| `Ctrl` `1` _/_ `2` _/_ `3` | 将焦点切换到第一/二/三编辑组 |
|
||||
| `Ctrl` `K` `Ctrl` `←` _/_ `→` | 将焦点切换到上/下一个编辑组 |
|
||||
| `Ctrl` `Shift` `PgUp` _/_ `PgDn` | 向左/向右移动编辑器 |
|
||||
| `Ctrl` `K` `←` _/_ `→` | 移动活动编辑器组 |
|
||||
<!--rehype:className=shortcuts-->
|
||||
@ -137,11 +137,11 @@ VSCode 备忘清单
|
||||
| `Ctrl` `Shift` `S` | 另存为 |
|
||||
| `Ctrl` `K` `S` | 保存所有 |
|
||||
| `Ctrl` `F4` | 关闭 |
|
||||
| `Ctrl` `K` `Ctrl` `W` | 关闭松油 |
|
||||
| `Ctrl` `K` `Ctrl` `W` | 关闭所有 |
|
||||
| `Ctrl` `Shift` `T` | 重新打开关闭的编辑器 |
|
||||
| `Ctrl` `K` `Enter` | 保持预览模式编辑器打开 |
|
||||
| `Ctrl` `Tab` | Open next |
|
||||
| `Ctrl` `Shift` `Tab` | Open previous |
|
||||
| `Ctrl` `Tab` | 打开下一项 |
|
||||
| `Ctrl` `Shift` `Tab` | 打开上一项 |
|
||||
| `Ctrl` `K` `P` | 复制活动文件的路径 |
|
||||
| `Ctrl` `K` `R` | 在资源管理器中显示活动文件 |
|
||||
| `Ctrl` `K` `O` | 在新窗口/实例中显示活动文件 |
|
||||
@ -175,12 +175,12 @@ VSCode 备忘清单
|
||||
| `F9` | 切换断点 |
|
||||
| `F5` | 开始/继续 |
|
||||
| `Shift` `F5` | 停止 |
|
||||
| `Shift` `F11` _/_ `F11` | 进/出 |
|
||||
| `F10` | 跨过去 |
|
||||
| `Shift` `F11` _/_ `F11` | 单步调试/跳出 |
|
||||
| `F10` | 单步跳过 |
|
||||
| `Ctrl` `K` `Ctrl` `I` | 显示悬停 |
|
||||
| `Ctrl` <code>\`</code> | 显示综合终端 |
|
||||
| `Ctrl` `Shift` <code>\`</code> | 创建一个新终端 |
|
||||
| `Ctrl` `C` | 复制选择 |
|
||||
| `Ctrl` `C` | 复制所选内容 |
|
||||
| `Ctrl` `V` | 粘贴到活动终端 |
|
||||
| `Ctrl` `↑` _/_ `↓` | 向上/向下滚动 |
|
||||
| `Shift` `PgUp` _/_ `PgDn` | 向上/向下滚动页面 |
|
||||
|
11
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wcj/reference",
|
||||
"version": "1.32.0",
|
||||
"version": "1.35.0",
|
||||
"description": "为开发人员分享快速参考备忘单(主要是方便自己)。",
|
||||
"author": "jaywcjlove",
|
||||
"license": "MIT",
|
||||
@ -21,11 +21,18 @@
|
||||
"url": "https://github.com/jaywcjlove/reference/issues"
|
||||
},
|
||||
"keywords": [],
|
||||
"lint-staged": {
|
||||
"**/*.{mjs,css,json,prettierrc,lintstagedrc}": "prettier --write",
|
||||
"*.md": "markdownlint --fix",
|
||||
"docs/*.md": "markdownlint --fix"
|
||||
},
|
||||
"devDependencies": {
|
||||
"husky": "^8.0.1",
|
||||
"lint-staged": "^13.0.3",
|
||||
"prettier": "^2.7.1",
|
||||
"refs-cli": "^1.2.10"
|
||||
"refs-cli": "^1.2.12",
|
||||
"markdownlint": "^0.27.0",
|
||||
"markdownlint-cli": "^0.32.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
|