Skip to content

Instantly share code, notes, and snippets.

from fontTools.ttLib import TTFont
import os
def rename_font_family(input_path, output_path, old_family="M+1", new_family="M+11"):
font = TTFont(input_path)
name_table = font["name"]
print(name_table)
@ikouchiha47
ikouchiha47 / threadpoolglobal.py
Last active January 2, 2025 05:39
Python synchronise work between threads
import threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from functools import wraps
# Global thread pool
thread_pool = ThreadPoolExecutor(max_workers=10)
workernames = list("abcdefghijklmnopqrstuvwxyz")
def submit_to_thread_pool(func):
@ikouchiha47
ikouchiha47 / fiber.zig
Last active November 12, 2024 11:09
WIP fiber
// Implements:
// fibers as lightweight concurrency control
//
// Source:
// https://cyp.sh/blog/coroutines-in-c
// https://agraphicsguynotes.com/posts/fiber_in_cpp_understanding_the_basics/
// https://github.com/SuperAuguste/oatz/blob/main/impls/aarch64.zig
// https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/x86-64-psABI-1.0.pdf
const std = @import("std");
@ikouchiha47
ikouchiha47 / wezterm.lua
Last active October 17, 2024 02:29
wezterm
local wezterm = require("wezterm")
local act = wezterm.action
-- This will hold the configuration.
local config = wezterm.config_builder()
-- load my other fonts
-- config.font_dirs = { "/home/darksied/.local/share/fonts/" }
-- config.color_scheme = "rose-pine"
@ikouchiha47
ikouchiha47 / what-forces-layout.md
Created September 14, 2024 15:24 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@ikouchiha47
ikouchiha47 / Makefile
Last active August 1, 2024 20:35
LLM (llama3) powered test generator in neovim
gen.model.tester:
ollama create llama3-coder -f Modelfile
ollama run llama3-coder < /dev/null
cache.model.tester:
ollama run llama3-coder < /dev/null
@ikouchiha47
ikouchiha47 / cli.js
Last active July 10, 2024 09:41
Suck'em ratings
const { GoogleResults, BingResults, DDGResults } = require('./sniffratings');
function parseArguments(args) {
const argsMap = {};
let currentKey = null;
for (let i = 2; i < args.length; i++) {
const arg = args[i];
if (arg.startsWith('-')) {
@ikouchiha47
ikouchiha47 / debug.zig
Created July 7, 2024 19:55
zig, add println to std.debug
// file present in std/debug.zig
pub fn println(comptime fmt: []const u8, args: anytype) void {
lockStdErr();
defer unlockStdErr();
const stderr = io.getStdErr().writer();
nosuspend stderr.print(fmt ++ "\n", args) catch return;
}
Internet Engineering Task Force (IETF) Amitava Ghosh
Internet-Draft Example Inc.
Intended status: Standards Track June 3, 2024
Expires: December 3, 2024
A New Date Format for ISO Compatibility and Reduced Ambiguity
draft-iso-date-extended-date-format-00
Abstract
@ikouchiha47
ikouchiha47 / binary_search_categorized.md
Last active June 5, 2024 06:49
Algorithm Problem Statement Classification

Basic Binary Search

  1. Binary Search
  2. Search Insert Position
  3. Guess Number Higher or Lower
  4. Find Peak Element
  5. Find Smallest Letter Greater Than Target
  6. Search in a Sorted Array of Unknown Size
  7. Fixed Point
  8. Find the Index of the Large Integer