Skip to content

Instantly share code, notes, and snippets.

@qpwo
qpwo / 1-import-ts-repl.sh
Last active February 26, 2022 03:34
use esbuild to get a node repl for a typescript file
function import-ts-repl() { (
set -e
file=$1
rm -f ${file}.js ${file}.js.map
esbuild ${file} --target=node14 --format=cjs --sourcemap --outfile=${file}.js --platform=node --bundle
node -r ${file}.js
rm -f ${file}.js ${file}.js.map
); }
# I happened to be looking at some of Cranelift's code, and I noticed that their constant-time dominates()
# check was using a somewhat more ad-hoc version of a hidden gem from the data structures literature called the
# parenthesis representation for trees. As far as I know, this was invented by Jacobson in his 1989 paper
# Space-Efficient Static Trees and Graphs. I first learned about it from the slightly later paper by Munro and Raman
# called Succinct Representations of Balanced Parentheses and Static Trees. I figured I'd give it an extremely
# quick intro and then show how it leads to a (slightly better) version of Cranelift's algorithm.
#
# This parenthesis representation of trees is surprisingly versatile, but its most striking feature is that
# it lets us query the ancestor relationship between two nodes in a tree in constant time, with a few instructions.
# And the idea is extremely simple and intuitive if you just draw the right kind of picture.

Minimal Unreal New Project Setup

Skip the Launcher and create a new project directly

What is the minimal number of required files and folders needed to create an Unreal Engine Project? Surprisingly little -- one, one-line file to be specific -- and you can launch without needing to use the Launcher or have unreal prompt for a Template project.

Maybe the interesting thing here is that this is an option for some kind of automation. It's literally just create a one-line file, "open" it, and (maybe) select your chosen Unreal version.

Given the number of dev and test files I create, this is a nice direct way to get up and going.

@rtkclouds
rtkclouds / ccore_layer.py
Created November 7, 2023 03:58
ccore layer
class Rezero(layers.Layer):
def __init__(self):
super().__init__()
self.alpha1 = tf.Variable(0.0, trainable=True)
def call(self, inputs, training):
return self.alpha1*inputs
class CustomRezero(tf.keras.layers.Layer):
@secemp9
secemp9 / interaction_net.py
Created December 17, 2024 12:39
non-complete implementation of an interaction net
class Agent:
def __init__(self, name, ports=None):
self.name = name
self.ports = ports if ports else []
# Each element of ports is either None or a tuple (other_agent, other_port_index)
def __repr__(self):
return f"{self.name}"
def connect(a, pa, b, pb):
@StevenACoffman
StevenACoffman / push-to-someone-elses-pr.md
Created September 17, 2025 16:35 — forked from wtbarnes/push-to-someone-elses-pr.md
Brief instructions for how to modify and push to someone else's PR on github

How to Push to Someone Else's Pull Request

Let's say contributor has submitted a pull request to your (author) project (repo). They have made changes on their branch feature and have proposed to merge this into origin/master, where

origin -> https://github.com/author/repo.git

Now say you would like to make commits to their PR and push those changes. First, add their fork as a remote called