Skip to content

Instantly share code, notes, and snippets.

View bczhc's full-sized avatar
🌴

Zhai Can bczhc

🌴
  • Jiangsu, China
  • 20:20 (UTC +08:00)
  • X @bczhc0
View GitHub Profile
@bczhc
bczhc / a.md
Last active January 23, 2026 10:59
Steam运行SpaceEngine 偶发kernel panic

Arch Linux, Hyprland, Linux bczhc-arch 6.18.2-bczhc-dirty #96 SMP PREEMPT_DYNAMIC Wed Dec 24 14:51:46 CST 2025 x86_64 GNU/Linux

GE-Proton10-28

启动参数:

MANGOHUD_CONFIGFILE=/home/bczhc/.config/mangohud PROTON_USE_WINED3D=0 VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json mangohud %command%
@bczhc
bczhc / a.md
Created January 22, 2026 10:47
Segment Anything and GIMP plugin 使用快速笔记 #sam #gimp

Segment Anything and GIMP plugin

Clone sam1 and sam2 and set up the environment:

git cl https://github.com/facebookresearch/segment-anything
git clone https://github.com/facebookresearch/segment-anything-2.git

cd segment-anything
@bczhc
bczhc / a.md
Last active January 17, 2026 02:01
截至1.12 Wplace快照总区块数 #wplace

处理:

ls all/*.diff | parallel -k '                                                                                                                        32s 09:49:48
    filename=$(basename {} .diff);
    # Extract parts: YYYY-MM-DD and HH-MM-SS
    d_part=${filename%T*};
    t_part=${filename#*T};
    # Replace hyphens with colons in the time part only
    t_fixed=$(echo ${t_part%.*} | tr "-" ":");
@bczhc
bczhc / a.html
Created January 12, 2026 05:15
仿GitHub贡献日期热力图 HTML
<!DOCTYPE html>
<!-- Co-created with Gemini -->
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>贡献热力图 - 多年份支持</title>
<style>
:root {
--cell-size: 11px;
--cell-gap: 3px;
@bczhc
bczhc / a.typ
Last active January 14, 2026 01:51
"Linear Chinese"
#set page(width: 4.4in, height: 2in)
#set text(size: .2in)
#show math.equation: set text(font: (
(
name: "FZShuSong-Z01",
covers: regex("\p{Han}"),
),
))
#show: set align(center + horizon)
@bczhc
bczhc / a.rs
Last active December 29, 2025 14:40
Huffman编码文件解压缩器 #huffman
/// 没有支持流式压缩/解压缩
///
/// 手动实现,未使用bitvec bitstream-io 等库,练习作品,还有很多优化空间、、
#![feature(file_buffered)]
use byteorder::{ReadBytesExt, WriteBytesExt, LE};
use clap::Parser;
use std::cmp::{Ordering, Reverse};
use std::collections::{BinaryHeap, HashMap};
@bczhc
bczhc / a.cc
Last active December 28, 2025 09:54
Huffman编码实现 #huffman
#include <iostream>
#include <optional>
#include <vector>
using namespace std;
using Symbol = string;
class Node {
public:
@bczhc
bczhc / a.md
Created December 27, 2025 05:04
频域操作实验

使用Rust写如下程序,用到主要crate有realfft、hound。

读入音频/home/bczhc/Music/2.wav,其总采样点数为N。对左右声道分别实数dft,fft点数为N。

对输出的结果进行降采样,设置一个缩放系数,比如为2.0,那就分配一个新的频域采样数组长度为N/2.0,然后把原fft结果降采样映射到新数组,不能有truncate,也就是新数组第一个元素是旧数组第一个元素,新数组最后一个元素就是旧的最后一个。

把新数组idft成新的音频,输出到/home/bczhc/out.wav,idft点数为新数组的长度。

左右声道的处理部分抽取成函数。缩放系数置为常量。

@bczhc
bczhc / a.rs
Created December 26, 2025 14:50
对音频dft小玩具 #dft #fft #audio
//! Mainly wrote by Gemini.
use anyhow::{Context, Result};
use clap::Parser;
use hound::{SampleFormat, WavReader, WavSpec, WavWriter};
use num_complex::Complex64;
use rustfft::FftPlanner;
use std::env;
use std::f64::consts::TAU;
use std::path::PathBuf;
@bczhc
bczhc / a.rs
Created December 26, 2025 07:12
chatgpt使用macroquad写的李萨如图小玩具 #vibecoding #macroquad #cg
// [dependencies]
// macroquad = "0.4.14"
// palette = "0.7.6"
use macroquad::hash;
use macroquad::prelude::*;
use macroquad::ui::{root_ui, widgets};
use palette::{FromColor, Hsl, Srgb};
fn window_conf() -> Conf {