Skip to content

Instantly share code, notes, and snippets.

@pongo
pongo / stream.js
Last active June 7, 2026 08:05
zstd in node:zlib
import { createReadStream, createWriteStream } from 'node:fs';
import zlib from 'node:zlib';
import { pipeline } from 'node:stream/promises';
async function backupFile(filePath) {
const backupPath = `${filePath}.zst`;
const source = createReadStream(filePath);
const compressStream = zlib.createZstdCompress({ params: { [zlib.constants.ZSTD_c_compressionLevel]: 3 } });
const destination = createWriteStream(backupPath);
await pipeline(source, compressStream, destination);
@pongo
pongo / one-punch-man-workout.md
Created June 6, 2026 09:18
One Punch Man Workout

EVERY SINGLE DAY!

  • 100 Push-ups
  • 100 Sit-ups
  • 100 Squats
  • 10 Km run
import os
import stat
import github.Auth
from github import Github
import json
import subprocess
import time
from pathlib import Path
import shutil
@pongo
pongo / bb.go
Created March 19, 2026 10:38
Go bubbletea file listing
package main
import (
"fmt"
tea "github.com/charmbracelet/bubbletea"
"os"
"path/filepath"
)
type model struct {
// ==WindhawkMod==
// @id taskbar-icon-changer
// @name Change taskbar icon
// @description Assigns custom icons to app instances based on their command line arguments or window title.
// @version 0.5
// @author claude
// @include *
// @compilerOptions -lshlwapi -lcomctl32
// ==/WindhawkMod==
export function prevent<T extends unknown[], R>(listener: (event: KeyboardEvent, ...rest: T) => R) {
return (event: KeyboardEvent, ...rest: T) => {
event.preventDefault();
event.stopPropagation();
return listener(event, ...rest);
};
}
import { createKeybindingsHandler } from "tinykeys";
// code from https://github.com/jaywcjlove/hotkeys-js/blob/master/src/index.js
function isInput(event: KeyboardEvent) {
const target = event.target as HTMLInputElement;
const { tagName } = target;
const isInput =
tagName === "INPUT" &&
!["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(
target.type,
@pongo
pongo / 170531.ahk
Last active June 8, 2025 10:49 — forked from bobuk/switcher.ahk
So bored to use default keyboard layouts switcher so write mine with ahk
en := DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1)
ru := DllCall("LoadKeyboardLayout", "Str", "00000419", "Int", 1)
~<+RControl::SetLayout(ru)
~>^LShift::SetLayout(ru)
~RControl::SetLayout(en)
#Space::ChangeLayout()
!Space::ChangeLayout()
ol {
padding-inline-start: 0;
list-style: none;
counter-reset: my-counter;
display: grid;
grid-template-columns: auto 1fr;
row-gap: 0.5rem;
}
ol li {
display: contents;
function debounce(fn, delay) {
let timer;
return function (...args) {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), delay);
};
}