Skip to content

Instantly share code, notes, and snippets.

View fitzgen's full-sized avatar
🙃

Nick Fitzgerald fitzgen

🙃
View GitHub Profile
@fitzgen
fitzgen / markdown-footnotes.md
Last active December 1, 2021 20:04
Footnotes in Markdown

Did you know that you can create footnotes in markdown?1

You can also use words instead of numbers, which get converted into numbers for you so you don't have to renumber footnotes when moving blocks of text around!2

Source:

Footnotes

  1. I did not, and have been writing them by hand for years!!

  2. Like this :)

@fitzgen
fitzgen / cargo-build-hooks-for-wasm.md
Last active November 3, 2019 10:47
Rust and WebAssembly Working Group meeting notes from the 2019 Rust All Hands
Audience WG-wasm + cargo team (+ maybe WG-embedded?)
When TBD (45 minutes)
Where Snow
Meeting Style Discussion and brainstorming

Deliverables

  • Sketch of an eventual ideal we’d like to end up at
  • Sketch of a minimal RFC that is a first step towards that eventual ideal
use nannou::noise::{NoiseModule, Seedable};
use nannou::prelude::*;
const WIDTH: u32 = 400;
const NOISE_FACTOR: f32 = 0.75;
const SEGMENT_LENGTH: u32 = 20;
const LINE_MARGIN: u32 = 8;
const LINE_NOISE_RANGE: f32 = LINE_MARGIN as f32 / 3.0;
fn main() {
@fitzgen
fitzgen / who-calls.py
Last active January 10, 2018 20:40
List the callers of some function in the given `.wasm` file.
#!/usr/bin/env python3
import argparse
import re
import subprocess
DESC = """
List the callers of some function in the given `.wasm` file.

Keybase proof

I hereby claim:

  • I am fitzgen on github.
  • I am fitzgen (https://keybase.io/fitzgen) on keybase.
  • I have a public key ASBSc69NuFfQncKT0KhfIXas2FWlq3cAMKHkYHiHr9MkCQo

To claim this, I am signing this object:

@fitzgen
fitzgen / census.js
Created July 27, 2015 22:14
record allocations for 5s -> take a census
dbg = null;
Components.utils.forceGC();
Components.utils.import("resource://gre/modules/devtools/Loader.jsm");
Debugger = devtools.require("Debugger");
dbg = devtools.require("devtools/server/actors/utils/make-debugger")({
findDebuggees: dbg => dbg.findAllGlobals(),
shouldAddNewGlobalAsDebuggee: () => true
});
use std::{mem,ptr};
fn box_map_in_place<T, F>(boxed: Box<T>, f: F) -> Box<T> where F: FnOnce(T) -> T {
unsafe {
let p : *mut T = mem::transmute(boxed);
ptr::write(p, f(ptr::read(p)));
return mem::transmute(p);
}
}
#!/usr/sbin/dtrace -Fs
pid$target::main*heap*Rooted*:entry{ printf("{"); }
pid$target::main*heap*Rooted*:return{ printf("}"); }
pid$target::main*eval*:entry{ printf("{"); }
pid$target::main*eval*:return{ printf("}"); }
Cu.import("resource://gre/modules/Task.jsm")
let runTaskWhileValid = (isValid, generator) => {
Task.spawn(function* () {
const g = generator();
let value, resolved;
let done = false;
while (!done) {
try {
({ value, done }) = g.next(resolved);
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const ALLOCATIONS_TREE_INDENTATION = 16; // px
const AUTO_EXPAND_DEPTH = 3; // depth