Skip to content

Instantly share code, notes, and snippets.

View Jomy10's full-sized avatar

Jonas Everaert Jomy10

View GitHub Profile
@Jomy10
Jomy10 / build.sh
Last active January 8, 2024 15:30
Libcamera to framebuffer
clang++ main.cpp $(pkg-config libcamera --libs --cflags) -std=gnu++20
#include <stdio.h>
#include <stdlib.h>
typedef void*(*allocator_alloc_fn)(void* userData, size_t cap);
typedef void (*allocator_free_fn)(void* userData, void* ptr);
typedef void*(*allocator_realloc_fn)(void* userData, void* ptr, size_t cap);
typedef struct _allocator {
allocator_alloc_fn alloc;
allocator_free_fn free;
@Jomy10
Jomy10 / array.c
Created December 29, 2023 14:21
C Array
#include <stdio.h>
#include <stdlib.h>
#define Array(Type) struct array_##Type
#define DefineArray(Type) struct array_##Type { Type* elements; int len; int cap; }
#define array_get(array, index) (array).elements[index]
#define array_set(array, value, index) (array).elements[index] = value
#define create_Array(Type, cap) (struct array_##Type) { (Type*) malloc(cap * sizeof(Type)), 0, cap }
#define destroy_Array(array) free((array).elements)
#define array_append(array, value) (array).elements[(array).len++] = value
@Jomy10
Jomy10 / make.rb
Last active December 21, 2023 14:56
Beaver 3.0 example
require 'beaver'
project = Project.new("MyProject")
project.set_configs("Debug", "Release")
# Set configuration options for the C language
project.c_configs = {
"Debug" => C::Configuration.new(cflags: ["-DDEBUG"]),
"Release" => C::Configuration.new(cflags: ["-DRELEASE"])
}
project.default_config = "Debug"
@Jomy10
Jomy10 / main.rs
Last active December 18, 2023 16:24
Some WGPU code, very cool
use winit::{
window::Window,
event::{Event, WindowEvent, self},
event_loop,
};
use wgpu::util::DeviceExt;
use anyhow::Result;
#[repr(C)]
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
@Jomy10
Jomy10 / tagged_union.h
Last active April 24, 2024 17:53
C Tagged Union Macro
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Author: Jonas Everaert
//
// You can change these however you like
#define _TU_TYPE_PREFIX(Type) T_##Type
@Jomy10
Jomy10 / RWLock.swift
Last active May 29, 2023 15:46
A read-write lock implementation for Swift
//
// RWLock.swift
//
// MIT License
//
// Copyright (c) 2023 Jonas Everaert
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@Jomy10
Jomy10 / DMSToDegree.vb
Created December 17, 2022 16:57
VBA Script to convert a coordinate to longitude and latitude in Excel (DMS to degrees)
'Parse a coordinate to an array of numbers containing hours, minutes, seconds (still represented as strings)
Private Function ParseCoOne(Co As String) As String()
Dim parsed(3) As String
Dim tmp() As String
tmp = Split(Co, "°")
parsed(0) = tmp(0)
tmp = Split(tmp(1), "'")
parsed(1) = tmp(0)
@Jomy10
Jomy10 / Create_RPG_Maker_MV_Plugins.md
Created May 9, 2022 15:47
Create RPG Maker MV Plugins

Creating RPG Maker MV Plugins

(incomplete tutorial)

Your first plugin

/*:
* @author Me
* @plugindesc This plugin outputs hello world
*
@Jomy10
Jomy10 / 0 - README.md
Last active May 2, 2022 17:20
Move any event to a player in RPG Maker

Player follower

This plugin for RPG Maker MV (should work for MZ as well) moves any event marked with to the player.

Installation

Copy playerFollower.js to project folder > js > plugins and then select the plugin in the plugin menu.

Usage