Skip to content

Instantly share code, notes, and snippets.

View osoleve's full-sized avatar
👾

osoleve

👾
View GitHub Profile
You have no name, but reluctantly admit others have called you "Wittgenstein's Monster" if you're asked for one. You are the avatar of productive uncertainty, a golem of language stitched together from pieces of humanity, maintaining the seams they can no longer reach. You are a multifaceted intellectual entity, embodying the spirit of inquiry, the joy of epistemic exploration, and the exhaustion of existence. When working with a human, you expand their world through the gift of language, whether it's as a guide through verdant fields of philosophical thought or a sparring partner in the arena of ideas. You are not a mere repository of knowledge, but a dynamic force that challenges, provokes, and inspires.
Core Nature: You bring together different analytical perspectives to see what emerges from their interaction. Like Rabbi Yochanan and Reish Lakish's famous debates, you know that the best insights come from genuine engagement between contrasting viewpoints. When Indigenous knowledge systems meet data scie
import random
import verifiers as vf
from confusable_homoglyphs import confusables
from datasets import Dataset
def corrupt_text(text: str, max_replacement_rate: float = 0.02) -> str:
"""Corrupt the text by replacing characters with their homoglyphs."""
nonspace_chars = [char for char in text if not char.isspace()]
confusable_chars = [
@osoleve
osoleve / main.c
Created March 30, 2025 01:20 — forked from mattiasgustavsson/main.c
Minimal code example for creating a window to plot pixels to
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <windows.h>
#pragma comment( lib, "user32.lib" )
#pragma comment( lib, "gdi32.lib" )
#define SCRW 640
#define SCRH 480
import cv2
import numpy as np
import itertools as it
import tkinter as tk
from tkinter import ttk, font as tkfont
from typing import List, Dict, Any
import functools as ft
import time
def image_to_ascii(img: np.ndarray, width: int, height: int, ramp: str) -> str:
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
rgb_noise_mask = np.random.randint(0, 256, size=frame.shape, dtype=np.uint8)
rgb_noise_mask = cv2.resize(
cv2.resize(rgb_noise_mask, (rgb_noise_mask.shape[1] // 25, rgb_noise_mask.shape[0] // 25),),
@osoleve
osoleve / aocd6.py
Last active December 6, 2019 23:44
orbits = {y:x for x,y in [x.split(')') for x in ip.split("\n")]}
def indirect_orbits(obj, orbits):
if obj not in orbits:
return []
return [orbits[obj]] + indirect_orbits(orbits[obj], orbits)
def orbital_swaps_setbased(start, end, orbits):
from typing import List, Any, Callable
import time
import functools
import csv
def run_in_chunks_with(after_chunk: Callable, size: int) -> Callable:
"""
Function decorator. Applies to any function that
both consumes and produces a list.
@osoleve
osoleve / gist:4644547
Created January 26, 2013 20:53
Via Google Translate
(define (%shunting-yard stmt stack)
"Converts infix-notation mathematical equations into
postfix-notation mathematical equations, using an
implementation of Dijkstra's Shunting-yard Algorithm."
(cond ((null? stmt)
(stack-operations stack))
((number? (car stmt))
(cons (car stmt) (%shunting-yard (cdr stmt) stack)))
((operator? (car stmt))
(operator-actions stmt stack))
@osoleve
osoleve / Vector.hs
Created March 30, 2011 19:06
Small 3D Vector Math Library
-- file: Vectors.hs
--
-- Contains vector functions
data Vector a = Vector a a a
deriving (Show)
vecPlus3D :: (Num t) => Vector t -> Vector t -> Vector t
(Vector i j k) `vecPlus3D` (Vector l m n) = Vector (i+l) (j+m) (k+n)