Skip to content

Instantly share code, notes, and snippets.

View derekchiang's full-sized avatar

Derek Chiang derekchiang

View GitHub Profile
derekchiang /
Created February 14, 2014 02:20
A benchmark of Rust libgreen.
extern mod extra;
extern mod sync;
use sync::mutex::{StaticMutex, MUTEX_INIT};
use std::os;
static mut LOCK: StaticMutex = MUTEX_INIT;
fn work() {
for _ in range(0, 10000000) {
unsafe {
derekchiang /
Created February 14, 2014 02:22
A benchmark of Rust libnative.
extern mod native;
extern mod extra;
extern mod sync;
use sync::mutex::{StaticMutex, MUTEX_INIT};
use std::os;
static mut LOCK: StaticMutex = MUTEX_INIT;
fn start(argc: int, argv: **u8) -> int {

I like Learn You a Haskell as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell: 80% completion here is fine if you feel your attention waning, the next thing will address hammering in things like functors and monads via typeclasses. this will hammer in the lessons in a very direct form by forcing you to confront the challenges and lessons learned by the creators and community of Haskell itself. Doing the exercises here is critical for being fluent.

Real World Haskell is available online. (Thanks bos!)

#include <stdio.h>
// A generator that generates 0..10 infinitely
int generator(void) {
static int i, state = 0;
switch (state) {
case 0: goto LABEL0;
case 1: goto LABEL1;
derekchiang /
Last active August 29, 2015 14:24
Mesos Simulator Usage


  1. Compile this Mesos fork like you normally would.

Notice that we are currently on the custom-exec branch.

  1. Set the environment variable MESOS_DEFAULT_EXECUTOR_PATH to $BUILD_DIR/src/mesos-simexecutor

BUILD_DIR is your build directory.

How Our CS Curriculum Is Becoming Easier, and Why This Probably Isn't a Good Idea

Let me start off by saying that I have the uttermost respect for all the faculty members of the fantastic Cornell Computer Science Department. I have been enjoying the education ever since I came here and I've become a much better budding software engineer / computer scientist than I was only half a year ago, thanks to all the amazing professors, TAs, and classmates from and with whom I have been learning.

However, I've noticed a trend that is making me quite uneasy. The CS curriculum, for some reason, is becoming easier. The hard courses are still pretty hard, but the easier courses, in particular CS1110 and CS2110, which traditionally together make up an introductory sequel which a student has to complete before he can affiliate with the computer science major, have been made easier.

As most CS majors probably know, CS1110 has undergone a major redesign over the last summer. Before the 2012-13 academic year, CS1110 w

derekchiang /
Created May 24, 2013 07:43
A standalone copy of jQuery's extend(), in CoffeeScript
# Adopted from:
# Translated using js2coffee
extend = ->
options = undefined
name = undefined
src = undefined
copy = undefined
copyIsArray = undefined
clone = undefined
derekchiang /
Last active December 17, 2015 16:49
A simple function for getting the extension of a filename.
getExtension = (filename) ->
i = filename.lastIndexOf '.'
return if i < 0 then '' else filename.substr (i+1)
derekchiang /
Created May 25, 2013 09:23
A little function that returns the basename of a filename.
baseName = (str) ->
base = new String(str).substring(str.lastIndexOf("/") + 1)
base = base.substring(0, base.lastIndexOf(".")) unless base.lastIndexOf(".") is -1
return base
derekchiang /
Created June 5, 2013 06:34
Install all dependencies needed for compiling Erlang R16B from source.
# for erlang
apt-get install fop
apt-get install libncurses5-dev
apt-get install openjdk-7-jdk
apt-get install unixodbc-dev
apt-get install g++
apt-get install make
apt-get install libssl-dev