Skip to content

Instantly share code, notes, and snippets.

@maxdeliso
maxdeliso / SimpleGraph.cpp
Created November 1, 2015 04:51
SimpleGraph
/*
* A DFS/BFS implementation for simple unweighted connected graphs.
* Max DeLiso <[email protected]>
* 10/31/15
*/
#include <iostream>
#include <cassert>
#include <stack>
@maxdeliso
maxdeliso / makefile
Last active August 29, 2015 14:25
uch - messaging program written in assembly
CC=gcc
LD=ld
CFLAGS=-Wall -Wextra -pedantic -std=c11 -g
LDFLAGS=-entry run
uch: uch.o
$(LD) $(LDFLAGS) $< -o $@
uch.o: uch.c
@maxdeliso
maxdeliso / makefile
Last active May 6, 2018 21:23
bst implementation with AVL balancing
.PHONY: clean
RM=rm
CC=clang
CFLAGS=-Wall
OUT=tree_test
MODULES=tree tree_test
OBJ=$(addsuffix .o, $(MODULES))
@maxdeliso
maxdeliso / Bits.scala
Last active August 29, 2015 14:20
reads strings from stdin, converts them to bytes, converts that to bits, converts that to ascii, and prints out the result.
import scala.io.StdIn
object Bits{
def main(args: Array[String]): Unit = {
while(true) {
println(
prettyBits(
Option[String](StdIn.readLine) match {
case Some(str) => for {
by <- str.map(_.toByte)
@maxdeliso
maxdeliso / Main.hs
Last active August 29, 2015 14:13
Sierpinski.hs
module Main where
import System.Environment
import System.Exit
import Sierpinski
main = do args <- getArgs
if length args /= 2 then
error "two integer args required: width and iteration count"
else
@maxdeliso
maxdeliso / keybase.md
Created November 30, 2014 23:44
keybase.md

Keybase proof

I hereby claim:

  • I am maxdeliso on github.
  • I am maxdeliso (https://keybase.io/maxdeliso) on keybase.
  • I have a public key whose fingerprint is 9902 15ED E2C3 E1B6 22FA 9D85 F8C0 C98A 48FD 423A

To claim this, I am signing this object:

@maxdeliso
maxdeliso / perms.c
Last active August 29, 2015 14:10
constant space string permutation
/*
* perms.c
*
* [email protected]
*
* read strings from stdin and print the permutations in lex order.
*
* permutations are computed using constant space.
*
* algorithm transliterated to C from TAOCP, Vol 4A, Part 1
@maxdeliso
maxdeliso / astack.hs
Last active January 23, 2016 11:00
simple haskell stack implementation, work in progress
module AStack(Stack, push, pop, top, size, stackTo) where
data Stack a = Empty
| MkStack a (Stack a)
push :: a -> Stack a -> Stack a
push x s = MkStack x s
size :: Stack a -> Int
size s = length (stkToLst s) where
stkToLst Empty = []

Keybase proof

I hereby claim:

  • I am maxdeliso on github.
  • I am maxdeliso (https://keybase.io/maxdeliso) on keybase.
  • I have a public key whose fingerprint is 5416 C7C7 B984 60A7 AF60 45F4 D607 7D70 940 5 FC77

To claim this, I am signing this object:

@maxdeliso
maxdeliso / makefile
Last active August 29, 2015 13:57
recursive functional style opt-parsing in C
CC=clang
CFLAGS=-Weverything -D_XOPEN_SOURCE -std=c99 -g -O2
OUT=sread
.PHONY: clean
$(OUT): $(OUT).c
$(CC) $(CFLAGS) $< -o $@