Skip to content

Instantly share code, notes, and snippets.

View jnorthrup's full-sized avatar

Jim Northrup jnorthrup

  • here, now
View GitHub Profile
#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) {
@jnorthrup
jnorthrup / telegram-record.bash
Last active July 1, 2023 11:28
record a pulsaudio telegram chat and whisper transcription based on recent gentoo build
#!/bin/bash
# Define the Whisper function
whisp() {
source ~/extras/venv/bin/activate # ymmv, this is my "userspace" requirement
whisper --model medium.en --output_format=all $@ #pip3 install openai-whisper to get this
}
# Get the sink input index for 'telegram-desktop'
sink_input_index=$(pactl list short | grep 'telegram-desktop' | cut -f1|head -n1 )

edsy sidey

image

@jnorthrup
jnorthrup / gist:fb105a5aef7241ec2513bcdef10a4c5f
Last active July 4, 2022 12:33
add simplest possible zstd to kde konq,dolphin context menu
x=$(kf5-config --path services|cut -f1 -d:)&&mkdir -p $x/ServiceMenus&&pushd $x/ServiceMenus&&
cat <<EOF
[Desktop Entry]
Type=Service
ServiceTypes=all/allfiles
MimeType=all/all;
Actions=CompressZstd
X-KDE-Priority=TopLevel
X-KDE-Submenu=7-Zip