Skip to content

Instantly share code, notes, and snippets.

View seanhess's full-sized avatar

Sean Hess seanhess

View GitHub Profile
@seanhess
seanhess / output.txt
Created October 19, 2011 20:52
httperf output
Maximum connect burst length: 1
Total: connections 2500 requests 1682 replies 1512 test-duration 17.787 s
Connection rate: 140.5 conn/s (7.1 ms/conn, <=784 concurrent connections)
Connection time [ms]: min 918.4 avg 2925.9 max 7786.2 median 2815.5 stddev 1428.4
Connection time [ms]: connect 1263.4
Connection length [replies/conn]: 1.000
Request rate: 94.6 req/s (10.6 ms/req)
Request size [B]: 69.0
Reply rate [replies/s]: min 34.4 avg 77.4 max 120.4 stddev 43.0 (3 samples)
Reply time [ms]: response 1645.7 transfer 0.0
@seanhess
seanhess / site.nu
Created October 26, 2011 10:53
site.nu
; it just ignores everything!
(nmap setKey:"<cmd-p>" toAction:"vi_undo:")
@seanhess
seanhess / error.txt
Created October 29, 2011 16:20
installing hack2-handler-snap-server
squid:web seanhess$ cabal update
Downloading the latest package list from hackage.haskell.org
squid:web seanhess$ cabal install hack2-handler-snap-server
Resolving dependencies...
Configuring hack2-handler-snap-server-2011.10.12...
Preprocessing library hack2-handler-snap-server-2011.10.12...
Building hack2-handler-snap-server-2011.10.12...
[1 of 1] Compiling Hack2.Handler.SnapServer ( src/Hack2/Handler/SnapServer.hs, dist/build/Hack2/Handler/SnapServer.o )
src/Hack2/Handler/SnapServer.hs:72:55:
@seanhess
seanhess / error.txt
Created November 2, 2011 23:01
BSON to JSON
Illegal instance declaration for `JSON [Field]'
(All instance types must be of the form (T a1 ... an)
where a1 ... an are *distinct type variables*,
and each type variable appears at most once in the instance head.
Use -XFlexibleInstances if you want to disable this.)
In the instance declaration for `JSON [Field]'
@seanhess
seanhess / bsonToJson.hs
Created November 2, 2011 23:14
BSON to JSON
{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
-- cabal install json
-- cabal install mongoDB
import Text.JSON
import Text.JSON.Generic
import Database.MongoDB
import Data.Bson
@seanhess
seanhess / aesonBson.hs
Created November 3, 2011 04:54
Convert Bson to Json
{-# LANGUAGE OverloadedStrings, ExtendedDefaultRules #-}
-- https://github.com/mailrank/aeson/blob/master/examples/Demo.hs
-- cabal install aeson
-- cabal install mongoDb
import Data.Aeson
import qualified Data.Aeson.Types as T
import Data.Attoparsec (parse, Result(..))
@seanhess
seanhess / aesonBson.hs
Created November 3, 2011 05:45
BSON to JSON
{-# LANGUAGE OverloadedStrings, ExtendedDefaultRules #-}
-- https://github.com/mailrank/aeson/blob/master/examples/Demo.hs
-- cabal install aeson
-- cabal install mongoDb
import Data.Aeson
import qualified Data.Aeson.Types as T
import Data.Attoparsec (parse, Result(..))
@seanhess
seanhess / mongo.hs
Created November 3, 2011 21:40
Mongo Example
{-# LANGUAGE OverloadedStrings, ExtendedDefaultRules #-}
{-
db <- mdb
db $ delete $ select [] "tags"
-}
module Mongo (mdb) where
import Database.MongoDB
@seanhess
seanhess / addedroute.hs
Created November 3, 2011 23:30
haskell types
get "/io" - do
file <- readFile "sandbox.hs"
text "hello"
@seanhess
seanhess / parse.hs
Created November 8, 2011 02:37
Lazy SAX parser
-- http://hackage.haskell.org/packages/archive/hexpat/0.19.7/doc/html/Text-XML-Expat-SAX.html#g:2
-- http://stackoverflow.com/questions/2292729/with-haskell-how-do-i-process-large-volumes-of-xml
import qualified Data.ByteString.Lazy as BSL
import Prelude hiding (readFile)
import Text.XML.Expat.SAX
main = do
-- I need a ByteString
contents <- BSL.readFile "schedules.xml"