view paste/paste.14186 @ 2364:75c80c422f30

<Jafet> sed -i "2 s#.*#import random; w=[l.split() for l in open(\'/dev/stdin\').read().split(\'\\n\')]; r=[4,7,8,9,2,13,6]; print \'\\n\'.join((lambda s: \' \'.join(chr(3) + str(r[(i+s)%len(r)]) + l[i] for i in range(len(l)))(random.randrange(0, len(r))))#" $(which rainwords)
author HackBot
date Mon, 04 Mar 2013 10:31:19 +0000
parents e037173e0012
children
line wrap: on
line source

import System.Environment
import System.Process
import System.Exit
import Control.Monad
import Control.Applicative
import Data.List

main = do
    r <- buildRegex . permuteArgs <$> getArgs
    (_, _, _, h) <- createProcess (proc "/hackenv/bin/log" [r])
    exitWith <$> waitForProcess h
   where
     permuteArgs = permutations . join . map words
     buildRegex = oBrackets . intercalate ".*" . map (iBrackets . intercalate "|")
     iBrackets s = "(?:" ++ s ++ ")"
     oBrackets s = "^.*(?:" ++ s ++ ").*$"