Skip to content

Instantly share code, notes, and snippets.

Only in libxml2: .git
Only in libxml2: .gitattributes
Only in libxml2: .gitignore
diff -ru libxml2/CMakeLists.txt libxml2-apple/libxml2/CMakeLists.txt
--- libxml2/CMakeLists.txt 2025-06-26 02:38:44
+++ libxml2-apple/libxml2/CMakeLists.txt 2025-06-26 01:54:56
@@ -60,6 +60,7 @@
option(LIBXML2_WITH_XINCLUDE "Add the XInclude support" ON)
option(LIBXML2_WITH_XPATH "Add the XPATH support" ON)
option(LIBXML2_WITH_XPTR "Add the XPointer support" ON)
# This will respond to keyboard input after either a 12ms delay (capital A) or
# no delay (lowercase a).
# For some reason this causes up to 50ms of difference in Terminal.app.
# Press Ctrl-C to stop.
import os, time, re, tty, termios
try:
old_settings = termios.tcgetattr(0)
tty.setraw(0)

Investigating the transference glitch in Mario Maker 2

I watched the offset blocks video and got nerd-sniped by "we don't really know why this happens". So I spent some more time on my hobby of reverse engineering this game.

TL;DR

When a block is hit, its collision type is set to 0 (disabled), and an actor is created to play the block-hit animation. Also, the block's bottom-left corner is converted to an integer grid square, rounding towards zero, and that square in the visual appearance grid (which is separate from collision) is set to empty.

When the animation is finished, the actor takes the x/y coordinates corresponding to its center and converts them to an integer grid square, again rounding towards zero. Then it iterates over the collision list for that grid square, searching for a block with a collision type of 0 (which would normally be the same block it was spawned from). When it finds such a block, it sets its collision type based on the type of actor (e

# https://news.ycombinator.com/item?id=38782678
import timeit, random, string, re
def is_palindrome_chatgpt_1(s):
# [written by ChatGPT]
# Convert the string to lowercase and remove non-alphanumeric characters
cleaned_string = ''.join(char.lower() for char in s if char.isalnum())
# Compare the cleaned string with its reverse
#!/usr/bin/env python3
import sys, pty, os, time, threading, queue, argparse
ap = argparse.ArgumentParser()
parser = argparse.ArgumentParser(
description='Tests the input latency of a shell',
usage='usage: shell-latency-test-infinite.py [--sleep] [--] argv-to-execute...',
)
parser.add_argument('--sleep',
action='store_true',
@comex
comex / shell-latency-test.py
Created September 23, 2023 23:26
Tool to test a shell's input latency
import sys, pty, os, time, signal, threading, string, random
sub_argv = sys.argv[1:]
if not sub_argv:
raise Exception("usage: shell-latency-test.py shell-to-test (e.g.: shell-latency-test.py nu)")
# Spawn the shell in a pty which we own the controlling end of.
child_pid, fd = pty.fork()
if child_pid == 0:
# This is the child process. Exec the shell.
@comex
comex / test.c
Last active August 13, 2023 22:12
#pragma STDC FENV_ACCESS ON
#include <signal.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <fenv.h>
static void check(const char *where) {
printf("%-40s: fegetround() => %#x\n", where, fegetround());
}
@comex
comex / assh
Last active July 14, 2023 21:36
#!/usr/bin/env python3
# SPDX-License-Identifier: CC0-1.0
'''Wraps the ssh command, but quotes arguments so that they are passed 1:1 to
the remote command.
'''
import shlex, sys, os
args = sys.argv[1:][::-1]
out = ['ssh']
while args and args[-1].startswith('-'):
arg = args.pop()
#include <spawn.h>
#include <assert.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <stdio.h>
extern char **environ;
int main(int argc, char **argv) {
if (!argv[1]) {
fprintf(stderr, "usage: spawn-bench <command> [args...]\n");
@comex
comex / wormdump.c
Created April 9, 2015 06:07
Some old broken code in case it helps anyone
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/kern_event.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <net/ethernet.h>