Skip to content

Instantly share code, notes, and snippets.

View taoky's full-sized avatar
💼
Please remind me if I forget something!

taoky taoky

💼
Please remind me if I forget something!
View GitHub Profile
@taoky
taoky / fix_img_dimensions.rb
Last active July 12, 2025 18:19
jekyll keep image aspect-ratio to avoid CLS
# Initially generated by LLM
# Put in _plugins/ and add fastimage and nokogiri to deps
require 'fastimage'
require 'nokogiri'
Jekyll::Hooks.register %i[pages posts], :post_render do |page|
next unless page.output_ext == '.html'
doc = Nokogiri::HTML5.parse(page.output)
changed = false
@taoky
taoky / 0-shuorenhua.md
Last active April 15, 2025 15:27
欧式中文翻译腔的简单速查脚本

两个版本:

  • shuorenhua-llm.py 需要与 OpenAI API 兼容的 LLM 服务商
  • shuorenhua.py 是非常简单的基于规则的脚本

以下的例子来自 。

@taoky
taoky / pytorch-releases-analyze.py
Last active January 31, 2025 04:03
download.pytorch.org file sizes (without nightly)
import json
import os
import requests
import re
import sys
import traceback
HREF_RE = re.compile(r'href="([^"]+)"')
with open("releases.json") as f:
@taoky
taoky / zfsarctop
Last active December 26, 2024 10:49
Show ZFS ARC hit/miss per process with Linux eBPF, modified from cachetop
#!/usr/bin/env python
# Code modified from bcc-tools cachetop
from __future__ import absolute_import
from __future__ import division
# Do not import unicode_literals until #623 is fixed
# from __future__ import unicode_literals
from __future__ import print_function
from bcc import BPF
@taoky
taoky / appinfo.py
Created December 20, 2024 07:36
Show Linux Desktop AppInfo with Gio
import gi
gi.require_version("Gio", "2.0")
from gi.repository import Gio
def main():
# Retrieve all applications using g_app_info_get_all()
app_infos = Gio.AppInfo.get_all()
# Print details for each application
for app_info in app_infos:
@taoky
taoky / wide.md
Created November 10, 2024 13:31
Wide character compatibility

Wide Character Compatibility on Windows, WINE and POSIX

Standard C

#include <stdio.h>
#include <wchar.h>
#include <locale.h>

int main() {
@taoky
taoky / Haruhikage.txt
Last active November 9, 2024 18:30
BeepPlay 2 DECPS
# Converted from https://musescore.com/user/76963843/scores/19868371
60 0
8 4 2
6 4 2
3 5 4
3 5 4
1 5 4
4 5 4
3 5 4
1 5 4
@taoky
taoky / Cargo.toml
Last active November 11, 2024 07:26
Simulate keyboard input in GNOME/KDE Wayland
[package]
name = "keyboardsim"
version = "0.1.0"
edition = "2021"
[dependencies]
ashpd = "0.10.2"
keycode = "0.4.0"
tokio = { version = "1.41.1", features = ["full"] }
@taoky
taoky / main.js
Created October 25, 2024 05:49
Electron wayland tray activation bug
// Modules to control application life and create native browser window
const { app, BrowserWindow, Notification, Tray, Menu } = require('electron')
const path = require('node:path')
let tray;
let mainWindow;
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
@taoky
taoky / Program.cs
Created June 16, 2024 18:15
Read osu realm and get audio/bg hashes
// CollectionDowngrader.LazerSchema from https://github.com/ookiineko/CollectionDowngrader/tree/main/LazerSchema
using CollectionDowngrader.LazerSchema;
using Realms;
// Console.WriteLine($"cwd: {Environment.CurrentDirectory}");
const int LazerSchemaVersion = 41;
string realmFile = Path.GetFullPath("./client.realm");
RealmConfiguration config = new(realmFile)
{
IsReadOnly = true,