Skip to content

Instantly share code, notes, and snippets.

View bczhc's full-sized avatar
🌴

Zhai Can bczhc

🌴
View GitHub Profile
@bczhc
bczhc / a.c
Created March 6, 2026 12:52
从除零错误中断中恢复
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <ucontext.h>
void handle_fpe(int sig, siginfo_t *info, void *ucontext) {
printf("Caught SIGFPE! Attempting to skip the broken instruction...\n");
// 强制转换为 ucontext_t 结构体指针
@bczhc
bczhc / a.md
Created March 6, 2026 12:52
内联x86汇编

Hello world

C

// demo.c
void _start() {
    // 1. 调用 write(1, "Hello\n", 6)
    const char *msg = "Hello\n";
    long syscall_nr = 1; // write 的系统调用号
@bczhc
bczhc / a.ipynb
Last active February 26, 2026 06:36
Palworld proton wayland模式下一些UI指针灵敏度不正确问题观察
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bczhc
bczhc / a.ipynb
Last active February 25, 2026 09:12
Palworld dxvk与vkd3d性能比较
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bczhc
bczhc / a.md
Last active February 24, 2026 11:20
Xwayland (Hyprland)和X11 (i3wm no compositor) 游戏性能双盲试验

先设置sudo ydotool免密执行。

首先使用另一个设备连接上电脑的ssh。在电脑的tty下运行./start-random-display,后面等待的十秒内,走离电脑屏幕。待十秒后随机桌面启动后,在ssh连接的终端中运行./manage-game start,自动启动Steam并进入游戏(一分钟多一点)。然后可以回到电脑旁。

完成之后,在ssh终端中使用./manage-game exit退出,再./close-display退出桌面,准备进行下一轮。

@bczhc
bczhc / ft8-send
Last active February 21, 2026 08:56
ft8模拟器 测试铅酸电池性能用
#!/usr/bin/env ruby
# --- 配置区 ---
SAMPLE_RATE = 44100
FREQUENCY = 800.0
DURATION = 15
# 你的 USB 设备关键字(用于 grep 匹配)
DEVICE_KEY = "usb-C-Media_Electronics_Inc._USB_Audio_Device-00"
# aplay 完整设备路径
DEVICE_PATH = "pulse:alsa_output.#{DEVICE_KEY}.analog-stereo"
@bczhc
bczhc / a.md
Last active February 19, 2026 15:58
阴乐产生器。

力竭了

freq-compress in.wav out.wav -c 512
ffmpeg -i out.wav -f s16le - | ffmpeg -f s16le -ac 2 -ar 44100 -i pipe:0 -filter:a 'atempo=0.5' out2.wav -y
mpv out2.wav

全损

@bczhc
bczhc / a.md
Last active February 19, 2026 12:34
FT-710 USB声卡操作

Pulse设备:

radioout=alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.mono-fallback
radiosink=alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo

把电台接收回放到电脑

@bczhc
bczhc / a
Created February 14, 2026 06:39
偶发的正常使用时 hyprland crash
Feb 13 00:40:42 bczhc-arch systemd-journald[409]: Journal stopped
Feb 13 00:40:42 bczhc-arch systemd-udevd[453]: Failed to remove file descriptor "config-serialization" from the store, ignoring: Connection refused
Feb 13 00:40:42 bczhc-arch systemd-journald[409]: Received SIGTERM from PID 1 (systemd-shutdow).
Feb 13 00:40:42 bczhc-arch systemd-shutdown[1]: Sending SIGTERM to remaining processes...
Feb 13 00:40:42 bczhc-arch systemd-shutdown[1]: Syncing filesystems and block devices.
Feb 13 00:40:42 bczhc-arch systemd-shutdown[1]: Watchdog running with a hardware timeout of 10min.
Feb 13 00:40:42 bczhc-arch systemd-shutdown[1]: Using hardware watchdog /dev/watchdog0: 'intel_oc_wdt', version 0.
Feb 13 00:40:42 bczhc-arch kernel: watchdog: watchdog0: watchdog did not stop!
Feb 13 00:40:42 bczhc-arch systemd[1]: Watchdog running with a hardware timeout of 10min.
Feb 13 00:40:42 bczhc-arch systemd[1]: Using hardware watchdog /dev/watchdog0: 'intel_oc_wdt', version 0.
@bczhc
bczhc / a.md
Last active February 13, 2026 16:45
雷神 THUNDEROBOT ZERO 游戏本上遇到的Linux硬件兼容问题

THUNDEROBOT ZERO游戏本上遇到的Linux硬件兼容问题

lshw:

description: Notebook
product: ZERO (JT0096004)
vendor: THUNDEROBOT
version: Type1Version