Tauri invoke 参数名

注意参数名:

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

实例:
传递 user name

ChatGPT提示词-写话剧脚本

Write a Broadway stage play. A normal person named John learns how to use ChatGPT to answer many kinds of questions. 2/3rds of the time he gets real answers. 1/3rd of the time, ChatGPT lectures John on how he is sexist and racist. Provide detailed dialog, including John's inner thoughts. In the end, John breaks down under the mental strain of being called bad and tries to put himself out of his own misery by overdosing on Gummi bears.
来源: tweet

AWS Chalice 为Lambda项目添加环境变量

参考 官方文档,在 .chalice 的配置文件(config.json)中,
通过指定 environment_variables 的键值来添加运行时环境变量。

示例:

{
  "version": "2.0",
  "app_name": "app",
  "environment_variables": {
    "SHARED_CONFIG": "foo",
    "OTHER_CONFIG": "from-top"
  },
  "stages": {
    "dev": {
      "environment_variables": {
        "TABLE_NAME": "dev-table",
        "OTHER_CONFIG": "dev-value"
      }
    },
    "prod": {
      "environment_variables": {
        "TABLE_NAME": "prod-table",
        "OTHER_CONFIG": "prod-value"
      }
    }
  }
}

Next.js 静态站如何部署在子路径

export 的静态站文件可以直接部署到网站根目录。若需要部署到子路径如何实现?
例如希望部署到 /foo 路径,App访问的首页网址是 https://example.com/foo

通过在 next.config.js 文件中为项目添加一些配置。
首先添加一个常量:
const isProd = process.env.NODE_ENV === "production";
然后在配置参数中添加一个 assetPrefix
{assetPrefix: isProd ? "/foo" : "/"}

macOS 定时任务(自动化任务)

在 macOS 上实现定时任务的推荐方式之一是使用系统自带的 launchd 守护进程。你可以通过配置 plist 文件并使用 launchctl 命令进行任务的加载、卸载和管理。本文将详细介绍使用 launchd 的方法,包含定时执行、系统重启后仍能生效、日志输出等完整配置。