Skip to content

Instantly share code, notes, and snippets.

@rrika
rrika / gsk-demo.c
Last active March 27, 2023 20:57
GSK Demo
// compile with: cc -g `pkg-config --libs --cflags gtk4` -o gsk-demo gsk-demo.c
#include <stdio.h>
#include <gdk/gdk.h>
#include <gsk/gsk.h>
void gtk_init(void);
static const char node[] = "container {\
color {\
@rrika
rrika / oh_no.c
Created September 1, 2023 21:06
reading the wine registry
// compile with gcc -fshort-wchar
#define _GNU_SOURCE // for pipe2
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
@rrika
rrika / unscramble.py
Created September 5, 2023 20:54
ME: please show me the tweets in the order that they were liked COMPUTER: thats too hard. heres some tweets i think are good.
class Node:
capacity = 10
def __init__(self, index, count):
self.index = index
self.count = count
self.children = []
def __iter__(self):
return iter(self.children)
def __len__(self):
return len(self.children)
# https://twitter.com/geofflangdale/status/1798605087885214050
import inspect
import itertools
def sat(formula, preassignment, n=None):
# just bruteforce it, but could be a sat solver too
if n is None:
n = len(inspect.getfullargspec(formula)[0])
for inputs in itertools.product((0, 1), repeat=n):