Skip to content

Instantly share code, notes, and snippets.

🐫

Aaron Zeng bcc32

🐫
Block or report user

Report or block bcc32

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
@bcc32
bcc32 / not_quite_open_recursion.ml
Last active Jul 16, 2019
Openly recursive module shenanigans
View not_quite_open_recursion.ml
module Greeter = struct
type t = unit
let create () = ()
let addressee _t = "World"
let greet _t = "Hello, " ^ addressee _t
end
module Name_greeter = struct
type t = { name : string }
@bcc32
bcc32 / rename-to-mtime.pl
Created Jun 22, 2018
A simple perl script to rename files based on their modification times.
View rename-to-mtime.pl
use 5.016;
use warnings;
use autodie;
use File::Spec;
use File::stat;
use POSIX qw(strftime);
# rename_noclobber($old, $new);
#
@bcc32
bcc32 / bench_map_length.ml
Last active Sep 5, 2019
Benchmark of Map.length between OCaml stdlib and Jane Street Base/Core
View bench_map_length.ml
(* https://discuss.ocaml.org/t/efficiently-checking-if-map-set-is-singleton/1611/2 *)
open! Core
open Core_bench
let bench = Bench.Test.create_indexed ~args:[ 1; 10; 100; 1000; 10_000 ]
module type Map = sig
type 'data t
View gist:f906e88326955b52ff017e521f75f5dd
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFN98KEBCACmtmyQDSG2u5WoQ1Bxk/D4+S/SZ2oXpoT9uraT5whibBt0ecMA
mA+Z1gaIEV5cTcWvRlCmCLTDYXDuSB8Otnq1BDBBWDDzXCEYUCIbVqLUVgyotv8b
VuStaiNcmZL3aiE+anrThm6XVmtB2TBBieFHAbienR4+bsqLydB1OW/LJzbKNKID
BG4rVAlcHVJzfBm2bt5C6usC0FqhMEKIRoQOYwKe9qW/817PNwb4NVY8KyZA49Ku
R9Wc3emuvThu9NCMGJI8bSuZW11PtSyda4ex0hXyQaX69TgffG0avwTjz1esAQfS
rUEw54TbKmdaTbd/TbzEK5qi1F5oV8E94ls9ABEBAAG0JkFhcm9uIEwuIFplbmcg
PHplbmcuYWFyb24ubEBnbWFpbC5jb20+iQE8BBMBCAAmAhsDBwsJCAcDAgEGFQgC
CQoLBBYCAwECHgECF4AFAlifd3QCGQEACgkQtoMMVkrXRYR+awgAnBuepcYlTBT2
@bcc32
bcc32 / main.ml
Created Oct 7, 2017
OCaml 4.04.2 Compiler Bug
View main.ml
module type Int = sig
val one : int
val (+) : int -> int -> int
end
module Make (Int : Int) = struct
(* this assertion must fail in order to make the linker command fail *)
let () = assert false
(* this assertion doesn't matter *)
@bcc32
bcc32 / template.cc
Created Oct 3, 2017
Competition Programming starter template
View template.cc
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
View keybase.md

Keybase proof

I hereby claim:

  • I am bcc32 on github.
  • I am a2z (https://keybase.io/a2z) on keybase.
  • I have a public key ASA4OFR9t5JwEofDtkO4QsNCEGvpY-iF2JVUPuQaetCRwQo

To claim this, I am signing this object:

@bcc32
bcc32 / bf.rb
Created Jan 7, 2017
Brainfuck-C transpiler in Ruby
View bf.rb
#!/usr/bin/env ruby -w
program = ARGF.read.tr('^[],.<>+-', '')
c_program = []
label_counter = -1
labels = []
program.each_char do |c|
@bcc32
bcc32 / streams.scm
Created May 12, 2016
The classic Haskell example in Scheme
View streams.scm
(define-syntax stream-cons
(syntax-rules ()
((_ h t)
(cons h (delay t)))))
(define stream-car car)
(define (stream-cdr stream)
(force (cdr stream)))
(define stream-nil '())
You can’t perform that action at this time.