Skip to content

Instantly share code, notes, and snippets.

View abeaumont's full-sized avatar

Alfredo Beaumont abeaumont

View GitHub Profile
@abeaumont
abeaumont / hitcon-polyglot
Created August 18, 2014 12:50
Hitcon CTF 2014 polyglot (C, Python 2, Python 3, Ruby, Haskell)
a={-1//1,""""/=>3}
#if 0
BEGIN { puts `cat flag`; exit; }
__END__
"""} # "
import os; os.system('cat flag')
""" # "
#endif
};
main () { system("cat flag"); } /* -} 0
@abeaumont
abeaumont / dispatch-benchmarks.dylan
Created March 28, 2013 08:28
dispatching benchmark in Dylan
module: dispatch-benchmarks
define open abstract class <my-collection> (<object>)
end class <my-collection>;
define open generic my-element (collection :: <my-collection>, n :: <integer>) => (nth :: <object>);
define method my-element
(collection :: <my-collection>, n :: <integer>)
=> (nth :: <object>)
@abeaumont
abeaumont / results.org
Last active December 15, 2015 08:09
shootout benchmark result comparison for dylan
benchmarkbest* resultdylantimes
n-body16.165162.35110.043365
fannkuch-redux32.0811301.82540.579315
fasta3.56474.40120.875701
spectral-norm6.010156.59426.055574
mandelbrot (N=1600)0.2733.47712.736264
k-nucleotide (N=2.5M)3.231159.23949.284742
binary-trees8.505184.70721.717460
@abeaumont
abeaumont / byte-vector-test.dylan
Created March 22, 2013 15:22
OpenDylan's <byte-vector> bug
module: byte-vector-test
define library byte-vector-test
use common-dylan;
use io;
end library;
define module byte-vector-test
use common-dylan, exclude: { format-to-string };
use byte-vector;
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int _golomb(vector<int>& golomb_values, int n);
int golomb(vector<int>& golomb_values, int n) {
if (golomb_values.size() < n) {
@abeaumont
abeaumont / self-describing-sequence.dylan
Last active December 12, 2015 06:38
Golomb sequence
module: self-describing-sequence
define constant <integer-vector> = limited(<simple-vector>, of: <integer>);
define function golomb
(golomb-sequence :: <integer-vector>, n :: <integer>)
=> (fn :: <integer>)
without-bounds-checks
when(golomb-sequence[n - 1] = 0)
golomb-sequence[n - 1] := %golomb(golomb-sequence, n);
@abeaumont
abeaumont / split-test.dylan
Created February 6, 2012 21:05
split bug
module: split-test
define function main(name, arguments)
format-out("%d %d\n",
size(split("a b c ", " ", remove-if-empty: #f)),
size(split("a b c ", " ", remove-if-empty: #t)));
exit-application(0);
end function main;
main(application-name(), application-arguments());
@abeaumont
abeaumont / project_manager.rst
Created December 18, 2011 11:32 — forked from waywardmonkeys/project_manager.rst
Rethinking the OD project manager

Rethinking the Project Manager

Problem

The current project manager as a variety of problems that we would like to solve. These include:

  • It combines install with build. Everything is built and installed
module: majority
define function winner (votes :: <collection>)
let winner
= reduce1(method (a, b) if (a.last > b.last) a else b end end,
map(method (candidate)
pair(candidate, size(choose(curry(\=, candidate), votes)));
end,
remove-duplicates(votes)));
unless (zero?(round/(winner.tail, votes.size)))
: toandfro ( sequence n -- string )
group [ odd? [ reverse ] when ] map-index
flip concat >string ;