Skip to content

Instantly share code, notes, and snippets.

View marvinborner's full-sized avatar
🏳️‍🌈
hallucinating functions

Marvin marvinborner

🏳️‍🌈
hallucinating functions
View GitHub Profile
@marvinborner
marvinborner / abstract_algorithm.py
Created May 5, 2024 00:44
Optimal lambda calculus evaluator in Python based on @VictorTaelin's JavaScript abstract algorithm implementation (1:1 translation)
# translated from https://github.com/VictorTaelin/abstract-algorithm
import math
import re
# --- name.js ---
count = 0
@marvinborner
marvinborner / sync.sh
Created February 12, 2024 17:34
hacky cgit github sync script
#!/bin/bash
gh repo list "$1" --limit 1000 --json "nameWithOwner,isPrivate,description,pushedAt" | jq -r ".[]|[.nameWithOwner,.isPrivate,.description,.pushedAt] | @tsv" |
while IFS=$'\t' read -r name private description pushedAt; do
if [ -f "$name"/.git/age ]; then
currentAge="$(date -d "$(cat "$name"/.git/age)" +%s)"
newAge="$(date -d "$pushedAt" +%s)"
if [ "$currentAge" -ge "$newAge" ]; then
continue
fi
@marvinborner
marvinborner / repro.js
Created January 20, 2024 23:08
Effekt #366
const { spawn } = require("child_process");
const net = require("net");
const {
createProtocolConnection,
HoverRequest,
NullLogger,
InitializeRequest,
DidOpenTextDocumentNotification,
DidCloseTextDocumentNotification,
InitializedNotification,
@marvinborner
marvinborner / blc_encoding_experiment.c
Last active May 25, 2023 15:58
Experiment for finding a short BLC encoding for binary data
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
static void to_digits(unsigned char *bytes, int n_bytes, unsigned int *digits,
int n_digits, unsigned int base)
{
for (int i_byte = 0; i_byte < n_bytes; i_byte++) {
unsigned char byte = bytes[i_byte];
@marvinborner
marvinborner / lambda.c
Created January 5, 2022 19:12
Lambda function macro in C
#define lambda(ret, args, body) __extension__({ ret anon args body anon; })
@marvinborner
marvinborner / plist.c
Created September 16, 2021 12:31
Quick and dirty plist xml dump/formatter for debugging/representation
#include <stdio.h>
#include <plist/plist.h>
#define INDENT 4
void plist_dump(plist_t plist, int depth)
{
for (int i = 0; i < depth * INDENT; i++)
printf(" ");
if (PLIST_IS_BOOLEAN(plist)) {