Skip to content

Instantly share code, notes, and snippets.

View nczz's full-sized avatar
🇹🇼
寫 code 不一定會幫你賺到錢,但會寫 code 能生活的有意思點。

一介資男 nczz

🇹🇼
寫 code 不一定會幫你賺到錢,但會寫 code 能生活的有意思點。
View GitHub Profile
@nczz
nczz / n8n-template-Telegram AI Chat Bot.json
Last active November 15, 2025 05:31
n8n 透過 Telegram 對話 OpenAI (包含外部連結取回內容分析)
{
"name": "Telegram AI Chat Bot",
"nodes": [
{
"parameters": {
"promptType": "define",
"text": "=幫我根據下方使用者提供的內容,拆分成一個純 JSON 輸出的格式,包含兩個欄位: 1. prompt: 表示一個整理過指示\n2. link: 如果該內容有附帶一個網址,將此網址整理至這欄位存放,如果沒有就空值。\n\n要注意,除了 JSON 格式的內容外,其他輸出完全不必要。\n\n然後幫我根據 prompt 的指示,選定一個 tool 工具執行。\n====== USER CONTENT START =====\n{{ $json.message.text }}\n===== USER CONTENT END =====",
"hasOutputParser": true,
"options": {}
},
@nczz
nczz / oauth_v1a.php
Created September 4, 2024 06:21
PHP 版本的 OAuth 1.0a 請求方法 ( For NetSuite TBA 請求 )
<?php
// 從 https://www.npmjs.com/package/oauth-1.0a 這邊改寫過來用
class OAuth {
private $consumer;
private $nonce_length;
private $version;
private $parameter_seperator;
private $realm;
private $last_ampersand;
private $signature_method;
@nczz
nczz / whatissoslow.php
Created October 29, 2023 14:23 — forked from Viper007Bond/whatissoslow.php
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@nczz
nczz / nginx_wp_staging_site.conf
Created June 6, 2023 10:24
Nginx 設定測試站靜態資源轉請求,減少測試站備份的容量
location ~ /wp-content/uploads/.* {
if (!-f $request_filename) {
rewrite ^/wp-content/uploads/(.*)$ https://www.mxp.tw/wp-content/uploads/$1 redirect;
}
}
@nczz
nczz / tw-zip-codes.php
Created May 17, 2023 15:09
引用 https://github.com/yyc1217/twzipcode-data/ 這專案中的台灣郵遞區號,改寫成 PHP 陣列,並補上「離島」與「本島」的註記(outlying -> 0 為本島, 1 為離島)
<?php
$twzipcode_arr = array(
0 => array(
'zipcode' => 100,
'county' => '臺北市',
'city' => '中正區',
'outlying' => 0,
),
1 => array(
'zipcode' => 103,
@nczz
nczz / spam.list
Last active November 28, 2022 13:51
農場網站請求清單
103.1.220.10 => WordPress/6.1.1; http://www.gujibaili.com.tw
103.1.220.10 => WordPress/6.1; http://www.gujibaili.com.tw
103.1.220.18 => WordPress/5.6.10; http://yks.bailhai.com.tw
103.1.220.18 => WordPress/5.8.6; http://www.amahua.com.tw
103.1.220.18 => WordPress/5.8.6; http://www.speedkz.com.tw
103.1.220.18 => WordPress/5.8.6; http://yks.futhome.com.tw
103.1.220.18 => WordPress/5.8.6; http://yks.speedkz.com.tw
103.1.220.18 => WordPress/5.9.5; http://www.hds555.com.tw
103.1.220.18 => WordPress/5.9.5; https://www.hds555.com.tw
103.1.220.18 => WordPress/6.1.1; http://blog.amahua.com.tw
/**
* HOW-TO
*/
// same param as $.ajax(option); see http://api.jquery.com/jQuery.ajax/
$.ajaxQueue.addRequest(option);
// start processing one by one requests
$.ajaxQueue.run();
@nczz
nczz / artzustudio.com.har
Created June 3, 2022 15:01
artzustudio.com 與 wpbuildershop.com 的 HAR 瀏覽紀錄
This file has been truncated, but you can view the full file.
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [
{
"startedDateTime": "2022-06-03T14:46:30.969Z",
@nczz
nczz / LightSail WordPress Cluster
Created May 2, 2022 02:24 — forked from mukeshwani/LightSail WordPress Cluster
Command, Code Snippts and Instructions for following video tutorial on setting up LightSail WordPress Cluster
# Welcome to the lightsail-wordpress-cluster wiki!
## Instructions, commands and code snippets to use and follow along the Video Tutorial on YouTube.
## Create Four LightSail Ubuntu Servers with the appropriate sizing. Name Three instances WP1, WP2, WP3, and name 4th instance LoadBalancer
##
## Open Ports 443 and 9443 (on LoadBalancer and WP1 in the LightSail Instance networking section)
## Run all commands with root (sudo su)
### Run following on each of the 3 WordPress instances
`ufw allow 80,443,9443,3306,4444,4567,4568/tcp;`
// import_json_appsscript.js
// https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4
//
// Changelog:
// (Oct. 16 2019) tag: allenyllee-20191016
// 1. Fixed google script error: urlfetchapp - service invoked too many times https://stackoverflow.com/questions/10598179/google-apps-script-urlfetchapp-service-invoked-too-many-times
// (Jul. 16 2018) tag: allenyllee-20180716
// 1. Fixed the issue "If you try to query /arrayA[k]/arrayB[n]/arrayC[m]/.../member, you will always get /arrayA[k]/arrayB[k]/arrayC[k]/.../member."
// (Nov. 30 2017) tag: allenyllee-20171130
// 1. Add the ability to query array elements by using xpath like "/array[n]/member" where "n" is array index