Skip to content

Instantly share code, notes, and snippets.

View DenisBelmondo's full-sized avatar

Belmondo DenisBelmondo

View GitHub Profile
#!/usr/bin/env luajit2
local ffi = require 'ffi'
ffi.cdef [[
int glfwInit(void);
void glfwTerminate(void);
void glfwWindowHint(int hint, int value);
void* glfwCreateWindow(int width, int height, const char *title, void *monitor, void *share);
void glfwDestroyWindow(void *window);
#include <errno.h>
#include <fcntl.h>
#include <linux/fs.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <unistd.h>
#!/usr/bin/env python3
import ctypes
import threading
import time
import tkinter as tk
def _main() -> None:
done = False
import matplotlib.bezier as bezier
if __name__ == '__main__':
seg = bezier.BezierSegment([
(0, 0),
(16, 40),
(32, -32),
])
seg2 = bezier.BezierSegment([
#ifndef DYNAMIC_ARRAY_H
#define DYNAMIC_ARRAY_H
#ifndef DYNAMIC_ARRAY_MALLOC
#include <stdlib.h>
#define DYNAMIC_ARRAY_MALLOC malloc
#endif
#ifndef DYNAMIC_ARRAY_REALLOC
#include <stdlib.h>
(module
(func $Vector2Add (export "Vector2Add") (param f32) (param f32) (param f32) (param f32) (result f32) (result f32)
local.get 0
local.get 2
f32.add
local.get 1
local.get 3
f32.add
)
@DenisBelmondo
DenisBelmondo / __main__.py
Created February 19, 2024 10:28
prefix expression parser
#!/usr/bin/env python3
import sys
import re
from enum import auto, IntEnum
from typing import Any
re_number = re.compile(r'[0-9]+(.[0-9]+)?')
@DenisBelmondo
DenisBelmondo / array.c
Last active January 31, 2024 08:24
c89 type safe dynamic array (test bed)
#include <stdio.h>
#include "array.h"
typedef Array(int) IntArray;
int main(void) {
IntArray a;
size_t i;
array_init(&a);
@DenisBelmondo
DenisBelmondo / array.h
Created January 31, 2024 08:20
c89 type safe dynamic array
#ifndef ARRAY_H
#define ARRAY_H
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#define Array(T)\
struct {\
T *data;\