Skip to content

Instantly share code, notes, and snippets.

Ceri Storey cstorey

Block or report user

Report or block cstorey

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
View Akh Va'quot Shrine.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Metaphone Markov.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View coverage.rs
use std::ptr;
/*
Experiments in recovering coverage from the sanitizer runtime. Build with cargo, adding:
RUSTFLAGS="-C passes=sancov -C llvm-args=-sanitizer-coverage-level=3 -Z sanitizer=address -C opt-level=3 -C debug-assertions=on -C debuginfo=2"
*/
extern "C" {
pub fn __sanitizer_cov_init();
pub fn __sanitizer_cov_dump();
pub fn __sanitizer_dump_coverage(pcs: *const usize, len: usize);
pub fn __sanitizer_maybe_open_cov_file(name:
@cstorey
cstorey / triangle-query.dot
Last active Jan 7, 2017
Query plan for `Q(a, b, c) <- R(a, b), S(b, c), T(a, b)`
View triangle-query.dot
# From https://arxiv.org/abs/1210.0481
digraph G {
rankdir=LR;
subgraph cluster_relations {
R [group="R"];
S [group="S"];
T [group="T"];
label = "relations";
View rust-demangle.sed
s!\$C\$!,!g;
s!\$SP\$!@!g;
s!\$BP\$!*!g;
s!\$RF\$!\&!g;
s!\$LT\$!<!g;
s!\$GT\$!>!g;
s!\$LP\$!(!g;
s!\$RP\$!)!g;
s!\$u20\$! !g;
s!\$u27\$!'!g;
@cstorey
cstorey / hkt-ptr.rs
Created Aug 12, 2016
Enough higher-kinded-ness to (trivially) abstract over pointer types in rust.
View hkt-ptr.rs
use std::ops::Deref;
use std::rc::Rc;
use std::sync::Arc;
trait Ptr<T> {
type PT : Deref<Target=T>;
fn build(val:T) -> Self::PT;
}
#[derive(Debug)]
@cstorey
cstorey / lamport.dot
Last active Dec 13, 2016
Graphviz lamport diagrams (borrowed from palvaro's molly)
View lamport.dot
digraph spacetime {
rankdir=TD
splines=line
// outputorder=nodesfirst
subgraph cluster_proc_nodes {
label="";
proc_a [label="Process a",group="a"];
proc_b [label="Process b",group="b"];
}
@cstorey
cstorey / gitgviz.py
Created Nov 23, 2014
A trivial script to visualise a git history as a graphviz diagram.
View gitgviz.py
import os, sys
from pygit2 import Repository, GIT_SORT_TOPOLOGICAL, GIT_SORT_REVERSE
import pygit2
from graphviz import Digraph
repository_path = pygit2.discover_repository(os.getcwd())
repo = Repository(repository_path)
def nfmt(target):
return "N{0}".format(target.id)
@cstorey
cstorey / IMG.sh.txt
Last active Aug 29, 2015
Render an image in a 256 colour capable terminal.
View IMG.sh.txt
Adapted for 256 color terminals from the 24-bit colour version at https://git.gnome.org/browse/vte/tree/perf/img.sh?h=vte-0-36 .
Original script (and this adaptation) licensed under GPLv2.
Octocat image used under presumed license from https://octodex.github.com/faq.html
View Makefile
PATH := ./foo:$(PATH)
export PATH
foo:
mkdir -vp $@
foo/bar: foo
printf "#!/bin/echo Hello\n" > $@.tmp && chmod +x $@.tmp && mv -v $@.tmp $@
runit_okay: foo/bar
You can’t perform that action at this time.