Skip to content

Instantly share code, notes, and snippets.

@contificate
contificate / parallel.ml
Last active June 21, 2023 00:53
Stack-based implementation of compiling parallel moves
(**
Iterative version of algorithm presented in
the "Tilting at Windmills in Coq" paper;
https://xavierleroy.org/publi/parallel-move.pdf
The algorithm is effectively a post-order traversal of the transfer relation,
accounting for cyclic dependencies along the way.
Suppose the transfer relation had no cycles, for example: X -> Y -> Z;
@contificate
contificate / Dominance.java
Created July 29, 2021 14:12
Cooper et al.'s "A Simple, Fast Dominance Algorithm" in Java
import java.util.HashMap;
import java.util.Map;
public class Dominance {
/**
* Compute immediate dominator tree.
* This algorithm is taken from Cooper et al.'s paper "A Simple, Fast Dominance Algorithm":
* https://www.cs.rice.edu/~keith/EMBED/dom.pdf
*
@contificate
contificate / sum.c
Created December 22, 2020 02:08
Computing sum using trampolines and dynamic calls in C
// recursive sum function encoded as a dynamically-calling trampoline of continuations returned as thunks
// don't compile with -pedantic, there's lots of bad casts going on in this code
// this program computes the sum of integers 1 to 50,000 (using a lot of heap memory to do so)
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <talloc.h>
#include <dyncall.h>
// global talloc allocation context

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@contificate
contificate / keybase.md
Created March 30, 2020 11:28
Verifying myself on keybase

Keybase proof

I hereby claim:

  • I am obscurecolin on github.
  • I am obscurecolin (https://keybase.io/obscurecolin) on keybase.
  • I have a public key ASBhAfmVCwLqcn9jgFno_77jePfjncfro7AfFQsk-_nxDQo

To claim this, I am signing this object:

@contificate
contificate / xbwatson.scm
Created August 23, 2019 04:56
XBDM Notification Socket
(use-modules (ice-9 rdelim) (ice-9 format))
(define ip "192.168.1.122")
(define port 730)
(let ((sock (socket AF_INET SOCK_STREAM 0)))
(connect sock AF_INET (inet-pton AF_INET ip) port)
(read-line sock) ; consume initial response
(display "NOTIFY reconnectport=13377 reverse\n" sock) ; there is no reconnect
(do ((line (read-line sock) (read-line sock)))