Skip to content

Instantly share code, notes, and snippets.

@mgaut72
mgaut72 / report.sh
Created February 17, 2015 19:05
time report generation for hw1
TEST_CASE_DIR="/home/cs422/spring15/hw1"
TEST_CASES="bigger.txt mobydick.txt musketeers.txt raven.txt gettysburg.txt mohicans.txt"
NUM_PROCS="2 4 8 16"
PAR_EXECS="sortProcess sortThread"
(make all) > /dev/null
for t in $TEST_CASES
@mgaut72
mgaut72 / calc_score.py
Last active August 29, 2015 14:10
Script to calculate your pre-final score for compilers Fall 2014
#enter your scores in chronological order
my_scores = [30, 100, 100, 100, 100, 100, 70]
# shouldn't need to edit below here
maxes = [30, 100, 100, 100, 100, 100, 70]
weights = [2, 2, 12, 17, 7, 10, 20]
assert(len(my_scores) == len(maxes) and len(maxes) == len(weights))
@mgaut72
mgaut72 / keybase.md
Created May 15, 2014 05:21
keybase verification

Keybase proof

I hereby claim:

  • I am mgaut72 on github.
  • I am mgaut72 (https://keybase.io/mgaut72) on keybase.
  • I have a public key whose fingerprint is 7706 D4A2 81C7 FE31 BE36 35E7 F6D2 6654 DED8 AB8B

To claim this, I am signing this object:

@mgaut72
mgaut72 / LayBricks.hs
Last active August 29, 2015 14:01
Lay Bricks
import Data.List
type Brick = Int
type Row = [Brick]
type Wall = [Row]
layrow = layrowH []
layrowH :: Row -> [Brick] -> Int -> [Row]
layrowH layed _ 0 = [layed]
import Data.Char
import Control.Monad
import Text.ParserCombinators.Parsec
main :: IO ()
main = do
inp <- getContents
case parse hDoc "error" inp of
Left err -> print err
Right res -> putStr res
@mgaut72
mgaut72 / untar.py
Created February 22, 2014 23:15
Untar
#!/usr/bin/python
# use: ./smarttar <tarball>
import sys
import os
if len(sys.argv) != 2:
sys.exit("invalid number of arguments")
@mgaut72
mgaut72 / runBF_1_line_main.hs
Last active December 31, 2015 11:48
Brainfuck Interpreter
import System.Environment (getArgs)
import Control.Applicative
import Data.Word (Word8)
import Data.ByteString.Internal (c2w, w2c)
main :: IO ()
main = head <$> getArgs >>= readFile >>= run . start
type Zipper a = ([a], [a])
@mgaut72
mgaut72 / what_is_a_loop.c
Created April 5, 2013 03:00
So this is the 3rd ever program I wrote by myself, a homework from phys 105a we were supposed to grade a file containing all student responses, with a file which was the answer key, and output their score to a seperate file. I didn't quite have my head wrapped around a loop. I understood how to loop through an array, but couldn't get looping as …
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main() {
FILE *fp1, *fp2, *fp3;
char str1[80], str2[40], str3[40], str4[40];