This file contains hidden or 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
-- http://en.wikipedia.org/wiki/Rijndael_S-box | |
affineX' :: Word8 -> Word8 -> Word8 | |
affineX' c b = b &~ forM_ [0..7] twiddleBits | |
where | |
twiddleBits :: Int -> StateT Word8 Identity () | |
twiddleBits j = do | |
bitAt j .= f b 4 | |
bitAt j .^|.= f b 5 |
This file contains hidden or 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 GADTs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
module UniqHash (main, uniqHash) where | |
import System.Exit | |
import Data.Machine | |
import Control.Arrow | |
import Data.List (transpose) |
This file contains hidden or 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 GADTs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
module UniqHash (main, uniqHash) where | |
import Data.Machine | |
import Control.Monad (when) | |
import System.Directory (doesFileExist) | |
import Control.Category (Category) |
This file contains hidden or 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
-- NOTE: Now available as a package at https://github.com/sordina/ScriptMidi | |
import System.MIDI | |
import System.IO | |
import System.Process | |
import Control.Monad | |
import Control.Concurrent | |
import Safe |
This file contains hidden or 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 TemplateHaskell #-} | |
{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-type-defaults #-} | |
import Control.Lens | |
import Control.Monad.State | |
import Control.Arrow | |
import Data.Bits.Lens | |
import Data.Map | |
import Data.Word |
This file contains hidden or 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/bash | |
export CLASSPATH="$HOME/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar" | |
TTY=`tty` | |
if [[ -t 1 && "$TTY" =~ "/" ]] | |
then | |
echo "Running clojure with classpath $CLASSPATH" | |
echo "Connected to Terminal - Wrapping with RLWrap" |
This file contains hidden or 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/bash | |
PREFIX="/tmp/rally_scripts" | |
ITEM_JSON="$PREFIX/rally_$$.json" | |
CHILDREN_JSON="$PREFIX/rally_$$_children.json" | |
TASKS_JSON="$PREFIX/rally_$$_tasks.json" | |
AUTH="-u $USERNAME:$PASSWORD" | |
mkdir -p "$PREFIX" |
This file contains hidden or 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
(deftype PromiseWrapper [r fun prom] | |
clojure.lang.IDeref | |
(deref [this] | |
(dosync | |
(let [current @r] | |
(if current (:value current) | |
(let [result (fun @prom)] | |
(ref-set r {:value result}) | |
result)))))) |
This file contains hidden or 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/bash | |
if [[ ! "$1" || "$1" = "-h" || "$1" = "--help" ]] | |
then | |
echo "Usage: ci <directory>" | |
exit 1 | |
fi | |
mkdir -p "$1" | |
cd "$1" |
This file contains hidden or 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 QuasiQuotes #-} | |
import Text.InterpolatedString.Perl6 -- For tests | |
import System.Environment (getArgs) | |
import Data.List.Split (splitOn) | |
import Data.List (intercalate) | |
-- IO: | |
main :: IO () |