Skip to content

Instantly share code, notes, and snippets.

View CodeBoy2006's full-sized avatar
📚
Learning CS and SE

codeboy CodeBoy2006

📚
Learning CS and SE
View GitHub Profile
@CodeBoy2006
CodeBoy2006 / override.js
Created July 29, 2025 08:45
Mihomo Party Override
/**
* 个人备份使用,该脚本适用与Mihomo Party和 Clash Verge Rev
* Clash Verge Rev 全局扩展脚本(懒人配置)/ Mihomo Party 覆写脚本
*
* V6: Applied modern DNS and performance optimizations.
* - Replaced old DNS structure with a robust nameserver/fallback model to prevent leaks.
* - Enabled DNS over QUIC (prefer-h3) for faster lookups.
* - Removed default-nameserver to eliminate startup leaks.
* - Added experimental tcp-concurrent for latency reduction.
* V5: Added proxy node preprocessing to rename nodes conflicting with group names.
@CodeBoy2006
CodeBoy2006 / .clang-format
Created August 23, 2025 01:38
clang-format 算法竞赛配置文件
# .clang-format
BasedOnStyle: LLVM
# —— 缩进用 Tab,对齐用空格(更稳妥)——
UseTab: ForIndentation # 缩进使用 Tab,水平对齐仍用空格
TabWidth: 4 # 一个 Tab 等于 4 列
IndentWidth: 4 # 每一级缩进 = 1 个 Tab(= TabWidth)
# —— 紧凑度/可读性:更像竞赛模板 ——
ColumnLimit: 0 # 不自动换行(模板/长宏更安全)
@CodeBoy2006
CodeBoy2006 / completions2images.ts
Last active October 3, 2025 11:51
Deno single-file gateway that converts a "markdown-image via /v1(completions)" upstream into an OpenAI-compatible /v1/images/generations (b64_json) response.
// Deno single-file gateway that converts a "markdown-image via /v1(chat|)completions" upstream
// into an OpenAI-compatible /v1/images/generations (b64_json) response.
//
// ✅ Simplified for "prompt-only" inputs: always converts `prompt` to `messages` for chat endpoints.
// ✅ URL passing: POST http://localhost:8787/?address=https://upstream.example/v1/chat/completions$/v1/images/generations
// ✅ Works even if real upstream path is nested in query: ?address=https://rev-proxy/?address=https://api.example/v1/chat/completions
// ✅ Forwards Authorization, parses markdown URLs, downloads images, returns base64
// ✅ Zero deps; uses btoa for base64
// ✅ Extremely detailed debugging with structured logs (DEBUG=1 by default)