Skip to content

Instantly share code, notes, and snippets.

View erdesigns-eu's full-sized avatar
$ root@erdesigns

ERDesigns - Ernst Reidinga erdesigns-eu

$ root@erdesigns
View GitHub Profile
@erdesigns-eu
erdesigns-eu / Gira55NintendoPlate.scad
Created October 5, 2025 13:51
Gira Plate Nintendo Connectors
/*
* One-Piece Gira System 55 Frame + Integrated Dual NES/SNES Classic Plate
* (Hollow Shell, Solid Outer Wall) + Configurable Labels + Front Bezel + Rear Collar
*
* - Solid, full-height outer perimeter wall (no inset at the edge)
* - Hollow interior with thin top skin (web) + localized ribs (plate ring, connector boss rings)
* - Rear connector collar (deep sleeve into the hollow back)
* - Front bezel recess around each connector (2D annulus, depth + optional chamfer via scale)
* - True through-cut connector holes with bottom INSET notch
* - Equal margins on the 55×55 plate area
@erdesigns-eu
erdesigns-eu / ThroughDeskNintendo.scad
Last active October 5, 2025 14:06
Through Desk Nintendo Connector SCAD
/*
* Integrated Round Through-Desk Dual NES/SNES Classic Panel (One-Piece)
* - Circular cover (flush with desktop) + cylindrical sleeve; printed as a single piece
* - Two NES/SNES Classic female cutouts in the cover (notch-safe)
* - Structural underside: connector lip (downward continuation of the female opening) + optional rings
* - Optional labels above each connector (emboss or inset)
* - No fasteners
*
* Author: ERDesigns — License: MIT
*/
@erdesigns-eu
erdesigns-eu / JSONStateMachineParser.ts
Created August 6, 2025 07:42
JSON State Machine Parser for parsing JSON responses from LLM's, this parser fixes common issues in JSON and validates/repairs against a JSON Schema
export interface JSONSchema {
/**
* The type of the JSON value
*/
type?: 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null';
/**
* Properties of the object, if type is 'object'
*/
properties?: Record<string, JSONSchema>;
/**
import fetch from 'node-fetch';
/**
* Youtube Resolver Parameters
* @interface YoutubeResolverParams
* @property {string} url - Youtube URL (https://www.youtube.com/watch?v=VIDEO_ID)
* @property {string} videoId - Youtube Video ID
*/
interface YoutubeResolverParams {
url?: string;
@erdesigns-eu
erdesigns-eu / DDPClient.ts
Last active January 3, 2025 09:06
DDP Client in Typescript
// DDPClient.ts
import { EventEmitter } from 'events';
/**
* Enum representing the different types of DDP messages.
* @property CONNECT - Client initiates a connection.
* @property CONNECTED - Server acknowledges a successful connection.
* @property FAILED - Server indicates a failed connection attempt.
* @property SUBSCRIBE - Client subscribes to a publication.
@erdesigns-eu
erdesigns-eu / ShellcodeCreator.pas
Last active December 19, 2024 11:59
Advanced Shell code generator in Delphi
unit ShellcodeCreator;
interface
uses
SysUtils, Windows, TypInfo, Classes, ZLib, System.Hash, System.Encryption;
/// <summary>
/// Shellcode creator for dynamically generating shellcode for function calls.
/// Supports x86, x64, and ARM architectures with parameter and return type handling.
@erdesigns-eu
erdesigns-eu / SysCallExecutor.pas
Created December 19, 2024 10:19
Cross-Platform System Call Executor (x86, x64, ARM) in Delphi
unit SysCallExecutor;
interface
uses
Windows, SysUtils;
type
TSysCallExecutor = class
private
@erdesigns-eu
erdesigns-eu / runtimeRequire.ts
Created December 17, 2024 13:43
Runtime require function to fix loading native .node modules when using PKG
/**
* This function is used to load the native .node module. Since webpack replaces the native require function,
* we need to get the original require function from the global scope.
*
* Found this code here: https://github.com/prebuild/node-gyp-build/blob/master/node-gyp-build.js
*/
// @ts-ignore
const runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
const nativeModule = runtimeRequire('./path/to/module.node');
@erdesigns-eu
erdesigns-eu / getImageType.ts
Created December 2, 2024 13:40
Get the image type from a buffer
/**
* Get the type of an image.
* @param image The image as a buffer.
* @returns The type of the image.
*/
export function getImageType(image: Buffer): Promise<{ mimeType: string, extension: string }> {
return new Promise((resolve, reject) => {
if (image[0] === 0xFF && image[1] === 0xD8 && image[2] === 0xFF) {
resolve({
mimeType: 'image/jpeg',
@erdesigns-eu
erdesigns-eu / useWebWorker.ts
Last active January 3, 2025 09:05
Custom React Hook to run a task in a WebWorker and get the result back in a Promise.
import { useState, useEffect, useCallback, useRef } from 'react';
/**
* WebWorker status flags
* - idle: The worker is not running any task
* - working: The worker is running a task
*/
type WebWorkerStatus = 'idle' | 'working';
/**