annotate paste/paste.14186 @ 6894:1041408d241c

<oerjan> le/rn soviet union/In ancient history, the Soviet Union used to be the THEM. They believed in absurd principles like "Better Red than Dead". Then Ronald Reagan invented Star Wars to destroy it, after which there seemed to be no the THEM for a while.
author HackBot
date Tue, 16 Feb 2016 21:39:22 +0000
parents e037173e0012
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e037173e0012 Initial import.
HackBot
parents:
diff changeset
1 import System.Environment
e037173e0012 Initial import.
HackBot
parents:
diff changeset
2 import System.Process
e037173e0012 Initial import.
HackBot
parents:
diff changeset
3 import System.Exit
e037173e0012 Initial import.
HackBot
parents:
diff changeset
4 import Control.Monad
e037173e0012 Initial import.
HackBot
parents:
diff changeset
5 import Control.Applicative
e037173e0012 Initial import.
HackBot
parents:
diff changeset
6 import Data.List
e037173e0012 Initial import.
HackBot
parents:
diff changeset
7
e037173e0012 Initial import.
HackBot
parents:
diff changeset
8 main = do
e037173e0012 Initial import.
HackBot
parents:
diff changeset
9 r <- buildRegex . permuteArgs <$> getArgs
e037173e0012 Initial import.
HackBot
parents:
diff changeset
10 (_, _, _, h) <- createProcess (proc "/hackenv/bin/log" [r])
e037173e0012 Initial import.
HackBot
parents:
diff changeset
11 exitWith <$> waitForProcess h
e037173e0012 Initial import.
HackBot
parents:
diff changeset
12 where
e037173e0012 Initial import.
HackBot
parents:
diff changeset
13 permuteArgs = permutations . join . map words
e037173e0012 Initial import.
HackBot
parents:
diff changeset
14 buildRegex = oBrackets . intercalate ".*" . map (iBrackets . intercalate "|")
e037173e0012 Initial import.
HackBot
parents:
diff changeset
15 iBrackets s = "(?:" ++ s ++ ")"
e037173e0012 Initial import.
HackBot
parents:
diff changeset
16 oBrackets s = "^.*(?:" ++ s ++ ").*$"