Skip to content

Instantly share code, notes, and snippets.

View legendmohe's full-sized avatar
🎯
Focusing

Xinyu He legendmohe

🎯
Focusing
View GitHub Profile
/**
* Auto Session Name extension
*
* AI-powered session naming. Summarizes the current conversation into a
* concise 3-6 word session name and sets it automatically.
*
* Usage: /auto-session-name
*
* Follows the same pattern as handoff.ts for AI calling:
* - Uses the active model (ctx.model) rather than hardcoding
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
import { Type } from "typebox";
import { execFile } from "node:child_process";
import { existsSync } from "node:fs";
import { extname } from "node:path";
const PYTHON_SCRIPT = `
import sys
from pptx import Presentation
/**
* Plan / Ask Mode Extension for pi
*
* 三模式循环:
* 1. Plan: 分析需求, 写 PLAN.md, 不修改代码, /approve 后执行
* 2. Ask: 纯只读查阅, 回答用户问题, 引导 !command
* 3. Default: 正常模式, 所有工具可用
*
* 用法:
* pi --plan 启动时进入 plan mode
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This will hold the configuration.
local config = wezterm.config_builder()
config.default_prog = {'powershell.exe', '-NoLogo'}
-- This is where you actually apply your config choices.
@legendmohe
legendmohe / collect_device_info.ps1
Last active October 14, 2025 03:23
设备调试信息收集报告
# 设备信息收集脚本
$outputFile = "device_debug_info.txt"
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
"=== 设备调试信息收集报告 ===" | Out-File $outputFile
"收集时间: $timestamp" | Out-File $outputFile -Append
"问题描述: SurfaceFlinger ACQUIRED状态卡住, dequeueBuffer失败" | Out-File $outputFile -Append
""
"✅ 正在收集设备信息..." | Write-Host -ForegroundColor Green
@legendmohe
legendmohe / Android-Surface-Buffer-Monitor.ps1
Created October 14, 2025 02:31
Android Surface缓冲区监控工具,专门用于监控Bigo Live应用的Surface状态
# Bigo Live Surface Monitor Script
function Test-SurfaceExists {
param([string]$surfaceName)
$listOutput = adb shell "dumpsys SurfaceFlinger --list"
return $listOutput -match [regex]::Escape($surfaceName)
}
function Get-SurfaceDetailedInfo {
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.selects.select
import java.util.concurrent.atomic.AtomicBoolean
class TimeoutResetMonitor(
private val timeoutMillis: Long = 120_000L, // 2分钟
private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
) {
// 触发器通道
Main                                                                                                       ShowView
+--------------------+                                                                                     +------------------------+
|                    |                                                                                     |          Idle          |
|                    |     +------------------------------------------+                                    |           +            |
|      Idle          |     |                                          |                                    |           |            |
|        +           |     |                                          |                                    |           v            |
|        |           |     |                                          |      Login.media(channel)          |        WaitingView     |

| +--------+ | | Login.linkd(group) |

@legendmohe
legendmohe / default.custom.yaml
Created July 14, 2023 05:54
小狼毫配置
customization:
distribution_code_name: Weasel
distribution_version: 0.15.0.0
generator: "Rime::SwitcherSettings"
modified_time: "Tue Jul 11 12:06:45 2023"
rime_version: 1.8.5
patch:
"menu/page_size": 9
schema_list:
- {schema: double_pinyin_flypy}
logfilter_version=4.0.0