diff --git a/README.md b/README.md index fad431dda56..bb57956b264 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,8 @@ Huid Quick Reference ## 服务端 [mysql](./docs/software/backend/mysql.md) [redis](./docs/software/backend/redis.md) -[nginx](./docs/software/backend/nginx.md) +[nginx](./docs/software/backend/nginx.md) +[mitmproxy](./docs/software/backend/mitmproxy.md) ## 前端 @@ -51,13 +52,14 @@ Huid Quick Reference # 实践 --- -## git -[GIT 备忘](./docs/practice/git.md) +## 文章 +[git-实践](./docs/practice/git-实践.md) -[CURL 备忘](./docs/practice/curl.md) +[CURL-实践](./docs/practice/CURL-实践.md) -[Linux - dd 备忘](./docs/practice/linux-dd.md) +[Linux-dd-实践](./docs/practice/Linux-dd-实践.md) + diff --git a/docs/lang/linux/ps.md b/docs/lang/linux/ps.md index 3c13209bd91..3b8958c177f 100644 --- a/docs/lang/linux/ps.md +++ b/docs/lang/linux/ps.md @@ -1,6 +1,10 @@ ps === +这是开始使用 PS 命令快速参考备忘单,可以帮助用户更高效地浏览网页 + +入门 +---- ## 查看 进程运行 时长 ```bash diff --git a/docs/practice/curl.md "b/docs/practice/CURL-\345\256\236\350\267\265.md" similarity index 95% rename from docs/practice/curl.md rename to "docs/practice/CURL-\345\256\236\350\267\265.md" index 0093e72c8b7..a29b58a15e1 100644 --- a/docs/practice/curl.md +++ "b/docs/practice/CURL-\345\256\236\350\267\265.md" @@ -1,10 +1,13 @@ -CURL 备忘 +curl 的具体实践 === -计算请求时的各个响应时间 ---- +curl 的具体实践 + +入门 +---- + +## 查看 进程运行 时长 - ### curl ```bash preview curl -o /dev/null -s -w \ diff --git a/docs/practice/linux-dd.md "b/docs/practice/Linux-dd-\345\256\236\350\267\265.md" similarity index 100% rename from docs/practice/linux-dd.md rename to "docs/practice/Linux-dd-\345\256\236\350\267\265.md" diff --git a/docs/practice/git.md "b/docs/practice/git-\345\256\236\350\267\265.md" similarity index 100% rename from docs/practice/git.md rename to "docs/practice/git-\345\256\236\350\267\265.md" diff --git a/docs/software/backend/mitmproxy.md b/docs/software/backend/mitmproxy.md new file mode 100644 index 00000000000..b34f80f0558 --- /dev/null +++ b/docs/software/backend/mitmproxy.md @@ -0,0 +1,50 @@ +mitmproxy +=== + +## MacOS 安装 +```bash +brew install --cask mitmproxy --verbose +``` + +## 证书 +``` +~/.mitmproxy/ +``` + +## 例子 +```python + +# -*- coding:utf-8 -*- + +from mitmproxy import ctx +# from save_mongo import save_task +import json + +def response(flow): + """获取粉丝数据""" + print("debug------") + urls = [ + "xxx/use", + "/yyyy", + "/eeee", + "/ddd", + "/cccc", + ] + + for u in urls: + if u in flow.request.url: + # 修复状态码 + if flow.response.status_code == 400: + flow.response.status_code = 200 + + # 修复 JSON 结构 + data = { + "code": 200, + "message": "success" + } + + # 返回修复后的响应 + flow.response.content = json.dumps(data).encode('utf-8') + return response + +``` \ No newline at end of file diff --git a/package.json b/package.json index 4c9352e39b0..c41aa328ff3 100644 --- a/package.json +++ b/package.json @@ -28,12 +28,12 @@ "docs/*.md": "markdownlint --fix" }, "devDependencies": { + "huid-reference-cli": "^0.0.5", "husky": "^9.0.0", "lint-staged": "^15.0.0", - "prettier": "^3.0.0", - "huid-reference-cli": "0.0.1", "markdownlint": "^0.33.0", - "markdownlint-cli": "^0.39.0" + "markdownlint-cli": "^0.39.0", + "prettier": "^3.0.0" }, "engines": { "node": ">=16.0.0"