Skip to content

Instantly share code, notes, and snippets.

View DenisBelmondo's full-sized avatar

Belmondo DenisBelmondo

View GitHub Profile
@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;\
@DenisBelmondo
DenisBelmondo / adlmidi_raylib_test.c
Last active January 21, 2024 20:20
libADLMIDI + raylib example
#include <adlmidi.h>
#include <raylib.h>
#include <stdio.h>
#define MAX_SAMPLES_PER_UPDATE 4096
static struct ADL_MIDIPlayer *midi_player;
static struct ADLMIDI_AudioFormat adl_audio_format = {
ADLMIDI_SampleType_F32,
sizeof(float),
https://github.com/VSCodium/vscodium/issues/1640
@DenisBelmondo
DenisBelmondo / main.c
Created June 11, 2023 22:55
C dynamic array implementation
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
struct ListInfo;
struct List;
typedef void *(*alloc_item_func_t)(struct ListInfo *, struct List *);
typedef void (*free_item_func_t) (struct ListInfo *, struct List *, size_t);
typedef void (*free_data_func_t) (struct ListInfo *, struct List *);
@DenisBelmondo
DenisBelmondo / Transform.cs
Last active March 1, 2023 19:24
Untested transform rotation shit
public struct Transform
{
public Vector3 Right;
public Vector3 Up;
public Vector3 Forward;
public Transform()
{
Right = Vector3.UnitX;
Up = Vector3.UnitY;
@DenisBelmondo
DenisBelmondo / gist:e6423945692e0b15b1421f68faf819c6
Last active February 1, 2023 02:38
Test case for ZScript default and state block syntax highlighting
// observe that the highlighting for state blocks does not break when on top
// of default blocks and vice versa.
class SomeInventory : Inventory
{
default
{
// hopefully, "Inventory" here will be highlighted as "entity.name.class.zscript"
Inventory.PickupMessage "You will never see this message ingame!";
@DenisBelmondo
DenisBelmondo / gist:c018c1c1df7030d083f47b336e58ebff
Created June 9, 2022 17:39
Lua C++ style classes syntax hack
function class(name)
local penis = {
public = function(_, super_name)
return function(body)
print(body)
end
end
}
setmetatable(penis, {
__call = function(body)