Skip to content

Instantly share code, notes, and snippets.

View andy0130tw's full-sized avatar
🍌
why no 🍆

Andy Pan andy0130tw

🍌
why no 🍆
View GitHub Profile
@andy0130tw
andy0130tw / cm-linked-views.ts
Last active August 23, 2026 12:44
PoC of linked editor views for CodeMirror 6
import {
type Extension,
type EditorStateConfig,
type ChangeSpec,
type TransactionSpec,
Transaction,
Compartment,
EditorState,
Annotation,
StateField,
@andy0130tw
andy0130tw / agda-stdout-decoder.ts
Last active July 22, 2026 17:43
Message delimiter for Agda's interaction mode
import chp from 'child_process'
import { Readable } from 'stream'
import { inspect } from 'util'
enum DecoderState {
Initial,
// Agda used to (until 2.7.0.1) emit error when the data dir is not found before the very first prompt;
// this has now (v2.8.0) become a runtime error message to stderr;
// in v2.9.0 nightly (2026/7/22) the stacktrace is printed to stdout???
StartupMessage,
type U8Arr = Uint8Array<ArrayBuffer>
class MaybeUnzipGzipTransformer implements Transformer<U8Arr, U8Arr> {
nbytes = 0
isGzip: boolean | null = null
static expectedHeader = new Uint8Array([0x1f, 0x8b, 0x08])
sink: WritableStreamDefaultWriter<U8Arr> | undefined
transform(chunk: U8Arr, controller: TransformStreamDefaultController<U8Arr>) {
if (this.isGzip == null) {
@andy0130tw
andy0130tw / gitlab-fxxk-no-ai.userstyle.css
Last active September 10, 2026 16:43
GitLab FUCK NO AI
/* modev to https://github.com/andy0130tw/fuck-no-ai/blob/master/gitlab.com.userstyle.css */
[data-testid=ai-panels] {
display: none;
}
#menu-section-button-ai {
display: none;
}
@andy0130tw
andy0130tw / freetype-test.zig
Last active June 28, 2026 12:08
My first Zig project!
const std = @import("std");
const freetypeWrapper = @import("freetype.zig");
const freetype = freetypeWrapper.freetype;
const ftUnwrap = freetypeWrapper.ftUnwrap;
const shstw = @embedFile("shstw-hinted.ttf");
var ftlib: freetype.FT_Library = null;
var face: freetype.FT_Face = null;
= 太BDF計画 =
Programmed by NAGAO, Sadakazu
-- 目 次 ----------------------------------------------------------------------
1. 概要 ... 16(行目)
2. 仕組 ... 25
3. 使用法 ... 64
@andy0130tw
andy0130tw / myft.py
Created June 10, 2026 15:17
FreeType rendering some chars
import freetype
from PIL import Image
import math
def byte2bin(n):
assert 0 <= n < 256
return bin(n)[2:].rjust(8, '0')
ttf_path = 'Cubic_11.ttf'
pixel_size = 12
@andy0130tw
andy0130tw / kagi-mute-slop-results.css
Last active September 10, 2026 22:52
A minimal CSS snippet to make AI slop results appear faded
.theme_dark .search-result:has(.ai-stain-icon),
.theme_dark .search-result:has(.ai-stain-icon) + .sr-group {
--app-text: #403E3C80;
--search-result-url-link: #878580;
--result-item-title-border: #87858080;
--search-result-title: #87858080;
--search-result-content-text: #87858080;
}
.theme_dark .search-result .ai-stain-icon > svg {
@andy0130tw
andy0130tw / idbaafs.ts
Created January 20, 2026 21:26
IndexedDB as a filesystem
import { Buffer } from 'buffer'
;(globalThis as any).Buffer = Buffer
import git from 'isomorphic-git'
import http from 'isomorphic-git/http/web'
function idbRequestToPromise<T>(req: IDBRequest<T>) {
return new Promise<T>((resolve, reject) => {
req.onsuccess = evt => resolve((evt.target as IDBRequest<T>).result)
req.onerror = evt => reject((evt.target as IDBRequest<T>).error)
@andy0130tw
andy0130tw / cm6.userstyle.css
Created January 5, 2026 11:08
Night mode for CodeMirror 6 docs
html, body {
color-scheme: dark;
background: #100F0F;
color: #CECDC3;
}
nav#toc a.current-section {
color: white;
}