{"id":20962266,"url":"https://github.com/weidows/wutils","last_synced_at":"2025-08-02T05:05:24.018Z","repository":{"id":62632359,"uuid":"527408711","full_name":"Weidows/wutils","owner":"Weidows","description":"Some demos and utils in learning \u0026 developing golang.","archived":false,"fork":false,"pushed_at":"2025-03-16T17:26:46.000Z","size":15573,"stargazers_count":5,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T15:11:11.729Z","etag":null,"topics":["cast","cmd","collection","files","golang","hash","json","net","reflect","sort","time","utils"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/Weidows/wutils","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Weidows.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-22T04:19:11.000Z","updated_at":"2025-03-16T17:26:50.000Z","dependencies_parsed_at":"2023-10-16T10:56:31.456Z","dependency_job_id":"fec0b6d0-7b4b-478f-ad59-8cb1210bb083","html_url":"https://github.com/Weidows/wutils","commit_stats":{"total_commits":40,"total_committers":1,"mean_commits":40.0,"dds":0.0,"last_synced_commit":"6c9c757b4392c66d4800a1e9318b0676c3036a07"},"previous_names":["weidows/wutils","weidows/golang"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weidows%2Fwutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weidows%2Fwutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weidows%2Fwutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weidows%2Fwutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Weidows","download_url":"https://codeload.github.com/Weidows/wutils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254094895,"owners_count":22013653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cast","cmd","collection","files","golang","hash","json","net","reflect","sort","time","utils"],"created_at":"2024-11-19T02:25:37.922Z","updated_at":"2025-08-02T05:05:24.005Z","avatar_url":"https://github.com/Weidows.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: 🎉Docs-wutils\npassword: \"\"\ntags:\n  - tools\n  - doc\n  - wutils\nkatex: false\ncomments: true\naside: true\ndate: 2024-08-06 04:47:19\ntop_img:\ncover: https://pan.weidows.tech/d/local/blog/1d36e9d50555af6fca23e5fd36246cf5490809012.jpg\n---\n\n\u003e https://github.com/Weidows/wutils\n\n# Docs-wutils\n\n\u003c!--\n * @!: *********************************************************************\n * @Author: Weidows\n * @LastEditors: Weidows\n * @Date: 2022-08-30 14:51:11\n * @LastEditTime: 2025-03-17 01:25:22\n * @FilePath: \\wutils\\README.md\n * @Description:\n * @:\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡏⠻⣄\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣀⠀⠀⠀⠀⠀⣀⡾⠀⠀⣿\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⡶⠟⠛⠉⠉⠀⠀⠀⠀⠀⠀⠉⠉⠛⠻⠿⣤⣀⣠⡴⠋\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⠂⠀⠀⠀⠀⠀⠀⠀⠀⠙⢶⣀\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡾⠉⠀⠀⠀⠀⠀⠀⡴⠁⠀⠀⠀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⣄\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠋⠀⠀⠀⠀⠀⠀⢠⠏⠀⠀⠀⠀⡾⠀⠀⠀⠀⠀⠀⠀⠀⢰⠀⠀⠀⠀⠀⠀⠈⢷⡀\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⠀⠀⠀⠀⠀⠀⠀⣠⠃⠀⠀⠀⠀⢰⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⠀⠀⠀⠀⠀⠀⠀⠙⣄\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡿⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⣀⣿⢠⠀⠀⠀⠀⠀⠀⠀⠀⣶⠀⣧⠀⠀⠀⠀⠀⠀⠀⠈⣆\n * ⠀⠀⠀⠀⠀⠀⠀⠀⣼⠁⠀⣰⠀⠀⠀⠀⣾⢸⣿⣀⣤⣶⡛⠁⣿⠘⡄⠀⠀⠀⠀⢀⠀⠀⣿⠀⢻⠀⠀⠀⠀⠀⠀⠀⠀⠸\n * ⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⡟⠀⠀⠀⠀⣿⡈⡏⠀⠀⠀⠀⠙⡜⡄⢿⠀⠀⠀⠀⣾⣧⣾⢸⠀⢸⠀⠀⡇⠀⠀⠀⠀⠀⠀⡇\n * ⠀⠀⠀⠀⠀⠀⠀⢀⡇⠀⠀⣇⠀⠀⠀⠀⣷⣿⣿⣶⣦⣀⠀⠀⠀⠹⡘⣿⡀⠀⠀⢹⣿⠃⢸⠀⣿⠀⢠⣿⠀⠀⠀⠀⠀⣄⣧\n * ⠀⠀⠀⠀⠀⠀⠀⣼⠀⠀⠀⣿⠀⠀⠀⠀⢿⠉⠉⠉⠻⣿⣷⡀⠀⠀⠈⠁⠙⢦⣀⣸⠋⠈⣸⣼⢻⠀⣾⡿⠀⠀⠀⠀⢸⢸⣿\n * ⠀⠀⠀⠀⠀⠀⠀⣿⠀⣿⠀⠸⡄⣤⠀⠀⠀⣧⠀⠀⠀⠀⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⣿⣿⠇⠀⠀⠀⠀⣾⢸⣿\n * ⠀⠀⠀⠀⠀⠀⢰⡇⠀⣿⠀⠀⠙⠿⣿⠛⠒⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣦⡀⡿⠀⠀⠀⠀⠀⣿⣿⣿\n * ⠀⠀⠀⠀⠀⠀⣿⠀⣴⠋⠙⣦⠀⠀⠀⣇⠀⠀⠀⠀⠀⠀⣼⠉⠙⠳⠦⣤⡀⠀⠀⠀⠀⠀⠀⠈⠻⡿⠀⠀⠀⠀⠀⠀⣿⣿⣿\n * ⠀⠀⠀⠀⠀⠀⣿⢤⠇⣀⡀⣼⠀⠀⠀⢹⠀⠀⠀⠀⠀⢸⠁⠀⠀⠀⠀⢰⠁⠀⠀⠀⠀⠀⠀⣠⠟⠀⠀⠀⠀⠀⠀⢠⣯⣿⣿\n * ⠀⠀⠀⠀⣠⠋⣠⠟⠁⠀⠈⠛⣄⠀⠀⠀⣇⠀⠀⠀⠀⢹⠀⠀⠀⠀⢀⠟⠀⠀⠀⠀⠀⠀⢾⣁⠀⠀⠀⠀⢀⣾⣤⡏⠉⠉⣿\n * ⠀⠀⢀⣞⠤⣴⠁⠀⠀⠀⠀⠀⠀⣧⠀⠀⢿⠉⠳⣤⡀⠀⠁⠀⠠⠶⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠧⣴⣾⣿⣿⠟⡇⠀⠀⢸\n * ⣠⠚⠁⢀⠏⣿⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠈⡏⠛⠶⣤⡉⠛⠶⢤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⣀⡴⣿⣿⠟⠁⠀⠀⡇⠀⠀⢸\n * ⠀⠀⠀⢸⠀⠘⡄⠀⠀⠀⠀⠀⢹⠀⡿⡄⠀⣿⠀⠀⠀⠀⠙⠲⣤⡀⠙⢦⠉⠉⠉⠉⠉⠉⠁⠀⠀⣿⠀⠀⠀⠀⠀⡇⠀⠀⢸\n * ⠀⠀⠀⠘⡄⠀⣿⠀⠀⠀⠀⠀⣸⠛⡄⢻⠀⠸⡀⠀⠀⠀⠀⠀⠀⠈⠛⢦⡉⢦⡀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⢰⠇⠀⠀⢸\n * ⠀⠀⠀⠀⢿⠀⠈⠙⢦⣄⣠⠴⠃⢠⠃⠀⡇⠀⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢾⣦⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⣼⠀⠀⠀⠀⡇\n * ⠀⠀⠀⠀⠀⠙⢤⠀⠀⠀⠀⠀⡴⠋⠀⠀⡇⠀⢿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⣄⠀⠀⠀⡿⠀⠀⠀⠀⡿⠀⠀⠀⠀⡇\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡇⠀⠘⣿⣿⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠳⠀⠀⡇⠀⠀⠀⢰⠁⠀⠀⠀⠀⡇\n * ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡾⠀⠀⠀⣿⣿⣿⣿⣷⣶⣶⣤⣄⠀⠀⠀⠀⠀⠀⠀⠀⢸⠁⠀⠀⠀⡿⠀⠀⠀⠀⠀⣷\n *\n * @?: *********************************************************************\n--\u003e\n\n{% pullquote mindmap mindmap-sm %}\n\n- [Docs-wutils](#docs-wutils)\n  - [Cmd](#cmd)\n    - [install-and-config](#install-and-config)\n    - [wutils](#wutils)\n      - [parallel](#parallel)\n      - [ol-Opacity\\_Listener](#ol-opacity_listener)\n        - [特点-feature](#特点-feature)\n        - [配置-Config](#配置-config)\n        - [教程-tutorial](#教程-tutorial)\n      - [dsg-Disk\\_sleep\\_guard](#dsg-disk_sleep_guard)\n      - [diff](#diff)\n      - [zip](#zip)\n        - [crack](#crack)\n      - [media](#media)\n    - [common-starter](#common-starter)\n    - [subdir-extracter](#subdir-extracter)\n      - [usage](#usage)\n      - [example](#example)\n    - [gmm](#gmm)\n  - [Pkg](#pkg)\n    - [zip](#zip-1)\n  - [Utils](#utils)\n  - [借物表](#借物表)\n\n{% endpullquote %}\n\n\u003ca\u003e![分割线](https://pan.weidows.tech/d/local/img/divider.png)\u003c/a\u003e\n\n## Cmd\n\n一些命令行程序, 基本都是我自己需要用的, 没找到符合需求的就简单写一个, 针对 `服务 (service)`\n\n### install-and-config\n\n```shell\n# install with golang\ngo install github.com/Weidows/wutils/cmd/common-starter@master\ngo install github.com/Weidows/wutils/cmd/gmm@master\ngo install github.com/Weidows/wutils/cmd/subdir-extracter@master\ngo install github.com/Weidows/wutils/cmd/wutils@master\n\n# or use scoop\nscoop install wutils\n\n# or, just download from release:\nhttps://github.com/Weidows/wutils/releases\n```\n\n\u003e 默认配置 | default config: https://github.com/Weidows/wutils/tree/master/config \\\n\u003e 如果是 scoop / release 安装, 配置会在压缩包内\n\n---\n\n### wutils\n\n\u003e `CPU`: \u003c0.1% at most time. \\\n\u003e `RAM`: \u003c10MB, very tiny.\n\n- [x] 运行时配置热更新\n- [ ] break change: Rename from 'keep-runner' to 'wutils'\n  - then some integrations and transfers will be gradully added.\n\n```console\n\u003e ./wutils\nNAME:\n   wutils - Documents(使用指南) at here:\n            https://blog.weidows.tech/post/lang/golang/wutils\n\nUSAGE:\n   wutils [global options] command [command options]\n\nAUTHOR:\n   Weidows \u003cceo@weidows.tech\u003e\n\nCOMMANDS:\n   config        print config file\n   diff          diff - Differential set between two files\n                 文件对比工具, 但不是 Git-diff 那种\n                 是用来求 '行-差集' 的工具\n                 输入为两个特定名称的文件: './inputA.txt', './inputB.txt'\n   parallel, pl  并行+后台执行任务 (配置取自wutils.yml)\n   dsg           Disk sleep guard\n                 防止硬盘睡眠 (每隔一段自定义的时间, 往指定盘里写一个时间戳)\n                 外接 HDD 频繁启停甚是头疼, 后台让它怠速跑着, 免得起起停停增加损坏率\n   ol            Opacity Listener\n                 后台持续运行, 并每隔指定时间扫一次运行的窗口\n                 把指定窗口设置opacity, 使其透明化 (same as BLend)\n   help, h       Shows a list of commands or help for one command\n\nGLOBAL OPTIONS:\n   --help, -h  show help\n```\n\n#### parallel\n\nwutils 部分子程序设计为根据 [配置文件](https://github.com/Weidows/wutils/blob/master/config/cmd/wutils.yml) 持续运行的\n\n所以单独出来一个配置项控制子程序后台一起运行\n\n---\n\n#### ol-Opacity_Listener\n\n后台持续运行并控制窗口透明化的程序, 如图:\n\n![1702005541764](https://pan.weidows.tech/d/local/blog/1702005541764.jpg)\n\n只在 windows 平台使用和测试过, 其他平台可能会有 bug\n\n可用于类比的软件是 [BLend](https://zhutix.com/tools/touming-blend/), 那个软件太老了, 总是出一些 bug, 所以自己写了一个\n\n##### 特点-feature\n\n1. 现在大多数能搜到的工具比较手动, 每个新开的窗口都要再手动设置一次\n\n   wutils 只需要改一次配置, 开多少窗口都能立即起效\n\n2. 参数可调\n\n   同一程序的透明度统一控制\n\n   不同程序的透明度分开控制\n\n3. 配置化\n\n   免得每次启动调来调去\n\n4. 还会继续更新\n\n   哈哈, 毕竟主要是我自己也在用\n\n---\n\n##### 配置-Config\n\n路径为 `config/cmd/wutils.yml`\n\n```yaml\ndebug: false\nparallel:\n  dsg: true\n  ol: true\n\ndsg:\n  disk:\n    - \"E:\"\n    - \"D:\"\n  delay: 30\n\nol:\n  delay: 2\n  patterns:\n    - title: xyplorer\n      opacity: 210\n    - title: XYplorer\n      opacity: 210\n    - title: \"- Microsoft​ Edge$\"\n      opacity: 200\n    - title: \"- Visual Studio Code\"\n      opacity: 180\n```\n\n匹配规则是按标题来的, 所以按着上面改就行, 挺直观的\n\n- title 是 regex 字符串\n\n  `^` 是从开头匹配, `$` 是结尾\n\n  比如我的 Edge 浏览器, 通过 `wutils ol list` 命令找到它的标题是这么长 `Weidows/wutils: Some demos and utils in learning \\u0026 developing golang. 和另外 154 个页面 - 个人 - Microsoft​ Edge`\n\n  我想让 wutils 匹配以 \"Weidows\" 开头, 以 \"- Microsoft​ Edge\" 结尾的窗口, 那应该填 `^Weidows.*- Microsoft​ Edge$`\n\n- opacity 是透明度, `(0,255]`\n\n  一般设置在 200~240 这个范围比较舒服\n\n##### 教程-tutorial\n\n{% mmedia \"bilibili\" \"bvid:BV1d94y1j7JC\" %}\n\n---\n\n#### dsg-Disk_sleep_guard\n\n参上介绍的\n\n---\n\n#### diff\n\n自然, 可以通过 Git 和一些类似的工具实现 '行-差异' 的做法, 但是它们并不能输出, 作为差集\n\ntest case at [here](https://github.com/Weidows/wutils/tree/master/cmd/wutils/diff/test)\n\n```console\n\u003e ./wutils diff\n================== Missing in A ==================\nonlyB1\nonlyB2\n\n================== Missing in B:==================\nonlyA1\nonlyA2\n```\n\n---\n\n#### zip\n\n##### crack\n\n简而易懂, 破解压缩包\n\n- 把名为 `password.txt` 的字典文件放在命令行所在目录\n- 使用协程高速处理\n  - `\u003e=1000 test/s`\n  - `~50%` CPU usage\n  - `nMB ~ nGB` RAM usage\n- supporting\n  - .7z\n  - .zip\n  - 分卷文件 (.zip, .z01, .z02 ....)\n\n---\n\n#### media\n\n场景: 手机拍出来的图片/视频会同一堆在 `DCIM/Camera` 里, 有点太多了难以分组\n\n此程序作用为归类图片/视频, 默认参数对 `12h时间内` \u0026 `方圆1km` 归为一组, 减少手动分组的麻烦\n\n只接收一个参数, 图片文件夹的路径, 会在其内部生成 `output`, 并把分组后的文件复制进去 (注意大小)\n\n```\nwutils media group F:/Pictures/@Collections/DCIM/Camera\n```\n\n\u003ca\u003e![分割线](https://pan.weidows.tech/d/local/img/divider.png)\u003c/a\u003e\n\n### common-starter\n\n格式转换启动, 比如某些程序只能启动 .exe, 通过此程序中转启动其他格式的, 比如 .bat\n\n```console\n\u003e common-starter ./test.bat\n```\n\n\u003ca\u003e![分割线](https://pan.weidows.tech/d/local/img/divider.png)\u003c/a\u003e\n\n### subdir-extracter\n\n主要功能为解散一级目录\n\n- [x] 支持递归文件夹\n- [x] 重复文件进行 hash 校验 (前缀重命名法不会有误删, 删除的是完全一致的文件)\n- [ ] 提取为 Lib 到 utils 可供调用\n\n#### usage\n\n```\nsubdir-extracter 0 ./1\n```\n\nparams:\n\n1. mode\n   autoCheck = \"0\"\n   overwrite = \"1\"\n   skip = \"2\"\n2. path\n   input the root-dir-path where you need to extracter subdirs\n\n---\n\n#### example\n\n如下为解散前后, 测试文件在 `cmd/subdir-extracter/1`\n\n```\nD:\\DESKTOP\\1\n│  2.3.txt\n│\n├─2.1\n│  │  3.1.txt\n│  │  3.2.txt\n│  │\n│  └─3.3\n└─2.2\n    │  3.1.txt\n    │  3.2.txt\n    │\n    └─2.2\n```\n\n```\nD:\\DESKTOP\\1\n│  2.2-3.2.txt\n│  2.3.txt\n│  3.1.txt\n│  3.2.txt\n│\n├─2.2\n└─3.3\n```\n\n适用场景很单一: 比如一大批图包/数据集, 嵌套了很多层让人不舒服 (n \u003e 10 时手动挪出来就很头疼了)\n\n也没有对应工具可以用, 所以就写了这个\n\n\u003ca\u003e![分割线](https://pan.weidows.tech/d/local/img/divider.png)\u003c/a\u003e\n\n### gmm\n\nGolang package Mirror Manager\n\n- [x] 结果排序\n- [x] 协程加速\n\n---\n\n```console\n\u003e gmm test\nproxy\n      125ms   huawei\n      178ms   baidu\n      219ms   aliyun\n      338ms   proxy-cn\n      476ms   default\n      612ms   proxy-io\n      623ms   tencent\nsumdb\n      433ms   google\n      451ms   default\n      743ms   sumdb-io\n```\n\n```console\n╰─ gmm proxy huawei\nProxy use huawei https://repo.huaweicloud.com/repository/goproxy\n\n╰─ gmm sumdb default\nSumdb use default https://sum.golang.org\n```\n\n\u003ca\u003e![分割线](https://pan.weidows.tech/d/local/img/divider.png)\u003c/a\u003e\n\n## Pkg\n\n一般是 New 出来用的包, 针对 `对象 (object)`\n\n### zip\n\n用于破解压缩文件的包, 上面 cmd 中有调用\n\n\u003ca\u003e![分割线](https://pan.weidows.tech/d/local/img/divider.png)\u003c/a\u003e\n\n## Utils\n\n工具类函数, 多为应对 code 时常用却又棘手的情况, 针对 `类型 (type)`\n\n比较偏向 go 的注释即文档做法, utils 里有各种工具库, 可以先装一下, 开发时说不定起手就用到了\n\n`现存函数大大大概率不会删/改名`, base 大致搭好了, 会有 deprecated / break change\n\n## 借物表\n\n暂无.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweidows%2Fwutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweidows%2Fwutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweidows%2Fwutils/lists"}