Skip to content

Instantly share code, notes, and snippets.

View appleshan's full-sized avatar
💭
抛弃世俗之浮躁,留我钻研之刻苦.

Alec Shan appleshan

💭
抛弃世俗之浮躁,留我钻研之刻苦.
View GitHub Profile

Windows 的 AGENTS.md 编码声明

Windows ,在 C:\Users\用户名.codex 下新建 AGENTS.md 文件 然后加上如下内容就可以了

必须使用 UTF-8 编码

Your code must use the UTF-8 encoding format

回复请使用中文

一个“重写”流的提示词,覆盖比较全面。

把下面这段填进 CLAUDE.md 然后要求 CC "read and follow @CLAUDE.md" 即可在 claude_doc 目录下收获。

我们打算重写本 repo。为此,需要先完整理解现在它有什么功能。需要读原来的文档,和源码来知道:

名词、动词、引擎、点火钥匙
主要的模块和 call graph
重要的前10 个文件/函数,及其详细功能实现(在 claude_doc 目录下为这些文件各建一个 markdown 来详细说明)
@appleshan
appleshan / error_handler.sh
Last active September 24, 2025 06:33
捕获shell脚本执行失败的日志
#!/usr/bin/bash
set -e
# 错误日志文件
ERROR_LOG="error.log"
# 注册一个函数来处理错误
error_handler() {
echo "Error on line $1" | tee -a "$ERROR_LOG"
@appleshan
appleshan / curl.md
Created April 10, 2023 02:25 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@appleshan
appleshan / i3-cheat-sheet.md
Created March 25, 2023 06:32 — forked from JeffPaine/i3-cheat-sheet.md
i3 Window Manager Cheat Sheet

i3 Window Manager Cheat Sheet

$mod refers to the modifier key (alt by default)

General

  • startx i3 start i3 from command line
  • $mod+<Enter> open a terminal
  • $mod+d open dmenu (text based program launcher)
  • $mod+r resize mode ( or to leave resize mode)
  • $mod+shift+e exit i3
@appleshan
appleshan / pre-commit.sh
Created March 13, 2023 10:28 — forked from tmelz/pre-commit.sh
auto format java files with google-java-format
#!/bin/bash
# Auto format changed java files using google-java-format.
# To install, copy this file into $repo/.git/hooks and remove the .sh extension.
# Download the google-java-format JAR from
# https://github.com/google/google-java-format
# A more mature implementation of this would be a plugin for Yelp's pre-commit library:
# http://pre-commit.com/
echo "Running auto-formatter for any changed Java files"
echo "(formatting changes will be automatically added to your commit)"
@appleshan
appleshan / pactl_list_sinks
Created March 5, 2023 09:14
pactl list sinks
Sink #799
State: RUNNING
Name: bluez_output.11_78_64_16_66_18.1
Description: SANSUI
Driver: PipeWire
Sample Specification: s16le 2ch 48000Hz
Channel Map: front-left,front-right
Owner Module: 4294967295
Mute: no
Volume: front-left: 47174 / 72% / -8.57 dB, front-right: 47174 / 72% / -8.57 dB
@appleshan
appleshan / pactl_list_sources
Created March 5, 2023 09:12
pactl list sources
Source #799
State: IDLE
Name: bluez_output.11_78_64_16_66_18.1.monitor
Description: Monitor of SANSUI
Driver: PipeWire
Sample Specification: s16le 2ch 48000Hz
Channel Map: front-left,front-right
Owner Module: 4294967295
Mute: no
Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
package my.netty.http.upload;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.http.HttpRequestDecoder;
@appleshan
appleshan / ssh-agent.md
Created February 15, 2023 11:52 — forked from mvneves/ssh-agent.md
"Could not open a connection to your authentication agent"

SSH authentication agent does not automatically start when using it from a remote server. This results in the following error message:

$ git pull
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
$ ssh-add ~/my-ssh-key.pem
Could not open a connection to your authentication agent.

To fix it requires manually starting ssh-agent: