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
{"S":"a string"} | |
{"N":"123456"} | |
{"SS":["a string","another string"]} | |
{"NS":["123","456"]} |
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.Monad.Random | |
import Data.Char | |
rnd :: (RandomGen g) => Rand g Int | |
rnd = getRandomR (65,90) | |
main = do | |
values <- evalRandIO (sequence (replicate 10 rnd)) |
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 PackageImports #-} | |
module Main where | |
import qualified Data.Char as C | |
import qualified Data.Word as W | |
-- must qualify this (requiring the ghc pragma above) to disambiguate | |
-- from the Data.UUID also in system-uuid | |
import qualified "uuid" Data.UUID as U | |
import qualified Data.UUID.V5 as U5 |
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.Monad | |
import Control.Monad.STM | |
import Control.Concurrent | |
import Control.Concurrent.STM | |
oneSecond = 1000000 | |
writerThread :: TChan Int -> IO () |
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 ScopedTypeVariables #-} | |
module Main where | |
import qualified Control.Monad as C | |
import qualified Data.Char as CH | |
import qualified Data.Maybe as M | |
import qualified Data.List as L | |
import qualified Network.Memcache as MC | |
import qualified Network.Memcache.Protocol as MCP | |
import qualified Network.Memcache.Key as MCK |
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
#lang racket | |
(require racket/file) | |
(require (planet "memcached.rkt" ("jaymccarthy" "memcached.plt" 1 0))) | |
(define loaddict | |
(lambda (fn) | |
(let ([mc (memcached "localhost" 11212)]) | |
(for-each (lambda (l) | |
(if (> (bytes-length l) 0) | |
(memcached-set! mc l #"1") |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"bufio" | |
memcache "github.com/bradfitz/gomemcache" | |
) | |
func main() { |
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
#lang racket | |
(require racket/file) | |
(require (planet "memcached.rkt" ("jaymccarthy" "memcached.plt" 1 0))) | |
(define loaddict | |
(lambda (fn) | |
(let ([mc (memcached "localhost" 11212)] | |
[lines (file->bytes-lines fn)]) | |
(for-each (lambda (l) | |
(if (> (bytes-length l) 0) |
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 qualified Control.Monad as C | |
import qualified Network.Memcache as MC | |
import qualified Network.Memcache.Protocol as S | |
main = do | |
conn <- S.connect "127.0.0.1" 11212 | |
words <- (C.liftM lines . readFile) "/etc/dictionaries-common/words" | |
sets <- C.mapM_ (\w -> MC.set conn w (1::Int)) words | |
S.disconnect conn |
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 qualified Data.List as L | |
import qualified Control.Monad as C | |
import qualified Network.Memcache as MC | |
import qualified Network.Memcache.Protocol as S | |
import qualified Data.ByteString.Char8 as BC | |
setword conn word = do | |
let b_word = BC.unpack word | |
success <- MC.set conn b_word (1 :: Int) |