Mercurial > repo
view paste/paste.14186 @ 1593:09fd7f98c5f8
<elliott> echo "#!/bin/sh" >bin/seen; echo \'cd /var/irclogs/_esoteric\' >>bin/seen; echo \'for file in $(ls -r | grep "....-..-..\\.txt"); do grep -P -i "^..:..:..: <$1>" $file; done | tail -n 1\' >>bin/seen; chmod +x bin/seen
author | HackBot |
---|---|
date | Tue, 22 Jan 2013 00:07:42 +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 ++ ").*$"