Skip to content

Instantly share code, notes, and snippets.

@nbrick
nbrick / NullspaceDecoding.hs
Created June 14, 2016 10:33
Colonel Mustard example solution
-- Convert image to an intensity matrix, find its null vector (kernel),
-- scale such that components are simple integers and try 1=A, 2=B, etc..
-- Output is ILIKETOTHINKOYSTERSTRANSCENDNATIONALBARRIERS.
-- This example solution has been tested with:
-- * GHC 7.10.3
-- * JuicyPixels 3.2.7.1
-- * HMatrix 0.17.0.2
import System.IO( openFile, IOMode( ReadMode ) )
@nbrick
nbrick / 99.hs
Created November 28, 2015 11:14
Ninety-Nine Haskell Problems: Solutions
last' :: [a] -> a
last' [x] = x
last' (_:xs) = last xs
butLast :: [a] -> a
butLast [x,_] = x
butLast (_:xs) = butLast xs
elementAt :: Int -> [a] -> a
elementAt 0 xs = head xs
@nbrick
nbrick / brute_force.cpp
Created June 20, 2015 16:19
Nullspace encoding example
#include <stdio.h>
#include <stdlib.h> // rand()
#include <string.h> // strlen()
const char* txt = "THESEMUSTBEUPPERCASELETTERS";
const int colors = 256;
int num (char letter) {
return (int)letter - 64;

Keybase proof

I hereby claim:

  • I am nbrick on github.
  • I am nbrick (https://keybase.io/nbrick) on keybase.
  • I have a public key whose fingerprint is AC97 BE94 FE3E 6F7B F1A6 78B9 C67F 4ACA 97EE 7705

To claim this, I am signing this object: