Skip to content

Instantly share code, notes, and snippets.

View rinsuki's full-sized avatar

rinsuki rinsuki

View GitHub Profile
@rinsuki
rinsuki / wip.js
Created April 6, 2025 00:50
very wip, but you should be able to use this w/ ESM version of noVNC which `rfb` is not available on browser console. YOU NEED TO SET REMOTE MACHINE'S KEYBOARD LAYOUT TO US ONE
(async () => {
async function inputToCanvas(input) {
const needShift = '!"#$%&()}*+:>?@^_{|}~'
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
const canvas = document.querySelector("#screen canvas")
for (const char of input) {
console.log(char)
if (char === "\n") {
const keydown = new KeyboardEvent("keydown", {
code: "Enter",
import ipaddress
import re
def convert_ipv6_netmask_to_prefixlen(addr: str):
addr = ipaddress.IPv6Interface(addr)
addr = "".join([f"{byte:08b}" for byte in addr.packed])
return len(re.match("^(1*)(0*)$", addr).group(1))
assert convert_ipv6_netmask_to_prefixlen("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff") == 128
assert convert_ipv6_netmask_to_prefixlen("ffff:ffff:ffff:ffff::") == 64
@rinsuki
rinsuki / arm64-apple-macos13.asm
Created September 21, 2024 08:38
swiftc -emit-assembly -Osize -target arm64-apple-macos14 test.swift
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 13, 0 sdk_version 15, 0
.globl _main
.p2align 2
_main:
mov w0, #0
ret
.private_extern _$s4test4mainSiyF
.globl _$s4test4mainSiyF
Exception: mprotect returned EACCES
MonoMod.RuntimeDetour.Platforms.DetourNativeMonoPosixPlatform.SetMemPerms (System.IntPtr start, System.UInt64 len, MonoMod.RuntimeDetour.Platforms.DetourNativeMonoPosixPlatform+MmapProts prot) (at <036d18f9edfb4e6d97ce4f777d0e0eb4>:0)
MonoMod.RuntimeDetour.Platforms.DetourNativeMonoPosixPlatform.MakeWritable (System.IntPtr src, System.UInt32 size) (at <036d18f9edfb4e6d97ce4f777d0e0eb4>:0)
MonoMod.RuntimeDetour.DetourHelper.MakeWritable (MonoMod.RuntimeDetour.IDetourNativePlatform plat, MonoMod.RuntimeDetour.NativeDetourData detour) (at <036d18f9edfb4e6d97ce4f777d0e0eb4>:0)
MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._HookSelftest (System.Reflection.MethodInfo from, System.Reflection.MethodInfo to) (at <036d18f9edfb4e6d97ce4f777d0e0eb4>:0)
MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform..ctor () (at <036d18f9edfb4e6d97ce4f777d0e0eb4>:0)
MonoMod.RuntimeDetour.Platforms.DetourRuntimeMonoPlatform..ctor () (at <036d18f9edfb4e6d97ce4f777d0e0eb4>:0)
MonoMod.Run
@rinsuki
rinsuki / README.md
Created August 31, 2024 15:58
Load wav file with Shift-JIS RIFF INFO chunks w/ MusicBrainz Picard
import glob
import plistlib
FAKE_VERSION = b"22G74"
for file in glob.iglob("**/Info.plist", recursive=True):
if ".storyboardc/" in file:
continue
print(file)
with open(file, "rb") as fp:
const BLOCK_SIZE: usize = 4 * 1024 * 1024;
/// Implementation of Dropbox's Content Hash.
/// See https://www.dropbox.com/developers/reference/content-hash
pub struct ContentHash {
entire_hasher: ring::digest::Context,
block_hasher: ring::digest::Context,
block_position: usize,
}
objc[4253]: Class _TtC4GRDB8Database is implemented in both /System/Library/PrivateFrameworks/GRDB.framework/GRDB (0x1df0ed2c0) and /private/var/containers/Bundle/Application/<UUID>/iMast.app/Frameworks/GRDB.framework/GRDB (0x104b3f8c0). One of the two will be used. Which one is undefined.
objc[4253]: Class _TtC4GRDB17DatabaseCollation is implemented in both /System/Library/PrivateFrameworks/GRDB.framework/GRDB (0x1df0ec5a0) and /private/var/containers/Bundle/Application/<UUID>/iMast.app/Frameworks/GRDB.framework/GRDB (0x104b3fbf0). One of the two will be used. Which one is undefined.
objc[4253]: Class _TtC4GRDB16DatabaseFunction is implemented in both /System/Library/PrivateFrameworks/GRDB.framework/GRDB (0x1df0ec510) and /private/var/containers/Bundle/Application/<UUID>/iMast.app/Frameworks/GRDB.framework/GRDB (0x104b3fd88). One of the two will be used. Which one is undefined.
objc[4253]: Class _TtCC4GRDB16DatabaseFunctionP33_1F1016B0E130FBD1433DD56AD149CDA818FunctionDefinition is implemented in both /Syste
import json
import sys
with open(sys.argv[1], "r") as f:
data = json.load(f)
out = []
for checkin in data:
if checkin.get("private", False):
continue
should_skip = False
diff --git a/package.json b/package.json
index 36b0d579bce1cea8f9bbe373a92f28eb275d72a5..ccfe1dd9cac7d6792f1dfe4cba845748f3c2fbdb 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,7 @@
},
"exports": {
".": {
+ "types": "./index.d.ts",
"node": {