Skip to content

Instantly share code, notes, and snippets.

View MyNameIsTrez's full-sized avatar
:shipit:

Sander Bos MyNameIsTrez

:shipit:
View GitHub Profile
# Reads foo.py, and prints the names of classes and methods inside of it.
import ast
def extract_structure(file_path):
with open(file_path, "r", encoding="utf-8") as f:
tree = ast.parse(f.read(), filename=file_path)
structure = []
class BreakException(Exception):
pass
class ContinueException(Exception):
pass
class ReturnException(Exception):
def __init__(self, value):
self.value = value
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Compile `print("hi")` to WASM at runtime</title>
<style>
body { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji"; margin: 2rem; }
.ok { color: #0a7f2e; }
.err { color: #a40000; }
@MyNameIsTrez
MyNameIsTrez / particle_pool_benchmark.c
Last active August 11, 2023 10:31
xform rm_if chk
// My addition is described here: https://twitter.com/welfje/status/1689701477051211776?s=20
// Source of most of this Gist: https://gist.github.com/phoboslab/a35de765a33fe5d37f7b13a31281329b
#include <stdio.h>
#include <stdlib.h>
// -----------------------------------------------------------------------------
// Cross platform high resolution timer
// From https://gist.github.com/ForeverZer0/0a4f80fc02b96e19380ebb7a3debbee5