view paste/paste.14186 @ 9001:00450dccde8f

<\oren\> ` xxd -r -p <<<"FF F8 F4 08 00 E5 16 7F FF 80 00 7F FF 03 C0 47 5A" >gunzip -
author HackBot
date Thu, 01 Sep 2016 15:38:36 +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 ++ ").*$"