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
Youpi |
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
import Network.Socket | |
import Control.Concurrent | |
import qualified System.IO as IO | |
type HandlerFunc = SockAddr -> String -> IO () | |
serveLog :: String -- ^ Port number or name; 514 is default | |
-> HandlerFunc -- ^ Function to handle incoming messages | |
-> IO () | |
serveLog port handlerfunc = withSocketsDo $ |
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
module Main where | |
import Control.Concurrent (forkIO) | |
import Control.Monad (forever, unless) | |
import Network (PortID(PortNumber),listenOn) | |
import Network.Socket hiding (listen,recv,send) | |
import Network.Socket.ByteString (recv,sendAll) | |
import qualified Data.ByteString as S | |
import System.Posix (Handler(Ignore),installHandler,sigPIPE) |
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
### usage : ruby(version) mem.rb STRING_SIZE [cow] | |
### 1 < string_size < 9 | |
### cow to activate copy on write (ree only) | |
def ram_usage | |
`pmap #{Process.pid} | tail -1`.split[1][0..-2].to_i | |
end |
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
group "processTags" $ match "published/*" $ compile $ readPageCompiler | |
create "tags" $ | |
( requireAll | |
( (inGroup $ Just "processTags") `mappend` "published/*" ) | |
(\_ ps -> readTags ps :: Tags String) ) | |
-- Add a tag list compiler for every tag | |
match "tags/*" $ route $ setExtension ".html" | |
metaCompile $ require_ "tags" |
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
---- group posts by years | |
groupByYear :: [Page a] -> [(String, [Page a])] | |
groupByYear = map (\pg -> ( year (head pg), pg) ) . | |
groupBy (\ a b -> year a == year b) | |
where year :: Page a -> String | |
year = take 4 . takeBaseName . getField "path" | |
addYearList :: String |
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
module Main where | |
import Data.Char (ord) | |
import Network.Socket hiding (recv) | |
import qualified Data.ByteString as S | |
import qualified Data.ByteString.Char8 as C8 | |
import qualified Data.ByteString.UTF8 as U8 | |
import Network.Socket.ByteString (recv, sendAll) |
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, TypeSynonymInstances, FlexibleInstances #-} | |
module Text.InterpolatedString.Interp (qc, q) where | |
import qualified Language.Haskell.TH as TH | |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Char8 as C8 | |
import Language.Haskell.TH.Quote | |
data StringPart = Literal String | Binding String deriving Show |
OlderNewer