Skip to content

Instantly share code, notes, and snippets.

@ehamberg
ehamberg / nix-macos.md
Last active September 3, 2018 12:07 — forked from ykomatsu/nix-macos.md
Installing Nix on macOS in single-user mode
@ehamberg
ehamberg / TinyServant.hs
Created February 16, 2017 07:58 — forked from kosmikus/TinyServant.hs
Implementation of a small Servant-like DSL
{-# LANGUAGE DataKinds, PolyKinds, TypeOperators #-}
{-# LANGUAGE TypeFamilies, FlexibleInstances, ScopedTypeVariables #-}
{-# LANGUAGE InstanceSigs #-}
module TinyServant where
import Control.Applicative
import GHC.TypeLits
import Text.Read
import Data.Time
@ehamberg
ehamberg / gist:3899289
Created October 16, 2012 13:30 — forked from adinapoli/gist:3899017
Iteratee attempt
{-# LANGUAGE OverloadedStrings #-}
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.Enumerator (Iteratee, Enumeratee, ($=), (=$), (=$=), (==<<))
import qualified Data.Enumerator as E
import qualified Data.Enumerator.Binary as EB
import qualified Data.Enumerator.Text as ET
import qualified Data.Enumerator.List as EL
import Data.Text
// by alex evans, 2011. released into the public domain.
// based on a first ever reading of the png spec, it occurs to me that a minimal png encoder should be quite simple.
// this is a first stab - may be buggy! the only external dependency is zlib and some basic typedefs (u32, u8)
//
// more context at http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/.
//
// follow me on twitter @mmalex http://twitter.com/mmalex
//
u32 crc_table[256]={0};
void make_crc_table(void)