Skip to content

Instantly share code, notes, and snippets.

View alanktwong's full-sized avatar

Alan Wong alanktwong

View GitHub Profile
@alanktwong
alanktwong / unix-cheatsheet.md
Last active March 24, 2021 20:52
Unix cheatsheet

Unix Cheatsheet

Cloned from Valerie Henderson's course page

Help on any Unix command.

Command Description
man {command} Type man rm to read the manual for the rm command.
whatis {command} Give short description of command.
@alanktwong
alanktwong / scala-merge-sort
Created December 12, 2012 22:31
Merge sort in Scala using pattern matching
def mergeSort[T <: Ordered[T]](xs:List[T]): List[T] = {
def merge(xs:List[T], ys:List[T]): List[T] = {
(xs,ys) match {
case (Nil,_) => ys
case (_,Nil) => xs
case (x::xs1, y::ys1) => {
if (x < y) {
x::merge(xs1,ys)
} else {
y::merge(xs,ys1)