日常自动化工具集
简介
These tools are developed by myself for my personal requirements.
Usage:
mytools [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
email 从邮箱拉取一批邮件的基础信息和附件名称,并存储在email.xlsx中.
fileByDate 将给定目录下的所有文件按修改日期进行分组,放到以日期命名的文件夹中.
help Help about any command
lab 将一个或多个实验报告文件夹进行统计,汇总每次实验的提交情况.
lotto 乐透小游戏
password 密码生成器
rmStr 删除指定目录中所有文件中的指定字符
student 根据学生的完整姓名或学号进行查询.
web2bin 将base64编码的文件内容解码成一个二进制文件
Flags:
--config string config file (default is $HOME/.mytools.yaml)
-h, --help help for mytools
-v, --version version for mytools
Use "mytools [command] --help" for more information about a command.
completion
Generate the autocompletion script for the specified shell.
Generate the autocompletion script for mytools for the specified shell.
See each sub-command's help for details on how to use the generated script.
Usage:
mytools completion [command]
Available Commands:
bash Generate the autocompletion script for bash
fish Generate the autocompletion script for fish
powershell Generate the autocompletion script for powershell
zsh Generate the autocompletion script for zsh
Flags:
-h, --help help for completion
Global Flags:
--config string config file (default is $HOME/.mytools.yaml)
Use "mytools completion [command] --help" for more information about a command.
email
从邮箱拉取一批邮件的基础信息和附件名称,并存储在email.xlsx中.
该程序用来从指定的邮箱中拉取一批邮件的基础信息和附件名称. 拉取的信息将会存储在当前目录的email.xlsx文件中.
使用方法:
mytools email -u <username> -p <password> -H [host] -P [port] -s [startFetch] -e [endFetch] -l [latestSize] -b [mailbox]
参数说明:
-u, --username <username> 邮箱用户名
-p, --password <password> 邮箱密码
-H, --host <host> 邮箱主机地址: 默认是 imap.qq.com
-P, --port <port> 邮箱端口号: 默认是 993
-s, --startFetch <startFetch> 起始邮件序号
-e, --endFetch <endFetch> 结束邮件序号
-l, --latestSize <latestSize> 拉取的最新邮件数量
-b, --mailbox <mailbox> 邮箱名,默认是INBOX
Usage:
mytools email [flags]
mytools email [command]
Available Commands:
course 为拉取的邮件,从邮件主题和附件命名中寻找可能的学生姓名、学号和课程
rmdup 清除下载的邮件信息中的重复数据
Flags:
-h, --help help for email
-H, --host string imap host (default "imap.qq.com")
-b, --mailbox string mailbox (default "INBOX")
-p, --password string imap password
-P, --port int imap port (default 993)
-S, --size uint32 N email to retreive from the start position (default 50)
-s, --start uint32 start
-u, --username string imap username
Global Flags:
--config string config file (default is $HOME/.mytools.yaml)
Use "mytools email [command] --help" for more information about a command.
fileByDate
将给定目录下的所有文件按修改日期进行分组,放到以日期命名的文件夹中.
使用方法:
mytools fileByDate -b <directory>
说明:
-b 指定要扫描的文件夹路径,默认为./images
示例:
mytools fileByDate -b ./images
将会将当前目录下的images文件夹下的所有文件按修改日期进行分组,放到以日期命名的文件夹中。
Usage:
mytools fileByDate [flags]
Flags:
-b, --baseDir string Base directory to search for files (default "./images")
-h, --help help for fileByDate
Global Flags:
--config string config file (default is $HOME/.mytools.yaml)
lab
将一个或多个实验报告文件夹进行统计,汇总每次实验的提交情况.
This program will check a given directory with given namelist, and generated the checked result. For example:
The namelist is a csv type file with 'name' and 'no' columns.
The reports in the given directory are in the format of '$name-$no-$lab.doc' or '$name-$no-$lab.docx'.
The generated result includes the submmited flag for each student and those file with illegal filename format.
Usage:
mytools lab [flags]
Flags:
-c, --coursename string The coursename , like php-2023-class-1
-D, --debug show debug result or only the result
-h, --help help for lab
-l, --labName strings the labs' names in filename, split with comma.
-d, --workingDir string the directory contains reports. (default "./")
Global Flags:
--config string config file (default is $HOME/.mytools.yaml)
lotto
本程序是一款简单的乐透小游戏,用户在命令行中输入起始数字和结束数字,以及休眠间隔,
程序会在休眠间隔后随机生成一个整数,反复生成新的随机数,直到用户敲击Enter按键结束。
示例:
mytools lotto -start 1 -end 100 -milliSecond 1000
Flags:
-h, --help help for lotto
Args:
[start] 起始数字,必须大于0
[end] 结束数字,必须大于start
[milliSecond] 休眠时间,单位毫秒,默认100ms
Usage:
mytools lotto [flags]
Flags:
-e, --end int The ending number. (default 100)
-h, --help help for lotto
-m, --ms int The sleeping interval. (default 100)
-s, --start int The starting number. (default 1)
Global Flags:
--config string config file (default is $HOME/.mytools.yaml)
password
密码生成器,生成随机密码,并将密码复制到剪切板。
用法:
mytools password
参数:
-s, --special 特殊字符个数,默认值为2
-t, --total 总字符个数,默认值为10
示例:
$ mytools password -s 3 -t 8
Generated Password : B8<]mG5.
Password copied to clipboard
Usage:
mytools password [flags]
Flags:
-h, --help help for password
-s, --special int8 The number of special characters (default 2)
-t, --total int8 The total number of characters (default 10)
Global Flags:
--config string config file (default is $HOME/.mytools.yaml)
rmStr
删除指定目录中所有文件中的指定字符.
Usage:
mytools rmStr [flags]
Flags:
-y, --confirm 是否确认
-d, --dir string 指定目录 (default "./")
-h, --help help for rmStr
-s, --str string 指定字符
Global Flags:
--config string config file (default is $HOME/.mytools.yaml)
student
在指定的excel文件中查找学生信息,如果找到将会输出学生信息,包括姓名、学号、班级、年级.
Usage:
mytools student [flags]
Flags:
-d, --dataset string the dataset file
-h, --help help for student
-k, --keys strings the key text of students
-r, --reverse student no first or name first?
Global Flags:
--config string config file (default is $HOME/.mytools.yaml)
```sh
将base64编码的文件内容解码成一个二进制文件
示例:
web2bin -f base64.txt -o out.bin
Usage:
mytools web2bin [flags]
Flags:
-f, --filename string Filename to convert (default "base64.txt")
-h, --help help for web2bin
-o, --output string Output filename (default "out.bin")
Global Flags:
--config string config file (default is $HOME/.mytools.yaml)
web2bin
参考资料