Skip to content

Instantly share code, notes, and snippets.

View bczhc's full-sized avatar
🌴

Zhai Can bczhc

🌴
  • Jiangsu, China
  • 07:02 (UTC +08:00)
  • X @bczhc0
View GitHub Profile
@bczhc
bczhc / list.sh
Last active September 26, 2025 15:59
Wplace archive.org urls #archive #wplace
#!/bin/bash
ia search wplace_snapshot | jq '.identifier' -r | while read -r id; do
ia ls "$id" | rg '\.zip$' | while read -r filename; do
echo "https://archive.org/download/$id/$filename"
done
done
@bczhc
bczhc / a.rs
Created September 21, 2025 04:39
Palette-based Bayer dithering (nearest RGB) CLI #image #dithering
pub const WPLACE_PALETTE: [[u8; 3]; 63] = [
// black
[0, 0, 0],
[60, 60, 60],
[120, 120, 120],
[170, 170, 170],
[210, 210, 210],
[255, 255, 255],
[96, 0, 24],
[165, 14, 30],
@bczhc
bczhc / a.md
Last active September 21, 2025 04:00
Palette-based RGB Bayer dithering (quantize only based on luminance) #image #dithering

b.rs尝试了一下用Wplace调色板的效果,结果不好,颜色都失真了。排除掉算法实现有问题情况下,那就是这种纯比较亮度的方案在准确原色彩上依然太欠缺。

@bczhc
bczhc / a.md
Last active September 20, 2025 15:03
RGB bayer dithering with two palette colors #image #dithering

in output

@bczhc
bczhc / a.rs
Last active September 20, 2025 09:53
bayer dithering (grayscale) #dither #image
use image::Luma;
fn bayer_matrix(n: usize) -> Vec<Vec<u8>> {
assert!([2, 4, 8, 16, 32, 64, 128, 256].contains(&n));
// 递归生成
fn generate(size: usize) -> Vec<Vec<u32>> {
if size == 2 {
return vec![vec![0, 2], vec![3, 1]];
}
#![feature(decl_macro)]
use crate::cli::Commands;
use anyhow::anyhow;
use clap::Parser;
use flate2::Compression;
use indicatif::{ProgressBar, ProgressStyle};
use once_cell::sync::Lazy;
use pathdiff::diff_paths;
use png::{BitDepth, ColorType, Info};
@bczhc
bczhc / a.md
Created September 1, 2025 15:08
使用mitmdump自动下载Wplace区块图片

由于我需要使用代理访问Wplace,所以使用mitmproxy的代理链支持。运行如下命令:

mitmdump --mode upstream:http://127.0.0.1:16619 -s mitm.py

然后把浏览器的代理设置成http://localhost:8080即可。

但是使用下来,我不知道问题出在哪里,很不稳定。有时就加载不出来,需要重启mitmdump以及刷新网页。反正很不稳定。不好用。遂放弃。

@bczhc
bczhc / a.md
Created August 29, 2025 12:50
获取Discord服务器中成员与我的mutualGuilds

https://github.com/bczhc/discord-mutual-friends-and-servers

  1. 使用venv安装好依赖。
  2. 运行python3 main.py -j True -i <Server Name>
  3. 获取结果保存在output/out.jsonl
  4. 使用jq对mutualGuilds数量由高到低排序
    cat out.jsonl \
    | jq '[.name, (.mutualGuilds | length), (.mutualGuilds | map(.guild.name))]' -c \

| jq -s 'sort_by(.[1]) | reverse[]' -c | bat

@bczhc
bczhc / 老数据了。.txt
Created August 6, 2025 06:51
Bitcoin mainnet链上OP_RETURN含emoji的 #bitcoin
Happy 2015! 😄
William♥Allie
Nathan♥Noriko
Nathan & Noriko♥Noah
JH♥LH
brad♥http://www.blockchain.capital
1♥1
Matt♥Tacos
Nathan♥DraperU
Nathan♥Draper University
@bczhc
bczhc / a.txt
Created August 3, 2025 04:48
ebird莫名卡出的api
https://ebird.org/map/points?speciesCode=rewbul&byr=1900&eyr=2025&yr=all&bmo=1&emo=12&maxY=30.478507676961687&maxX=120.7798322521297&minY=29.78845980687814&ev=Z&excludeExX=false&excludeExAll=false&minX=119.1978010021297