Skip to content

Instantly share code, notes, and snippets.

View mwhittaker's full-sized avatar

Michael Whittaker mwhittaker

View GitHub Profile
@mwhittaker
mwhittaker / gitdown
Created March 21, 2014 06:18
gitdown
#! /bin/sh
usage() {
echo "usage:"
echo " gitdown <markdown file>"
}
if test $# -lt 1; then
usage;
exit;
@mwhittaker
mwhittaker / bind.cpp
Created March 28, 2014 01:48
Simple C++ Bind
#include <iostream>
#include <vector>
template<typename F>
int operator>>=(int i, F f) {
if (i == 0) {
return i;
}
return f(i);
}
@mwhittaker
mwhittaker / bind.rs
Created June 8, 2014 02:11
Rust Option Bind
// Option bind for rust 0.10
fn inv(f: f32) -> Option<f32> {
if f == 0.0 {
None
}
else {
Some(1.0 / f)
}
}
@mwhittaker
mwhittaker / beamercolorthememongo.sty
Created July 29, 2014 23:47
MongoDB Beamer Color Theme
\DefineNamedColor{named}{mongobrown}{RGB}{61, 41, 30}
\DefineNamedColor{named}{mongogold} {RGB}{129, 102, 75}
\DefineNamedColor{named}{mongogreen}{RGB}{55, 140, 40}
\DefineNamedColor{named}{darkgray}{cmyk}{0,0,0,0.90}
\mode<presentation>
\setbeamercolor{alerted text}{fg=red}
\setbeamercolor*{palette primary}{bg=mongobrown,fg=white}
\setbeamercolor*{palette secondary}{fg=white,bg=mongogreen}
\setbeamercolor*{palette tertiary}{fg=white,bg=darkgray}
@mwhittaker
mwhittaker / Makefile
Created April 4, 2015 17:49
Async Unit Tests
default: all
all: compile test
compile:
cs3110 compile -t -p core -p async main.ml
cs3110 compile -t -p core -p async main_test.ml
test: compile
cs3110 test main_test.ml
@mwhittaker
mwhittaker / monad.rs
Created April 19, 2015 02:31
Rust Maybe Monad
use std::ops::Shr;
use Maybe::{Nothing, Just};
#[derive(Debug)]
enum Maybe<A> {
Nothing,
Just(A)
}
impl<A, B, F> Shr<F> for Maybe<A> where F: Fn(A) -> Maybe<B> {
@mwhittaker
mwhittaker / tree.rs
Created April 19, 2015 02:48
Rust Tree Fold
use Tree::{Leaf, Node};
enum Tree<A> {
Leaf,
Node(Box<Tree<A>>, A, Box<Tree<A>>)
}
fn tree_fold<A, B, F>(f: &F, a: B, t: &Tree<A>) -> B where F: Fn(B, &A, B) -> B, B: Clone {
match *t {
Leaf => a,
@mwhittaker
mwhittaker / README.md
Last active August 29, 2015 14:19
Amazon Web Services

Amazon Web Services

Common Commands

  • Dry run launching an EC2 instance.

      aws ec2 run-instances  --dry-run  --image-id ami-d05e75b8
    
  • Launch an EC2 instance with all the fixins.

aws ec2 run-instances \

@mwhittaker
mwhittaker / .gitignore
Last active August 29, 2015 14:22
C++ Playground
################################################################################
# vim
################################################################################
*.sw[op]
################################################################################
# C++
################################################################################
# Compiled Object files
*.slo
@mwhittaker
mwhittaker / .gitignore
Last active August 29, 2015 14:23
Graduate School
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~