Skip to content

Instantly share code, notes, and snippets.

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

Kielan Kielan

💻
Java Rust Go Swift C# Typescript React Graphql C C++ Python
View GitHub Profile
@Kielan
Kielan / Effects-Handlers-In-C.md
Last active July 15, 2025 13:48
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 [email protected]

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 [email protected])

@Kielan
Kielan / Managing_inotify_instances.md
Last active June 5, 2022 23:15
FIx "ENOSPC: System Limit for Number of File Watchers Reached"

Check what is the max no of user_watches being set currently

$ cat /proc/sys/fs/inotify/max_user_watches

Check what is the max no. of inotify instances which correspond to the no. of allowed Watch Services instances.

$ cat /proc/sys/fs/inotify/max_user_instances
@Kielan
Kielan / Popover.tsx
Created May 18, 2022 03:32
Overly elaborate typescript popover implementation. Refactoring.
import * as React from 'react';
enum ActionTypes {
TogglePopover,
ClosePopover,
SetButton,
SetButtonId,
SetPanel,
SetPanelId,
@Kielan
Kielan / README.md
Created May 17, 2022 20:13
typescript no hoisting example: Explained

class Bar { name: string; constructor(name: string) { this.name = name; } } class Foo extends Bar{ constructor(name: string) { super(name); } getName() {

@Kielan
Kielan / dashboard.tsx
Last active May 17, 2022 17:47
Vercel Dashboard React tailwindcss
import * as React from 'react';
import Head from 'next/head';
import Layout from '../components/Layout';
import ProjectCard from '../components/ProjectCard';
/*
inline style jsx not globals.css is where css vars
and root css styles are being read
submenu border is not found
has --accents-2: #333;
backup color #fff
@Kielan
Kielan / Compiler Notes
Last active May 2, 2022 04:02
compiler prettier and
https://drafts.csswg.org/css-syntax-3/#input-byte-stream
CSS parsing
The process consists of
bytes->stream codepoints->stream tokens->parse css syntax output
The output is a CSSStyleSheet object.
1. User agent recieves a stream of bytes
(typically coming over the network or
from the local file system).
@Kielan
Kielan / TopMenuModule.js
Created March 25, 2022 22:52
Example of Model View Control Module Atom in Lospec. I refactored this module out of LoSpec. The module initializes a model in javascript, which already exists as a handlebars template, and creates controls for 1 of 3 menus in the software. The code is neat, but not all of the template menu interactable handles are controlled in 1 place. Instead…
const TopMenuModule = (() => {
const mainMenuItems = document.getElementById('main-menu').children;
let infoList = document.getElementById('editor-info');
let infoElements = {};
initMenu();
function initMenu() {
// for each button in main menu (starting at 1 to avoid logo), ending at length-1 to avoid
@Kielan
Kielan / Gradient Tweet Grafana Template
Last active February 22, 2022 19:55
Svelte.js tweets canvas gradient from Grafana
<script context="module">
export let name;
</script>
<div class="bg-gradient-tweets">
<div class="wrapper py-2 text-center">
<h2 class="pt-1 text-black">Real users getting real value</h2>
<div>
<div class="d-flex justify-content-center">
<div class="slider w-100 maxw-800" x-data="app_slider(6)">
@Kielan
Kielan / ts-jest.md
Last active August 22, 2022 16:19 — forked from jackawatts/ts-jest.md
Getting started with Typescript, React and Jest

Getting Started

  1. Install:
  • jest: npm install --save-dev jest
  • ts-jest: npm install --save-dev ts-jest @types/jest
  1. Modify package.json
"jest": {
  "transform": {
 "^.+\\.tsx?$": "ts-jest"