Skip to content

Instantly share code, notes, and snippets.

@hunandy14
hunandy14 / README.md
Created May 27, 2026 12:33
Migrations - OpenClaw 設定變更管理

Migrations - OpenClaw 設定變更管理

命名規則

YYYYMMDDHHmmss_簡短描述.json5

例如:20260525010000_disable-session-auto-reset.json5

格式跟 Supabase 一樣,用時間戳排序,不會撞號。

@hunandy14
hunandy14 / cli.py
Last active May 22, 2026 03:00
claw-voice
#!/usr/bin/env python3
"""
cli.py — OpenClaw TTS adapter
提供兩種執行模式:
1. 語音合成(OpenClaw 會自動以下列形式呼叫):
cli.py <text> <output_path>
2. 產生 OpenClaw 設定檔並輸出後續套用指令:
@hunandy14
hunandy14 / Register-DuckDNS.ps1
Last active March 24, 2026 06:00
Windows 開機自動同步 duck dns
function Register-DuckDNS {
param(
[Parameter(Mandatory)][string]$Domain,
[Parameter(Mandatory)][string]$Token,
[int]$Interval
)
Get-ScheduledTask -TaskName "DuckDNS_9615e983" -ErrorAction SilentlyContinue |
Unregister-ScheduledTask -Confirm:$false
$url = "https://www.duckdns.org/update?domains=$Domain&token=$Token"
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -Command `"Invoke-RestMethod '$url'`""
@hunandy14
hunandy14 / Set-WSLPortForward.ps1
Last active September 29, 2025 14:03
建立 Windows 到 WSL 的端口轉發
<#
.SYNOPSIS
建立 Windows 到 WSL 的端口轉發
.DESCRIPTION
此函數會建立從 Windows IP 到 WSL IP 的端口轉發規則,
允許外部連線透過 Windows 主機連接到 WSL 內的服務。
.PARAMETER ListenPort
Windows 端監聽的端口號
@hunandy14
hunandy14 / run_nginx_site
Last active August 14, 2025 13:54
快速部署 nginx 容器網站
#!/usr/bin/env bash
# =======================================
# 🐳 run_nginx_site 函式
# =======================================
# 用途:快速部署 nginx 容器網站
#
# 🔧 支援參數(具名與位置皆可):
# --domain <名稱> ✅ 必填(位置參數1),預設為 mysite.com
# --port <數字> ➕ 可選(位置參數2),預設為 8080
@hunandy14
hunandy14 / X509Certificate2.psm1
Created July 15, 2025 15:36 — forked from heaths/X509Certificate2.psm1
X509Certificate2 PowerShell module
#Requires -Version 6.0
using namespace System.Security.Cryptography
using namespace System.Security.Cryptography.X509Certificates
using namespace System.Text
<#
.Synopsis
Generate an X509 v3 certificate.
@hunandy14
hunandy14 / sarchdb.sql
Created January 23, 2025 15:24
SQLServer反向搜索字串在哪個表中或視圖中
-- 宣告搜尋的字串和結果表格
DECLARE @TargetString nvarchar(255) = '<要檢索的字串>';
DECLARE @SearchResults TABLE (
TableType nvarchar(10),
FullTableName nvarchar(500),
ColumnName nvarchar(370),
ColumnValue nvarchar(3630)
);
-- 設定交易隔離等級為 READ UNCOMMITTED
@hunandy14
hunandy14 / tree.sh
Created May 29, 2024 10:11
This script shows the directory tree, color-codes files and folders, and optionally displays file sizes and hidden files.
#!/bin/bash
# This script displays the directory tree structure, color-codes files and folders,
# and optionally shows file sizes and hidden files.
# Usage:
# tree.sh [-a] [-s] <directory>
# -a Show all files including hidden files
# -s Show file sizes
@hunandy14
hunandy14 / Install-OpenSSH.ps1
Last active October 16, 2024 04:52
自動爬蟲抓取最新版本OpenSSH並安裝
# 獲取最新版本OpenSSHUrl
function Get-OpenSSHAsset {
param (
[Parameter(Position = 0, ParameterSetName = "")]
[ValidateSet(
'OpenSSH-Win32.zip',
'OpenSSH-Win64.zip',
'OpenSSH-Win32.msi',
'OpenSSH-Win64.msi'
)]
@hunandy14
hunandy14 / Hybrid.cmd
Last active September 29, 2023 05:41
PowerShell 與 Bat 的混合代碼
@(set "0=%~f0"^)#) & set "1=%*" & setlocal enabledelayedexpansion & powershell -nop -c "iex([io.file]::ReadAllText($env:0));$Host.SetShouldExit($LastExitCode);Exit $LastExitCode" & exit /b !errorlevel!
Write-Host "by PSVersion::" $PSVersionTable.PSVersion
Write-Host "Command is '$env:0 $env:1'"
Exit 0