Skip to content

Instantly share code, notes, and snippets.

Avatar

Derek Chiang derekchiang

View GitHub Profile
@derekchiang
derekchiang / green_bench.rs
Created Feb 14, 2014
A benchmark of Rust libgreen.
View green_bench.rs
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
derekchiang / native_bench.rs
Created Feb 14, 2014
A benchmark of Rust libnative.
View native_bench.rs
extern mod native;
extern mod extra;
extern mod sync;
use sync::mutex::{StaticMutex, MUTEX_INIT};
use std::os;
static mut LOCK: StaticMutex = MUTEX_INIT;
#[start]
fn start(argc: int, argv: **u8) -> int {
View gist:10350391

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:

http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way/ 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.

https://github.com/NICTA/course/ 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!)

View generator.c
#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;
}
View mesos-simulator-usage.md

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.

View How our CS curriculum is becoming easier, and why this probably isn't a good idea (Shortened).md

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
derekchiang / extend.coffee
Created May 24, 2013
A standalone copy of jQuery's extend(), in CoffeeScript
View extend.coffee
# Adopted from: https://github.com/dansdom/extend
# Translated using js2coffee
extend = ->
options = undefined
name = undefined
src = undefined
copy = undefined
copyIsArray = undefined
clone = undefined
@derekchiang
derekchiang / getExtension.coffee
Last active Dec 17, 2015
A simple function for getting the extension of a filename.
View getExtension.coffee
getExtension = (filename) ->
i = filename.lastIndexOf '.'
return if i < 0 then '' else filename.substr (i+1)
@derekchiang
derekchiang / basename.coffee
Created May 25, 2013
A little function that returns the basename of a filename.
View basename.coffee
baseName = (str) ->
base = new String(str).substring(str.lastIndexOf("/") + 1)
base = base.substring(0, base.lastIndexOf(".")) unless base.lastIndexOf(".") is -1
return base
@derekchiang
derekchiang / get-erlang-deps.sh
Created Jun 5, 2013
Install all dependencies needed for compiling Erlang R16B from source.
View get-erlang-deps.sh
# 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