Skip to content

Instantly share code, notes, and snippets.

@mattnewport
mattnewport / planetppm.hoon
Created August 29, 2019 03:54
Procedural Planet raytracer in Hoon
|= dim=@ud ^- (list @t)
=/ dx (div:rs .1 (sun:rs dim))
=/ white [.1 .1 .1]
=< (genppm dim)
|%
++ min
|= [x=@rs y=@rs] ^- @rs
?: (lth:rs x y) x y
++ max
|= [x=@rs y=@rs] ^- @rs
@chrishulbert
chrishulbert / ssdp.node.js
Created March 30, 2011 21:46
Service discovery using node.js and ssdp / universal plug n play
var dgram = require('dgram'); // dgram is UDP
// Listen for responses
function listen(port) {
var server = dgram.createSocket("udp4");
server.on("message", function (msg, rinfo) {
console.log("server got: " + msg + " from " + rinfo.address + ":" + rinfo.port);
});
#!/usr/bin/python
import fileinput
import re
import sys
from pprint import pprint
def parse(input):
"""Parse a log of gcc -H runs.
#!/bin/bash
# Given a grep expression, create a graph of occurrences of that expression
# in your code's history.
set -e
expr="$1"
datafile=$(mktemp)