Skip to content

Instantly share code, notes, and snippets.

View seliopou's full-sized avatar
💭
I may be slow to respond.

Spiros Eliopoulos seliopou

💭
I may be slow to respond.
View GitHub Profile
@seliopou
seliopou / index.html
Created November 21, 2012 19:55
d3.js example | circle packing in a rectangle
<!DOCTYPE html>
<html>
<head>
<title>d3.js example | circle packing in a rectangle</title>
<script src="http://d3js.org/d3.v2.js"></script>
<style type="text/css">
</style>
</head>
<body>
<div id="canvas"></div>
#!/usr/bin/env bash
TMPFILE=$(mktemp)
trap "rm $TMPFILE" exit
set -x
set -e
error_and_exit() {
echo -e "$(basename $0): $1"
@seliopou
seliopou / dune
Last active November 17, 2020 02:41
(executable (name test_rng) (libraries async mirage-crypto-rng-async) (preprocess (pps ppx_jane)))
module String = StringLabels
type t = Bytes.t
external unsafe_get_64 : Bytes.t -> int -> int64 = "%caml_string_get64u"
external unsafe_set_64 : Bytes.t -> int -> int64 -> unit = "%caml_string_set64u"
let pp_hum fmt t =
Printf.fprintf fmt "x%.16Lx" (unsafe_get_64 t 0);
Printf.fprintf fmt "x%.16Lx" (unsafe_get_64 t 8);
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
@seliopou
seliopou / _oasis
Last active October 25, 2016 17:28
Oasis pack bug
OASISFormat: 0.4
Name: packbug
Plugins: META (0.4), DevFiles (0.4)
BuildTools: ocamlbuild
Authors: garbage
Version: garbage
License: PD
Synopsis: garbage
@seliopou
seliopou / json-results.txt
Last active July 21, 2016 14:08
angstrom.0.1.0 benchmarks
# twitter1.json
┌─────────────────────────┬──────────┬────────────┬──────────┬──────────┬─────────┬──────────┬───────────────┬──────────┬──────────┬─────────────────┬────────────┐
│ Name │ Time/Run │ mWd/Run │ mjWd/Run │ Prom/Run │ mGC R^2 │ mGC/Run │ 95ci │ mjGC R^2 │ mjGC/Run │ 95ci │ Percentage │
├─────────────────────────┼──────────┼────────────┼──────────┼──────────┼─────────┼──────────┼───────────────┼──────────┼──────────┼─────────────────┼────────────┤
│ twitter1: angstrom-json │ 16.12us │ 7_590.08w │ 10.25w │ 10.25w │ 1.00 │ 28.95e-3 │ -0.06% +0.06% │ 0.20 │ 0.09e-3 │ -21.97% +22.24% │ 75.47% │
│ twitter1: ezjsonm │ 21.35us │ 11_403.10w │ 17.20w │ 17.20w │ 1.00 │ 43.50e-3 │ -0.06% +0.06% │ 0.21 │ 0.13e-3 │ -20.83% +21.49% │ 100.00% │
│ twitter1: yojson │ 8.44us │ 652.00w │ │ │ 1.00 │ 2.49e-3 │ -0.37% +0.37% │ │ │ │ 39.52% │
└───────────────────────
@seliopou
seliopou / angstrom_perf.txt
Last active May 14, 2016 14:41
Angstrom benchmarks
$ ./pure_benchmark.native -q 30 +time # 4.02.3
Estimated testing time 1m (2 benchmarks x 30s). Change using -quota SECS.
┌──────┬──────────┬──────────┬───────────────┬─────────┬──────────┬──────────┬────────────┐
│ Name │ Time R^2 │ Time/Run │ 95ci │ mWd/Run │ mjWd/Run │ Prom/Run │ Percentage │
├──────┼──────────┼──────────┼───────────────┼─────────┼──────────┼──────────┼────────────┤
│ json │ 1.00 │ 21.16ms │ -0.59% +0.62% │ 18.67Mw │ 239.28kw │ 239.28kw │ 47.53% │
│ http │ 1.00 │ 44.52ms │ -0.28% +0.29% │ 32.01Mw │ 65.11kw │ 65.11kw │ 100.00% │
└──────┴──────────┴──────────┴───────────────┴─────────┴──────────┴──────────┴────────────┘
$ ./pure_benchmark.native -q 30 +time # 4.03.0+flambda
Estimated testing time 1m (2 benchmarks x 30s). Change using -quota SECS.
@seliopou
seliopou / Permutation.hs
Created July 17, 2013 16:10
Random Code, Permutations, and unsafePerformIO
module Permutation
( permute -- :: RandomGen g => [a] -> g -> ([a], g)
, permuteST -- :: RandomGen g => [a] -> g -> ST s ([a], g)
, permuteIO -- :: [a] -> IO [a]
, unsafePermute -- :: [a] -> [a]
) where
import Control.Monad ( foldM )
-- N.B. Unsafe operations have been deprecated in the original module and have
-- been moved to Control.Monad.ST.Unsafe.
@seliopou
seliopou / gist:5623971
Created May 21, 2013 23:02
how to do that thing
var g = svg.selectAll('g')
.data(/* the data */)
g.enter().append('circle')
g.selectAll('circle')
.attr('r', function(d) { /* radius */ })