title | password | tags | katex | comments | aside | date | top_img | cover | |||
---|---|---|---|---|---|---|---|---|---|---|---|
🎉Docs-wutils |
|
false |
true |
true |
2024-08-05 21:47:19 -0700 |
{% pullquote mindmap mindmap-sm %}
{% endpullquote %}
一些命令行程序, 基本都是我自己需要用的, 没找到符合需求的就简单写一个, 针对 服务 (service)
# install with golang
go install github.com/Weidows/wutils/cmd/common-starter@master
go install github.com/Weidows/wutils/cmd/gmm@master
go install github.com/Weidows/wutils/cmd/subdir-extracter@master
go install github.com/Weidows/wutils/cmd/wutils@master
# or use scoop
scoop install wutils
# or, just download from release:
https://github.com/Weidows/wutils/releases
默认配置 | default config: https://github.com/Weidows/wutils/tree/master/config
如果是 scoop / release 安装, 配置会在压缩包内
CPU
: <0.1% at most time.
RAM
: <10MB, very tiny.
- 运行时配置热更新
- break change: Rename from 'keep-runner' to 'wutils'
- then some integrations and transfers will be gradully added.
> ./wutils
NAME:
wutils - Documents(使用指南) at here:
https://blog.weidows.tech/post/lang/golang/wutils
USAGE:
wutils [global options] command [command options]
AUTHOR:
Weidows <[email protected]>
COMMANDS:
config print config file
diff diff - Differential set between two files
文件对比工具, 但不是 Git-diff 那种
是用来求 '行-差集' 的工具
输入为两个特定名称的文件: './inputA.txt', './inputB.txt'
parallel, pl 并行+后台执行任务 (配置取自wutils.yml)
dsg Disk sleep guard
防止硬盘睡眠 (每隔一段自定义的时间, 往指定盘里写一个时间戳)
外接 HDD 频繁启停甚是头疼, 后台让它怠速跑着, 免得起起停停增加损坏率
ol Opacity Listener
后台持续运行, 并每隔指定时间扫一次运行的窗口
把指定窗口设置opacity, 使其透明化 (same as BLend)
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
wutils 部分子程序设计为根据 配置文件 持续运行的
所以单独出来一个配置项控制子程序后台一起运行
后台持续运行并控制窗口透明化的程序, 如图:
只在 windows 平台使用和测试过, 其他平台可能会有 bug
可用于类比的软件是 BLend, 那个软件太老了, 总是出一些 bug, 所以自己写了一个
-
现在大多数能搜到的工具比较手动, 每个新开的窗口都要再手动设置一次
wutils 只需要改一次配置, 开多少窗口都能立即起效
-
参数可调
同一程序的透明度统一控制
不同程序的透明度分开控制
-
配置化
免得每次启动调来调去
-
还会继续更新
哈哈, 毕竟主要是我自己也在用
路径为 config/cmd/wutils.yml
debug: false
parallel:
dsg: true
ol: true
dsg:
disk:
- "E:"
- "D:"
delay: 30
ol:
delay: 2
patterns:
- title: xyplorer
opacity: 210
- title: XYplorer
opacity: 210
- title: "- Microsoft Edge$"
opacity: 200
- title: "- Visual Studio Code"
opacity: 180
匹配规则是按标题来的, 所以按着上面改就行, 挺直观的
-
title 是 regex 字符串
^
是从开头匹配,$
是结尾比如我的 Edge 浏览器, 通过
wutils ol list
命令找到它的标题是这么长Weidows/wutils: Some demos and utils in learning \u0026 developing golang. 和另外 154 个页面 - 个人 - Microsoft Edge
我想让 wutils 匹配以 "Weidows" 开头, 以 "- Microsoft Edge" 结尾的窗口, 那应该填
^Weidows.*- Microsoft Edge$
-
opacity 是透明度,
(0,255]
一般设置在 200~240 这个范围比较舒服
{% mmedia "bilibili" "bvid:BV1d94y1j7JC" %}
参上介绍的
自然, 可以通过 Git 和一些类似的工具实现 '行-差异' 的做法, 但是它们并不能输出, 作为差集
test case at here
> ./wutils diff
================== Missing in A ==================
onlyB1
onlyB2
================== Missing in B:==================
onlyA1
onlyA2
简而易懂, 破解压缩包
- 把名为
password.txt
的字典文件放在命令行所在目录 - 使用协程高速处理
>=1000 test/s
~50%
CPU usagenMB ~ nGB
RAM usage
- supporting
- .7z
- .zip
- 分卷文件 (.zip, .z01, .z02 ....)
格式转换启动, 比如某些程序只能启动 .exe, 通过此程序中转启动其他格式的, 比如 .bat
> common-starter ./test.bat
主要功能为解散一级目录
- 支持递归文件夹
- 重复文件进行 hash 校验 (前缀重命名法不会有误删, 删除的是完全一致的文件)
- 提取为 Lib 到 utils 可供调用
subdir-extracter 0 ./1
params:
- mode autoCheck = "0" overwrite = "1" skip = "2"
- path input the root-dir-path where you need to extracter subdirs
如下为解散前后, 测试文件在 cmd/subdir-extracter/1
D:\DESKTOP\1
│ 2.3.txt
│
├─2.1
│ │ 3.1.txt
│ │ 3.2.txt
│ │
│ └─3.3
└─2.2
│ 3.1.txt
│ 3.2.txt
│
└─2.2
D:\DESKTOP\1
│ 2.2-3.2.txt
│ 2.3.txt
│ 3.1.txt
│ 3.2.txt
│
├─2.2
└─3.3
适用场景很单一: 比如一大批图包/数据集, 嵌套了很多层让人不舒服 (n > 10 时手动挪出来就很头疼了)
也没有对应工具可以用, 所以就写了这个
Golang package Mirror Manager
- 结果排序
- 协程加速
> gmm test
proxy
125ms huawei
178ms baidu
219ms aliyun
338ms proxy-cn
476ms default
612ms proxy-io
623ms tencent
sumdb
433ms google
451ms default
743ms sumdb-io
╰─ gmm proxy huawei
Proxy use huawei https://repo.huaweicloud.com/repository/goproxy
╰─ gmm sumdb default
Sumdb use default https://sum.golang.org
一般是 New 出来用的包, 针对 对象 (object)
用于破解压缩文件的包, 上面 cmd 中有调用
工具类函数, 多为应对 code 时常用却又棘手的情况, 针对 类型 (type)
比较偏向 go 的注释即文档做法, utils 里有各种工具库, 可以先装一下, 开发时说不定起手就用到了
现存函数大大大概率不会删/改名
, base 大致搭好了, 会有 deprecated / break change
暂无.