Skip to content

Instantly share code, notes, and snippets.

💭
statusing

Nick Fitzgerald fitzgen

💭
statusing
Block or report user

Report or block fitzgen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fitzgen
fitzgen / cargo-build-hooks-for-wasm.md
Last active Feb 26, 2019
Rust and WebAssembly Working Group meeting notes from the 2019 Rust All Hands
View cargo-build-hooks-for-wasm.md
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
View main.rs
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 Jan 10, 2018
List the callers of some function in the given `.wasm` file.
View who-calls.py
#!/usr/bin/env python3
import argparse
import re
import subprocess
DESC = """
List the callers of some function in the given `.wasm` file.
View keybase.md

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 Jul 27, 2015
record allocations for 5s -> take a census
View census.js
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
});
View box_map_in_place.rs
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);
}
}
View log_rooting.d
#!/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("}"); }
View runTaskWhileValid.js
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);
View AllocationsTree.js
/* -*- 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
View gist:95f8b2ea672d773f3537
function* G() { yield this.x; }
G.prototype = { x: 5 };
console.log([...G()]);
You can’t perform that action at this time.