Skip to content

Instantly share code, notes, and snippets.

Avatar

Derek Chiang derekchiang

View GitHub Profile
@derekchiang
derekchiang / Quotes.md
Last active Sep 4, 2017
A collection of interesting and/or inspiring quotes.
View Quotes.md

"I would have written a shorter letter, but I did not have the time." -- Blaise Pascal


"Logging into Google+ feels like logging into a seminar, or stumbling into the wrong conference room at an airport Marriott. It looks like a cubicle farm and smells like a hospital. Posting anything on Google+ is like talking into a pillow." -- BuzzFeed


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
@derekchiang
derekchiang / simple-server.py
Created Aug 22, 2013
A script for serving static files from the current directory. Very handy.
View simple-server.py
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
from argparse import ArgumentParser
import socket
parser = ArgumentParser(
description='Serve static files in the current directory.')
@derekchiang
derekchiang / json_example.rs
Created Nov 22, 2013
It's amazing how hard it is to get code to compile in Rust. This is the result of an hour-long struggle. It demonstrates one usage of `extra::json`. Hope it helps someone.
View json_example.rs
// Compile with rustc 0.9-pre (727b70d 2013-11-17 21:11:24 -0800)
#[feature(managed_boxes)];
extern mod extra;
use extra::json;
use std::io::stdio;
use extra::serialize::Encodable;
@derekchiang
derekchiang / split_owned_vec.rs
Created Jan 5, 2014
A Rust function for splitting an owned vector into two owned vectors.
View split_owned_vec.rs
fn split_owned_vec<T>(mut v: ~[T], index: uint) -> (~[T], ~[T]) {
assert!(index <= v.len());
let new_len = v.len() - index;
let mut new_v = vec::with_capacity(v.len() - index);
unsafe {
ptr::copy_nonoverlapping_memory(new_v.as_mut_ptr(), v.as_ptr().offset(index as int), new_len);
v.set_len(index);
new_v.set_len(new_len);
}
@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 {