Skip to content

Instantly share code, notes, and snippets.

@miles990
miles990 / CLAUDE.md
Last active September 9, 2025 03:41
claude 語音通知(mac) settings.local.json放在.claude資料夾底下 腳本路徑要設定正確的notification.sh

語音報告

每次回答問題或完成任務後,使用以下指令進行語音通知:

say -v "Meijia" -r 180 "簡短描述回答內容或完成的工作"

語音通知設定

  • 通知腳本:/Users/user/Workspace/prompt-mvp/notification.sh
  • 使用語音:Meijia(台灣國語)
  • 語速:180 字/分鐘
/**
* 計算 Multiplier(x):
* y = e^( (ln2/8) * x ) , if 0 ≤ x < 8
* y = (1/8) * e^( (ln2/2) * x ) , if 8 ≤ x < 24
* y = (1/8) * e^( (ln2/2) * x ) , if x ≥ 24
*
* @param {number} x — 輸入值(假設 x ≥ 0)
* @returns {number} y — 分段函數的值
*/
function multiplier(x) {
python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt
source venv/bin/activate && python start_api.py --host 127.0.0.1 --port 8000 --log-level info --env development
@miles990
miles990 / reverse-engineering-golang.md
Created November 20, 2024 10:44 — forked from 0xdevalias/reverse-engineering-golang.md
Some notes, tools, and techniques for reverse engineering Golang binaries
@miles990
miles990 / Vagrantfile
Last active December 13, 2023 07:18
VagrantFile centos7 with docker
Vagrant.configure("2") do |config|
config.vm.define "centos7_with_docker" do |v|
v.vm.box = "genebean/centos-7-docker-ce"
v.vm.synced_folder ".", "/vagrant"
v.ssh.username = "root"
v.ssh.password = "root"
config.vm.provider "virtualbox" do |vb|
vb.memory = "51200"
vb.cpus = 24
@miles990
miles990 / FirebaseApi.cs
Created November 6, 2023 10:03
底層 Firebase API 方法 + TimeRepository 類別實現重試邏輯
public class FirebaseApi
{
public async Task<long> GetTime()
{
var result = await Firebase.Functions.FirebaseFunctions.DefaultInstance.GetHttpsCallable("GetServerTimestamp").CallAsync();
if (result.Data != null)
{
string time = result.Data.ToString();
return Convert.ToInt64(time.Substring(0, time.Length - 3)); // for changing milliseconds to seconds
}
@miles990
miles990 / gist:89d3ee4c8807202d795c2fc20e74fcc7
Created November 6, 2023 08:35
JS使用整數運算來避免浮點數誤差
// 將浮點數轉換為整數
function asInteger(floatNumber, precision) {
return Math.round(floatNumber * Math.pow(10, precision));
}
// 進行整數加法
function addFloatsAsIntegers(float1, float2, precision) {
const int1 = asInteger(float1, precision);
const int2 = asInteger(float2, precision);
return (int1 + int2) / Math.pow(10, precision);
public async static Task<(int errorCode, long timestamp)> GetTime(int maxRetryCount = 3)
{
const int SuccessCode = 0;
const int RetryLimitReachedCode = 1;
const int NoDataCode = 2;
const int UnknownErrorCode = 99;
int retryCount = 0;
while (retryCount < maxRetryCount)
{
public async static Task<long> GetTime(int maxRetryCount = 3)
{
int retryCount = 0;
while (retryCount < maxRetryCount)
{
try
{
var result = await Firebase.Functions.FirebaseFunctions.DefaultInstance.GetHttpsCallable("GetServerTimestamp").CallAsync();
if (result.Data != null)