Skip to content

Instantly share code, notes, and snippets.

View Kielan's full-sized avatar
💻
Java Swift C# Typescript React Graphql C C++ Python

Kielan Kielan

💻
Java Swift C# Typescript React Graphql C C++ Python
View GitHub Profile
@Kielan
Kielan / DataPack.h
Last active April 15, 2024 03:14
EventEmitter module cpp
#pragma once
namespace Event {
class DataPack
{
public:
void* data;
DataPack(void* d) {
this->data = d;
@Kielan
Kielan / Index.html
Last active November 8, 2023 00:44
Neural ntwork
<a href="#controls">Jump to controls</a>
<canvas id="graph" width="600" height="600"></canvas>
<div class="controls" id="controls">
<button onclick="initialise()">initialise</button>
<button onclick="train()">Train</button>
<button onclick="classifyPoints()">Classify Points</button>
<button onclick="visualizeNeuronsAndWeights()">Visualize Neurons and Weights</button>
</div>
<label>Training Data Size
<input id="trainingDataSize" value="5000">
@Kielan
Kielan / interface_templates.c
Last active April 15, 2024 03:00
Ui btn cxt
/* main/source/dune/editors/interface/interface_templates.cc */
#include <ctype.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "mem_guardedalloc.h"
#include "types_brush.h"
Assume Positive Intent. Always begin with a position of positivity, empathy, and grace.
Work Out Loud (WOL). Commit is still in the scrappy phase of a startup. We value all your thoughts, opinions, and feelings on all subject matter! Since we live in different locations and often have very different perspectives, we encourage you to work-out-loud and start conversations in Slack channels or message someone on the Support Team!
Practice Kindness. Although you likely have not met the person you are speaking to, remember that even though you are looking at a screen, you are really talking to a person. If the message that you are sending is something you wouldn't say to a person's face, then don't send that message.
Own It. If you say it or type it, own it. If it hurts the company or an individual, even unintentionally, we encourage you to look at things from other viewpoints and apologize without hesitation.
Be a Role Model of our Key Operating Principle.
Feedback is Key. Given we are a remote-first team with me
/*
Doubly linked list
Navigation possible in both directions
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
@Kielan
Kielan / is.ts
Last active November 22, 2022 05:02
JavaScript type checking from react-spring
interface Lookup<T = any> {
[key: string]: T
}
type IsType<U> = <T>(arg: T & any) => arg is Narrow<T, U>
type Narrow<T, U> = [T] extends [Any] ? U : [T] extends [U] ? Extract<T, U> : U
type PlainObject<T> = Exclude<T & Lookup, Function | readonly any[]>
const is = {
arr: Array.isArray as IsType<readonly any[]>,
/* dust/source/dust/windowmanager/intern/wm_cursors.c */
/**
* Custom Cursor Description
* =========================
*
* Each bit represents a pixel, so 1 byte = 8 pixels,
* the bytes go Left to Right. Top to bottom
* the bits in a byte go right to left
* (ie; 0x01, 0x80 represents a line of 16 pix with the first and last pix set.)
*
@Kielan
Kielan / GHOST-capi.c
Last active November 16, 2022 12:12
GHOST api for OpenGL to window manager api system. Currently in cpp prepping for migration
GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle,
GHOST_GLSettings glSettings)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
return (GHOST_ContextHandle)system->createOffscreenContext(glSettings);
}
@Kielan
Kielan / Effects-Handlers-In-C.md
Last active July 31, 2023 18:14
Algebraic Effects and Handlers in C

Implementing Algebraic Effects in C “Monads for Free in C”

Microsoft Research Technical Report MSR-TR-2017-23 Daan Leijen Microsoft Research Updated by Kielan Lemons daan@microsoft.com

Abstract. We describe a full implementation of algebraic effects and handlers as a library in standard and portable C99, where effect operations can be used just like regular C functions. We use formal operational semantics to guide the C implementation at every step where an evaluation context corresponds directly to a particular C execution context. Finally we show a novel extension to the formal semantics to describe optimized tail resumptions and prove that the extension is sound. This gives two orders of magnitude improvement to the performance of tail resumptive operations (up to about 150 million operations per second on a Core i7@2.6GHz)