Skip to content

Instantly share code, notes, and snippets.

@moreaki
moreaki / DispatchSourceNestedWriteCheck.swift
Created March 15, 2026 01:08
Issue #480 investigation scripts: root-only DispatchSource watcher vs recursive FSEvents
import Foundation
import Dispatch
let fileManager = FileManager.default
let rootURL = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
.appendingPathComponent("latest-watch-test-\(UUID().uuidString)", isDirectory: true)
let nestedURL = rootURL.appendingPathComponent("Browsers", isDirectory: true)
try fileManager.createDirectory(at: nestedURL, withIntermediateDirectories: true)
defer { try? fileManager.removeItem(at: rootURL) }
@moreaki
moreaki / AppDirectoryTest.swift
Created March 15, 2026 01:07
Regression test for Latest recursive subfolder watcher
//
// AppDirectoryTest.swift
// Latest Tests
//
// Created by Codex on 15.03.26.
//
import XCTest
@testable import Latest
@moreaki
moreaki / exploit-analysis.js
Created September 10, 2025 21:01
SUPPLY CHAIN HACK: Analysis from GPT
/* ========================================================================
* MALICIOUS SCRIPT — ANALYSIS EDITION (NON-EXECUTABLE)
* Purpose (original):
* 1) Patch fetch/XMLHttpRequest responses to replace crypto addresses
* 2) Hook wallet providers (Ethereum, Solana) and rewrite outgoing txs
* ===================================================================== */
/** Global flags used by the original */
let hasEthAccount = 0; // neth
let alreadyRan = 0; // rund
@moreaki
moreaki / kk.c
Created January 2, 2017 21:20
Test code to compare different diassembly and decompiling strategies on MacOSX
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define d32 32-__builtin_clz
#define d64 64-__builtin_clzl
#define F_U32 "%24u: f1_u32:%2d f2_u32:%2d f1_u64:%2d f2_u64:%2d type:%18s\n"
#define F_U64 "%24llu: f1_u32:%2d f2_u32:%2d f1_u64:%2d f2_u64:%2d type:%18s\n"
/* kk.c: Testcode for debugging decompiling functionality
//
// PropertyMacros.h
//
//
// Created by Nicolas Bouilleaud on 12/04/12,
// using ideas by Uli Kusterer (http://orangejuiceliberationfront.com/safe-key-value-coding/)
// Laurent Deniau (https://groups.google.com/forum/?fromgroups#!topic/comp.std.c/d-6Mj5Lko_s)
// and Nick Forge (http://forgecode.net/2011/11/compile-time-checking-of-kvc-keys/)
//
//
/*/../bin/ls > /dev/null
COMPILED=${0%.*}
clang $0 -o $COMPILED -framework Foundation;
$COMPILED; rm $COMPILED; exit;
*/
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])