Skip to content

Instantly share code, notes, and snippets.

View doublec's full-sized avatar

Chris doublec

  • Perth, Australia
View GitHub Profile
@doublec
doublec / gist:10395713
Created April 10, 2014 15:45
ATS version of dtls1_process_heartbeat
(* A view for an array that contains:
byte = hbtype
ushort = payload length
byte[n] = bytes of length 'payload length'
byte[16]= padding
*)
dataview record_data_v (addr, int) =
| {l:addr} {n:nat | n > 16 + 2 + 1} make_record_data_v (l, n) of (ptr l, size_t n)
extern prfun free_record_data_v {l:addr} {n:nat} (pf: record_data_v (l, n)): void
@doublec
doublec / keybase.md
Created May 9, 2014 02:01
keybase.md

Keybase proof

I hereby claim:

  • I am doublec on github.
  • I am doublec (https://keybase.io/doublec) on keybase.
  • I have a public key whose fingerprint is AA10 A0B5 334F A2E9 B21D 5131 736D 9F34 9753 DFAB

To claim this, I am signing this object:

@doublec
doublec / gist:e49bb07b5a3f63a8746e
Created May 28, 2014 10:24
Building AliceML on NixOS

Add the following to your ~/.nixpkgs/config.nix:

alicemlEnv = pkgs.myEnvFun {
  name = "alicemlEnv";
  buildInputs = [ stdenv gcc smlnj libtool gnumake381 autoconf automake111x
                  zlib file which zsh vimWrapper gmp m4 gnome.gtk
                  gnome.libgnomecanvas pango sqlite libxml2 pkgconfig ];
  extraCmds = ''
   LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${gcc.gcc}/lib64

for i in $nativeBuildInputs; do

(* Comparing to http://www.reddit.com/r/rust/comments/34rszb/pony_type_and_memory_safe_language/cqy2wo7 *)
#include "share/atspre_staload.hats"
extern castfn u64(n: uint): uint64
fun fib(n: uint64): uint64 =
if n < u64(2u) then n else fib(n - u64(1u)) + fib(n - u64(2u))
implement main0(argc, argv) = let
val () = assertloc(argc = 2)
@doublec
doublec / keybase.md
Created May 10, 2015 02:12
keybase.md

Keybase proof

I hereby claim:

  • I am doublec on github.
  • I am doublec (https://keybase.io/doublec) on keybase.
  • I have a public key whose fingerprint is AA10 A0B5 334F A2E9 B21D 5131 736D 9F34 9753 DFAB

To claim this, I am signing this object:

@doublec
doublec / config.nix
Created June 5, 2015 14:53
Building B2G with Nix package manager
{
allowUnfree = true;
packageOverrides = pkgs : with pkgs; rec {
# Tested with:
# $ nix-env -i b2g-env
# $ b2g-env
# $ git clone https://github.com/mozilla-b2g/B2G b2g
# $ cd b2g
# $ REPO_INIT_FLAGS="--depth=1" ./config.sh nexus-5
# $ ./build.sh
staload "libc/SATS/signal.sats"
staload "libc/SATS/stdio.sats"
staload "libc/SATS/unistd.sats"
staload "libc/sys/SATS/wait.sats"
staload "libc/sys/SATS/types.sats"
staload "libc/sys/SATS/socket.sats"
staload "libc/netinet/SATS/in.sats"
staload "libc/arpa/SATS/inet.sats"
staload "prelude/DATS/array0.dats"
staload "libc/SATS/random.sats"
staload "libc/SATS/unistd.sats"
staload "libats/SATS/parworkshop.sats"
staload "libats/DATS/parworkshop.dats"
staload "prelude/DATS/array.dats"
#define ITER 100000000
#define NCPU 2
fn random_double (buf: &drand48_data): double = let
staload "libc/SATS/random.sats"
staload "libc/SATS/unistd.sats"
staload "libats/SATS/parworkshop.sats"
staload "libats/DATS/parworkshop.dats"
staload "prelude/DATS/array.dats"
#define ITER 100000000
#define NCPU 2
fn random_double (buf: &drand48_data): double = let
@doublec
doublec / namecoin-hosts.c
Created May 12, 2011 05:27
namecoin-hosts
/*
Copyright (c) 2011, Chris Double
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: