Skip to content

Instantly share code, notes, and snippets.

View maierfelix's full-sized avatar

Felix Maier maierfelix

View GitHub Profile
@maierfelix
maierfelix / example.ts
Last active June 13, 2023 12:50
Simple IDB-based virtual file system for binary files. Fast and with support for sorting
const fs = await new VirtualFileSystem({name: "my-project"}).onCreate();
const worldCount = await fs.readCount("worlds");
console.log(`Saved worlds: '${worldCount}'`);
const insertId = await fs.insert("worlds", "hello", inputWorld);
console.log(`Inserted world at '${insertId}'`);
const outputWorld = await fs.readById("worlds", insertId);
console.log(`Output world '${insertId}':`, outputWorld);
import fs from "fs";
function findIncludedFile(filePath, includes) {
let matches = [];
for (let ii = 0; ii < includes.length; ++ii) {
let incl = includes[ii];
let stats = fs.lstatSync(incl);
if (!stats.isDirectory()) {
throw new SyntaxError(`Include path '${incl}' is not a directory`);
}
This file has been truncated, but you can view the full file.
/*
* MACHINE GENERATED, DO NOT EDIT
* GENERATED BY nvk v0.7.8
*/
"use strict";
const {platform} = process;
const nvk = require("./build/Release/addon-" + platform + ".node");
let ENABLE_SHARED_MEMORY_HINTS = !!process.env.npm_config_enable_shared_memory_hints;
@maierfelix
maierfelix / GLSLValidator.py
Created February 6, 2020 10:57
Sublime Text 3 GLSL Validator - Support for includes and Ray-Tracing Shaders (rgen, rchit, rahit. rmiss, rint and glsl)
import sublime
import sublime_plugin
import re
import subprocess
import os
class GLShaderError:
""" Represents an error """
region = None
// app info
let appInfo = new VkApplicationInfo();
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
appInfo.pApplicationName = "Hello!";
appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.pEngineName = "No Engine";
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.apiVersion = VK_API_VERSION_1_0;
// create info
@maierfelix
maierfelix / main.js
Last active January 25, 2023 18:43
Parsing Unity .asset - "_typelessdata" field
// input example: A simple Quad
// field `_typelessdata`
mesh = `000080bf000080bf0000000000000000000000000000803f00000000000000000000803f000080bf0000000000000000000000000000803f0000803f00000000000080bf0000803f0000000000000000000000000000803f000000000000803f0000803f0000803f0000000000000000000000000000803f0000803f0000803f`;
// field `m_IndexBuffer`
index = `0000010002000300`;
// normalize
mesh = normalizeString(mesh);
index = normalizeString(index);