Skip to content

Instantly share code, notes, and snippets.

View hcoona's full-sized avatar

Shuai Zhang hcoona

View GitHub Profile
@hcoona
hcoona / README.md
Created July 15, 2026 16:15
ConPTY terminal-query transport and request-lifetime reproduction for psmux issue 473

ConPTY Terminal-Query Transport Reproduction

Purpose

This C++ harness tests two separate questions:

  1. Which terminal queries and responses are transported by a specific ConPTY implementation?
  2. What happens when a terminal host returns a response after the process that issued the query has exited?

The harness does not use psmux, GitHub Copilot CLI, or Windows Terminal in its data path. The shell-child tests use PowerShell only to reproduce the normal topology in which a shell launches a foreground application.

@hcoona
hcoona / fix-pr-comments.prompt.md
Last active September 9, 2026 17:18
Agent Implementation Prompt

拉取 PR 评论

对于每一个未解决的评论,启动一个独立的 subagent

  1. 判断是 TP/FP
  2. 对于 FP,回复并置为 Won't Fix
  3. 对于 TP,重新思考怎么正面修复问题不留技术债务,同时注意减少修改面,评论建议的修复方式可能不是最优的。修复,回复,置为 Resolved

git add + commit + push 但是不需要做空提交

@hcoona
hcoona / filter-math-png.lua
Created September 23, 2025 05:42
Pandoc Filter to Convert Math Blocks into Png Images
-- Render inline ($...$) and display ($$...$$) math to PNG via latex + dvipng.
-- Caches to math-img/<sha1>.png
-- pandoc -f markdown+tex_math_dollars+raw_tex --lua-filter=filter-math-png.lua
local system = require 'pandoc.system'
local OUTDIR = "math-img"
local function is_html()
return FORMAT:match('html') ~= nil
end
@hcoona
hcoona / init.vim
Last active October 9, 2021 07:02
Download common utils & setup them
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
" Required:
execute "set runtimepath+=".stdpath('cache').'/dein/repos/github.com/Shougo/dein.vim'
" Required:
if dein#load_state(stdpath('cache').'/dein')
@hcoona
hcoona / update-alternatives-gcc.sh
Last active April 9, 2021 06:19
Update Alternatives for clang & gcc
function register_gcc_version() {
local version=$1
local priority=$2
update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${version} ${priority} \
--slave /usr/bin/g++ g++ /usr/bin/g++-${version} \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-${version} \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-${version} \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-${version} \
@hcoona
hcoona / semantics.rb
Created June 18, 2019 04:05
semantics.rb hit homebrew bug.
class Semantic < Formula
desc "Parsing, analyzing, and comparing source code across many languages"
homepage "https://github.com/github/semantic"
url "https://github.com/github/semantic/archive/0.6.0.zip"
sha256 "d9eb696e13b8b2b0a543e49e4082a26bdad3b66aadc2806687db3b1ea0e506c6"
head "https://github.com/github/semantic.git"
bottle do
sha256 "061df034a6db511da9527d4854e125c16facb65bd0220255e35083f7f244666a" => :mojave
sha256 "e5b22a9027074824151f20a99cabca01e1a5188732fc5b63887ce08e654c11c6" => :high_sierra
@hcoona
hcoona / asciidoctor-diagram.rb
Created September 29, 2018 08:15
Failed to work AsciidoctorDiagram fomular for homebrew
class AsciidoctorDiagram < Formula
desc "Asciidoctor Diagram is a set of Asciidoctor extensions that enable you to add diagrams, which you describe using plain text, to your AsciiDoc document."
homepage "https://asciidoctor.org/"
url "https://github.com/asciidoctor/asciidoctor-diagram/archive/v1.5.10.tar.gz"
sha256 "77051e3b203a8782a229d330e9248703c22af992b80e17caf77ae79fb1c8aaf5"
bottle do
cellar :any_skip_relocation
sha256 "6a72d25edb4069881295094ed39f7bc0d3b1aeef3cb8dbe55df06291b7c87330" => :mojave
sha256 "b31c91e2218a7d877243bf973519644552bfa6775f0afb9cee9e7964450be7a1" => :high_sierra
@hcoona
hcoona / print-calculate-steps.rkt
Last active August 29, 2015 14:06
Print calculation steps.
#lang racket
(require racket/generator
(only-in parser-tools/lex define-tokens define-empty-tokens)
parser-tools/yacc)
(define-tokens a (NUM))
(define-empty-tokens b (+ - * / EOF))
(define expr-parser
#lang racket
(define report-no-size-error
(lambda (size)
(error "We do not have size you ordered:" size)))
(define warning-coupon-not-suitable
(lambda (coupon-code)
(begin
(display