Skip to content

Instantly share code, notes, and snippets.

@creichert
creichert / lisp.c
Last active September 9, 2015 22:55 — forked from sanxiyn/lisp.c
Lisp
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
@creichert
creichert / ecldemo.c
Last active August 29, 2015 14:27 — forked from vwood/ecldemo.c
Example of ECL in a C program.
/*
Example of a C program embedding ECL with callbacks to C functions.
Compiled via: gcc ecldemo.c -lecl
*/
#include <stdio.h>
#include <stdlib.h>
#include "ecl/ecl.h"
#define DEFUN(name,fun,args) \
cl_def_c_function(c_string_to_object(name), \
@creichert
creichert / ThreadPool.hs
Last active August 29, 2015 14:26 — forked from NicolasT/ThreadPool.hs
Haskell worker threadpool using STM
{-# LANGUAGE CPP, FlexibleContexts, BangPatterns #-}
module Control.Concurrent.ThreadPool (
createPool
, destroyPool
, withPool
, pushWork
, popResult
, popResult'
@creichert
creichert / datasets.md
Last active August 29, 2015 14:26 — forked from mrflip/datasets.md
Overview of Datasets

== Overview of Datasets ==

The examples in this book use the "Chimpmark" datasets: a set of freely-redistributable datasets, converted to simple standard formats, with traceable provenance and documented schema. They are the same datasets as used in the upcoming Chimpmark Challenge big-data benchmark. The datasets are:

  • Wikipedia English-language Article Corpus (wikipedia_corpus; 38 GB, 619 million records, 4 billion tokens): the full text of every English-language wikipedia article, in

  • Wikipedia Pagelink Graph (wikipedia_pagelinks; ) --

  • Wikipedia Pageview Stats (wikipedia_pageviews; 2.3 TB, about 250 billion records (FIXME: verify num records)) -- hour-by-hour pageview

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Monad.IO.Class (liftIO)
import Network.HTTP.Types
import Network.Wai.Middleware.RequestLogger
import Network.Wai.Middleware.Static
{-# LANGUAGE OverloadedStrings #-}
module SimpleThings where
import Control.Applicative ((<$>), (<*>))
import Control.Monad (mzero)
import Data.Aeson
import qualified Data.Aeson as A
-- | sum type containing all possible payloads
{-# LANGUAGE FlexibleInstances #-}
module Handler.JSRoutes where
import Import
import qualified Data.Text as T
import Database.Persist.Sql (toSqlKey)
import Control.Monad.Random
jsRoutes :: (MonadRandom m, Applicative m) => [m Text]
jsRoutes =