This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
#define PHI ((1 + sqrt (5)) / 2) | |
/** | |
* Get an integer above a given minimum value. | |
* | |
* @param The prompt to display | |
* @param The minimum value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stddef.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
/* ***** Caching stuff ***** */ | |
double *fibcache = NULL; | |
int fibcache_size = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include "fib.h" | |
/* ***** Caching stuff ***** */ | |
/** | |
* This function checks if f(n) is in the cache for a given n. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#define MAXSTR 50 | |
char pt[MAXSTR], ct[MAXSTR], dt[MAXSTR] ; | |
int trans(void){ /*Transposition Cypher | |
*Swaps adjacent pairs of letters | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Expression type | |
data Expression = Constant Float | |
| Variable String | |
| Partial String String | |
| BinOp String Expression Expression | |
| Func String Expression | |
deriving Show | |
-- -- Evaluation | |
eval e = simplify e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- -- Expression type | |
data Expression = Constant Float | |
| Variable String | |
| Partial String String | |
| BinOp String Expression Expression | |
| Func String Expression | |
| Exp Expression Float | |
deriving Show | |
-- -- Evaluation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BIN := xo | |
CC := gcc | |
CFLAGS := -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Winit-self -Wmissing-prototypes -Wstrict-prototypes -Wconversion -std=gnu99 -ggdb -pedantic | |
SOURCES := $(wildcard *.c) | |
.PHONY: all clean | |
all: $(BIN) | |
$(BIN): $(SOURCES:.c=.o) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This needs the Skein functions from the NIST distribution. You can | |
* get the zip file from http://www.schneier.com/skein.html ("Source | |
* code and test vectors for Skein and Threefish (12 MB)"), and then | |
* you need to stick the contents of NIST/CD/Reference_Implementation | |
* in the same directory as this file. | |
* | |
* Compile with clang -std=c99 *.c -lcurl -lpthread -O3 -o xkcd-skein | |
*/ | |
#include <time.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Puzzle Key Exchange Client. | |
Usage: | |
puzzle.py [--n=<n>] [--c=<c>] --host=<hostname> [--port=<port>] [-v] | |
puzzle.py -h | --help | |
Options: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} | |
module Indexable where | |
-- Our Indexables are all Traversables, and for the default implementation | |
-- of (!!!) we need fromJust. | |
import Data.Maybe (fromJust) | |
import Data.Traversable (Traversable(..)) |
OlderNewer