brew install gettext
git clone git://git.zx2c4.com/cgit
cd cgit
git submodule init
git submodule update
Then modify the definitions of CFLAGS and LDFLAGS in git/Makefile
:
import System.Environment | |
import System.Timeout (timeout) | |
import Control.Concurrent | |
import Control.Concurrent (forkIO, threadDelay, killThread) | |
import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar) | |
import System.Process | |
import System.IO | |
-- blocking IO |
-- Updated for GHC 7.10 | |
{--------------------------------------------------------------------- | |
A HASKELL LIBRARY OF MONADIC PARSER COMBINATORS | |
17th April 1997 | |
Graham Hutton Erik Meijer | |
University of Nottingham University of Utrecht |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
{-# LANGUAGE ViewPatterns #-} | |
import Control.Monad | |
import Data.Array.IO | |
import Data.List.Split (chunksOf) | |
type Point = (Int,Int,Int) | |
-- basic rotations |
# | |
# Simple BibTeX file parsing in python. | |
# | |
# See `bibtest1` for an example of usage. | |
# | |
# This is a good overview of how to correctly parse a bibtex file: | |
# | |
# http://maverick.inria.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html | |
import string |
Emulating an Enigma machine | |
=== | |
In this gist I'll go over the development of an Enigma machine encoder | |
in Haskell. | |
Here are some useful background info about how the Enigma machine works: | |
- Enigma Simulator: http://enigmaco.de/enigma/enigma.html | |
- "How Enigma Machines Work" http://enigma.louisedade.co.uk/howitworks.html |
brew install gettext
git clone git://git.zx2c4.com/cgit
cd cgit
git submodule init
git submodule update
Then modify the definitions of CFLAGS and LDFLAGS in git/Makefile
:
{ | |
module Nested where | |
import Control.Monad | |
} | |
%wrapper "monadUserState" | |
$whitespace = [\ \t\b] | |
$digit = 0-9 -- digits |
iniital board: | |
1 3 2 5 4 2 2 3 | |
1 12345678 .....6.. 12345678 12345678 ....5... 12345678 1....... 12345678 3 | |
4 12345678 .2...... 1....... 12345678 12345678 12345678 12345678 12345678 2 | |
3 .2...... 12345678 12345678 12345678 .....6.. 12345678 ..3..... 12345678 5 | |
3 12345678 12345678 12345678 12345678 12345678 .......8 12345678 12345678 2 | |
2 12345678 12345678 .....6.. 12345678 12345678 ..3..... ......7. 12345678 3 | |
2 12345678 12345678 ....5... 12345678 12345678 12345678 12345678 12345678 1 | |
4 12345678 12345678 12345678 12345678 12345678 12345678 12345678 ..3..... 3 | |
3 12345678 12345678 12345678 12345678 ..3..... 12345678 12345678 12345678 3 |
module Lib | |
where | |
import Graphics.Gnuplot.Simple | |
import qualified Graphics.Gnuplot.Terminal.SVG as SVG | |
foo = do | |
let zs = [ (x,x) | x <- [1..10] ] | |
plotList [Key Nothing | |
,YRange (0,maximum (map snd zs) + 1) |
{-# LANGUAGE FlexibleContexts #-} | |
module U32 where | |
import BF | |
import Control.Monad | |
data U32 = U32 (Pair,Pair,Pair,Pair) | |
deriving (Read, Show) |