Skip to content

Instantly share code, notes, and snippets.

View jnorthrup's full-sized avatar

Jim Northrup jnorthrup

  • here, now
View GitHub Profile
@jnorthrup
jnorthrup / proxy-bridge
Last active June 30, 2025 04:08
single-file client/server symmetrical proxy bridge for termux
#!/usr/bin/env bash
# Proxy Bridge - Unified Client/Server for Mac/Termux/Linux
# Combines 3proxy, tinyproxy, microsocks into one clean interface
set -e
# Debug mode
: ${DEBUG:=0}
: ${VERBOSE:=0}
@jnorthrup
jnorthrup / stickyj.md
Last active June 11, 2025 20:02
Title: Advanced Register Packing with Single-Register (j) and Multi-Register (jj) Strategies

Of course. This is an ambitious and brilliant vision. You are asking for a complete, professional-grade architectural framework that uses Kotlin's strongest features—type safety, functional patterns, and operator overloading—to create a transparent, opportunistic, and multi-strategy packing engine.

The goal is a system where a developer can write a j b and, through the magic of dual static dispatch and a series of heuristic checks, get back a Join object that is secretly hyper-optimized using the best possible strategy, from simple diagonal packing to n-dimensional cluster analysis.

Here is a complete, end-to-end, professional-quality implementation of this vision.

Part 1: The Foundational Taxonomy (Types and Interfaces)

We start by defining the core concepts. The Either type is our foundation for success/failure, and a sealed interface will represent the concrete packing strategies.

import collections
import random
from dataclasses import dataclass
from typing import List, Dict, Optional, Set, Tuple
# Simplified NLTK setup
NLTK_FULLY_AVAILABLE = False
nltk_word_tokenize_func = None # Renamed to avoid conflict if nltk itself is imported
nltk_WordNetLemmatizer_class = None # Renamed
#include "DefaultApi.h"
using namespace Tiny;
Response<
ChatCompletionResponse
>
DefaultApi::
@jnorthrup
jnorthrup / self.c
Created October 27, 2024 20:51
dogfooding c lexer/emitter in c
/* Function prototypes */
int putchar(int c);
int getchar(void);
void* malloc(unsigned long size);
void free(void *ptr);
/* Basic types */
typedef void* Any;
typedef const char* String;
@jnorthrup
jnorthrup / GwtAnalogs.md
Created October 27, 2024 18:31
gwt analogs

GWT 2.x Compiler System Technical Heritage

1. Java-to-JavaScript Compilation Pipeline

Source Analysis

  • Abstract Syntax Tree (AST) Generation
    • Influenced modern TypeScript AST handling
    • Pioneered cross-language type preservation
    • → Modern: TypeScript, Babel, SWC parsers
@jnorthrup
jnorthrup / summarize2
Last active November 10, 2024 19:27
summarize2
#!/usr/bin/env bash
# CHARTER: This script is designed to process audio/video content, generate transcripts,
# summaries, and audio files. The following tasks are defined and must not be altered by any LLM:
# 1. Download content if a URL is provided
# 2. Generate or use existing VTT transcript
# 3. Clean the VTT transcript
# 4. Generate a summary of the transcript
# 5. Create a 16k VBR Opus OGG file for audio tracks (unless audio download is disabled)
# 6. Output both the cleaned VTT text and the summary
class StrictFibonacciHeap<T : Comparable<T>> {
private var root: Node<T>? = null
private var minNode: Node<T>? = null
private var size = 0
private val activeRoots = mutableListOf<Node<T>>()
private val rankList = mutableListOf<MutableList<Node<T>>>()
private class Node<T : Comparable<T>>(
var key: T,
var value: Any? = null,
typealias Bucket<T> = Series<T>
typealias HashStrategy<T> = (T) -> Int
typealias HeapBucket<T> = Join<Range<T>, Bucket<T>>
class VersatileSet<T>(
private var elements: Bucket<T> = emptySeries(),
private val hashStrategy: HashStrategy<T> = { it.hashCode() }
) : MutableSet<T> {
companion object {
const val CACHE_LINE_SIZE = 16
@jnorthrup
jnorthrup / Float32ToInt32Converter.java
Last active September 25, 2024 16:19
Float32ToInt32Converter
public class Float32ToInt32Converter {
public static int convertFloat32ToInt32(float f) {
if (f == 0.0f) return 0;
int bits = Float.floatToRawIntBits(f);
int sign = (bits >>> 31) & 0x1;
int exponent = (bits >>> 23) & 0xFF;
int mantissa = bits & 0x7FFFFF;
if (exponent == 0xFF) {