Skip to content

Instantly share code, notes, and snippets.

@peter1000
peter1000 / rbtree.jl
Last active August 29, 2015 14:21 — forked from SirVer/rbtree.jl
# load("examples/tree.jl")
typealias Color Int8
# TODO: RBTreeSet
const BLACK = convert(Color, 0)
const RED = convert(Color, 1)
const NOCOLOR = convert(Color, 2)
# TODO: Use Two Colors for nodes
abstract RBTreeNode{K,V}
@peter1000
peter1000 / jl_uv.c
Created April 1, 2015 18:31
Julia: :libuv readlink alternative implementation: following http://linux.die.net/man/2/readlink suggestion to use lstat for buf size
Alternative to: https://github.com/JuliaLang/julia/pull/10714
DLLEXPORT char *jl_fs_readlink(const char *path)
{
uv_fs_t req_stat;
uv_fs_t req_rl;
// get size info needed for the readlink buf: see http://linux.die.net/man/2/readlink
int ret_stat = uv_fs_lstat(jl_io_loop, &req_stat, path, NULL);
if (ret_stat != 0) {
jl_safe_printf("jl_fs_readlink():`stat` ERROR: %s %s\n",