Skip to content

Instantly share code, notes, and snippets.

View Greyvy's full-sized avatar
🤡
Living large

Grey Vaisius Greyvy

🤡
Living large
View GitHub Profile
@ongamex
ongamex / file2array.py
Created April 29, 2022 22:15
Converts a binary file to char[] in C++
import sys
import argparse
def bytesToCHeader(fileBytes: bytes, inputFileName: str, variableName: str) -> str:
fileText = "#pragma once\n";
fileText += "\n";
fileText += "//----------------------------------------------\n";
fileText += "// This is an auto-generated file.\n";
fileText += "// It contains the binary representation of " + inputFileName + " as a C-Array.\n";
fileText += "//----------------------------------------------\n";
--[[
The idea of this tweetcart was to get the "water ripple" effect with a grid of points.
Each point is applied a sinusoidal effect,
depending on its distance from the center, and the elapsed time.
The points go up then down following that sinusoidal,
and a color gradient is applied to get a nice pseudo-3d effect.
You can copy-paste this whole code inside PICO-8 and just run it.
/*
This is a very simple and not very robust parser for nested lists.
It doesn't copy the source input, but builds a structured representation of the
input with pointers to values. This could be useful in memory-constrained environments.
The syntax is:
(value1 (value2 value3) value4)
@simonrenger
simonrenger / memoy_managment_cpp_resource_list.md
Last active April 23, 2024 21:30
C++ Memory Management Resource List
@cmod
cmod / hugofastsearch.md
Last active May 1, 2024 05:20 — forked from eddiewebb/readme.md
Fast, instant client side search for Hugo static site generator

Super fast, keyboard-optimized, client side Hugo search

This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.

It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.

To see it in action, go to craigmod.com and press CMD-/ and start typing.

Fast Search

@rmitton
rmitton / function.cpp
Last active February 29, 2020 19:22
Tiny std::function implementation
/* EDIT:
* For future reference, this code doesn't work right so don't use it.
* (but probably could be fixed with some care and attention)
*/
// Tiny std::function workalike, to allow storing lambdas with captures. (public domain)
template <typename> struct fnptr;
template <typename Ret, typename... Args> struct fnptr<Ret(Args...)> {
void *obj = nullptr;
Ret (*wrap)(void*, Args...) = nullptr;
@dakom
dakom / ECS notes.md
Last active April 28, 2024 04:50
ECS with sparse array notes (EnTT style)

Intro

The below is a breakdown / bird's eye view of how a sparse-array backed ECS like EnTT or Shipyard works.

Please see the thanks and references at the bottom - without their help I would not have been able to share this breakdown with you... everything here is really just notes and rephrasing of what they've written already :)

Also, these notes do not cover archetype systems (like unity) nor adaptations of archetypes (like in Flecs). Though there's a couple comparative footnotes at the end.

Here we go!

@JCash
JCash / vscode.sh
Created July 29, 2019 08:44
Create a Visual Studio Code "project" on the fly, given an executable, then launching the project
#! /usr/bin/env bash
# DISCLAIMER:
# This code IS WITHOUT ANY WARRANTY!
# Use at own risk
FOLDER='.vscode'
LAUNCH_FILE='launch.json'
MAGIC_FILE='vscode_script'
@increpare
increpare / Input.hx
Last active October 21, 2020 01:44
dumb joypad\controller support for haxegon
package haxegon;
import lime.ui.GamepadButton;
import starling.events.*;
import openfl.ui.Keyboard;
import openfl.events.FocusEvent;
import lime.ui.Gamepad;
import lime.ui.GamepadButton;
/* clang-format off */
/*
ijss : IncredibleJunior SparseSet
sparse set [1] for bookkeeping of dense<->sparse index mapping or
a building block for a simple LIFO index/handle allocator
[1] https://research.swtch.com/sparse
*/