Skip to content

Instantly share code, notes, and snippets.

View ArnCarveris's full-sized avatar
🎯
R&D

Arn ArnCarveris

🎯
R&D
View GitHub Profile
@msymt
msymt / REAMDE.md
Created July 23, 2022 07:07
C# to C IPC with memory mapped file

MappedMemory: C# to C

  1. From console create file: dd if=/dev/zero of=/tmp/sharedfile bs=12288 count=1
  2. The C# program
  3. The C program

usage

mcs Sender.cs
@retrogradeorbit
retrogradeorbit / Makefile
Last active May 16, 2024 16:25
Hot loading C wasm into the browser while preserving the state of the heap
CLANG_DIR = $(HOME)/clang+llvm-13.0.1-x86_64-linux-gnu-ubuntu-18.04
CLANG = $(CLANG_DIR)/bin/clang
LLC = $(CLANG_DIR)/bin/llc
LD = $(CLANG_DIR)/bin/wasm-ld
C_SRC := $(wildcard src/c/*.c)
OBJ_SRC := $(patsubst %.c, %.o, $(C_SRC))
%.o: %.c # delete competing implicit rule
@herohiralal
herohiralal / Archetype.cs
Created February 15, 2022 04:03
HiraBots sample 1
using UnityEngine;
using UnityEngine.AI;
namespace AIEngineTest
{
public class Archetype : MonoBehaviour,
IHiraBotArchetype<NavMeshAgent>,
IHiraBotArchetype<Animator>,
IHiraBotArchetype<ConsolidatedSensor>,
IHiraBotArchetype<HiraLGOAPRealtimeBot>,
@instance-id
instance-id / CreateAddressableWithShortName.cs
Last active January 23, 2024 15:32
An example of creating an Addressable GameObject from a prefab with a simplified name
// ------------------------------------------------------------------------------------ AddressInfo
// --- AddressInfo --------------------------------------------------------------------------------
public static class AddressInfo
{
public static string prefabGroup = "Prefabs";
public static string prefabLabel = "Prefab";
}
// ------------------------------------------------------------------------------ AddressableHelper
// --- AddressableHelper --------------------------------------------------------------------------

I think using scopes greatly improves readability. Here's an example of converting a larger section of code. The indenting makes it immediately clear when a scopes begins and ends. Both snippets of code draw the exact same controls.

Before:

EditorGUILayout.BeginVertical("box");
disable = EditorGUILayout.Toggle("Disable Sliders", disable);
indent = EditorGUILayout.IntSlider("Indent Sliders", indent, 1, 4);
#include <cassert>
#include <iostream>
#include <functional>
#include <memory>
#include <type_traits>
#include <typeinfo>
#include <typeindex>
#include <utility>
#include <unordered_map>
@FreyaHolmer
FreyaHolmer / IMGUIDebugger.cs
Created May 2, 2019 04:38
Unity script to open the IMGUI debugger. Useful for editor UI debugging! Make sure you put it in an Editor/ folder in your project
using UnityEditor;
using System;
public static class IMGUIDebugger {
static Type type = Type.GetType( "UnityEditor.GUIViewDebuggerWindow,UnityEditor" );
[MenuItem( "Window/IMGUI Debugger" )]
public static void Open() => EditorWindow.GetWindow( type ).Show();
@pyaggi
pyaggi / entt_parallel.md
Last active May 16, 2019 17:38
Parallel processing with ENTT ECS

Parallel processing with ENTT

The idea es to evaluate if it is worth it to have parallel versions of some methods in order to speed up processing or obtain better readable code than trying to parallelize outside the library.

Tests

The first step in the analysis is to perform a basic benchmark test to see if some gain is achieved with rudimentary algorithms. For that matter a modified version of ENTT library is used, which posses parallel version of most of the methods. I modified ENTT library in a very straight forward and awful way, I just peek here and there an replaced the algorithms that GCC already implemented in parallel and renamed that method to same name with _par suffix. Then I replaced in other methods any calls I found to those 'double version methods' and I made those other also _par suffixed. Of course this is no way to parallelize code, thought must be put in order to decide where to parallelize, but it is a start. (btw: sorry to doing that to your code

@sphaero
sphaero / Nodes.cpp
Created December 12, 2018 15:07 — forked from ChemistAion/nodes.cpp
Second prototype of standalone node graph editor for ImGui
#include "Nodes.h"
namespace ImGui
{
template<int n>
struct BezierWeights
{
constexpr BezierWeights() : x_(), y_(), z_(), w_()
{
for (int i = 1; i <= n; ++i)
@spacechase0
spacechase0 / NodeGraph.cpp
Last active October 30, 2022 09:53
ImGui node graph
#include <any>
#include <cmath>
#include <imgui.h>
#include <imgui_internal.h>
#include "NodeGraph.hpp"
namespace
{