journalctl 清理日志

使用 journalctl 命令清理 systemd 等产品的日志。

根据时间清理旧的日志文件:

sudo journalctl --vacuum-time=1years

--vacuum-time 选项用于指定保留日志文件的时间跨度。
单位也可以是:1months3days

根据体积清理旧的日志文件:

pm2 定时执行任务

可使用 --cron 参数指定执行周期,但是如果仅使用该参数,例如

pm2 start task.js --cron "*/15 * * * *"

PM2 将启动您的 cron 作业,但它也会在作业程序完成后不断重新启动 cron 作业,无限循环。

macOS 的守护程序和服务

Daemons and Services in macOS

  • 守护程序: launchd。类似 Linux 中的 systemd,负责初始化、加载、启/停和管理系统服务。
  • 管理命令: launchctl。 类似 Linux 中的 systemctl
  • 配置文件类型是 .plist。存放路径:
    • /Library/LaunchDaemons/,无论是否有任何用户登录系统,它们都应运行。 它们将以“root”权限启动。
    • /Library/LaunchAgents,任意用户登录后
    • ~/Library/LaunchAgents/,某(当前)用户登录后

      其中 ~ 是您的主目录。 这些任务将使用您的权限运行,就像您自己通过命令行或双击 Finder 中的文件启动它们一样。

免费可商用中文字体及资源

收集整理的🆓免费可商用的中文字体清单。且多数是开源字体。

  • 思源宋体,许可证是 SIL Open Font License,🆓可免费商用
    是由 Adobe 公司开发和发表的开源字体

Tauri invoke 参数名

注意参数名:

在后端 rust 代码中,参数名必须是蛇形命名法,例如 tou_lan
而在前端通过 invoke 调用时,参数名必须使用驼峰式命名法,例如 touLan

实例:
传递 user name

ffprobe 获取视频各项属性源信息

ffprobe -v error -show_format -show_streams -show_programs -show_chapters -show_private_data -print_format json your-video.mp4

简化输出一些常用的信息:
ffprobe -v error -select_streams v:0 -show_format -show_entries stream=height,width -of csv=s=x:p=0 -print_format json your-video.mp4

将结果输出到文件,在命令后添加 > meta.json

输出示例:

{
    "programs": [
    ],
    "streams": [
        {
            "width": 1920,
            "height": 1080
        }
    ],
    "format": {
        "filename": "xxx",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000",
        "duration": "22.173605",
        "size": "4011572",
        "bit_rate": "1447332",
        "probe_score": 100,
        "tags": {
            "major_brand": "mp42",
            "minor_version": "0",
            "compatible_brands": "mp42mp41iso4",
            "creation_time": "2023-02-18T01:50:29.000000Z"
        }
    }
}

参考: