Skip to content

Instantly share code, notes, and snippets.

@creichert
creichert / Dockerfile
Created June 24, 2018 05:16 — forked from alexanderkjeldaas/Dockerfile
ghcjs-8.4 with stack.
FROM ubuntu:16.04
## ensure locale is set during build
ENV LANG C.UTF-8
## Haskell environment
RUN echo 'deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main' > \
/etc/apt/sources.list.d/ghc.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6F88286 && \
apt-get update && \
Writing a billing system in Haskell, using Stripe and Heroku
===
*This post is written in literate Haskell, meaning the source can be turned
into a blogpost or a working program. You can view the [source][source].
[source]: https://gist.github.com/gatlin/7754289
Normally clients pay me with checks, but recently one informed me that they
really really really like *really really* super prefer some kind of online
# trying out new compiler
compiler: ghc-8.2.0.20170507
compiler-check: match-exact
allow-newer: true
ghc-options: { deepseq: -XTypeSynonymInstances }
setup-info:
ghc:
linux64:
8.2.0.20170507:
url: https://downloads.haskell.org/~ghc/8.2.1-rc2/ghc-8.2.0.20170507-x86_64-deb8-linux.tar.xz
@creichert
creichert / gist:58ac83414d4e0d57effff4667dfb09ee
Created July 23, 2016 23:11 — forked from jetztgradnet/gist:808968
Elastic Beanstalk configuration options
aws:autoscaling:asg Availability Zones
aws:autoscaling:asg Cooldown
aws:autoscaling:asg Custom Availability Zones
aws:autoscaling:asg MaxSize
aws:autoscaling:asg MinSize
aws:autoscaling:launchconfiguration EC2KeyName
aws:autoscaling:launchconfiguration ImageId
aws:autoscaling:launchconfiguration InstanceType
aws:autoscaling:launchconfiguration MonitoringInterval
aws:autoscaling:launchconfiguration SecurityGroups
@creichert
creichert / custom-error-page
Created July 21, 2016 04:27 — forked from simlegate/custom-error-page
Nginx return custom json
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@creichert
creichert / meta-tags.md
Created July 12, 2016 21:23 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@creichert
creichert / poly-nfdata.hs
Created June 14, 2016 21:21 — forked from phadej/poly-nfdata.hs
Example how is possible to write polykinded type-classes in GHC-8.0. It's not that bad or messy, but I'm not sure it's practical either.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeSynonymInstances #-}
@creichert
creichert / STM-FUNN.hs
Created June 11, 2016 20:42 — forked from cartazio/STM-FUNN.hs
a little demo GHCI transcript illustrating STM and concurrency
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Prelude> import Control.
Prelude> import Control.Concurrent.STM
Prelude Control.Concurrent.STM> vars <- atomically $ mapM (\ _ -> newTVar False) [1..10]
Prelude Control.Concurrent.STM> length vars
10
Prelude Control.Concurrent.STM> :t vars
vars :: [TVar Bool]
Prelude Control.Concurrent.STM> import Control.Concurrent as CC
Prelude Control.Concurrent.STM CC> CC.forkIO ( do x <- atomically (do { xs <- mapM readT } ) ; if x then putStrLn "wippeee" else putStrLn "wattt")
@creichert
creichert / gist:c80777667bfe11215cab
Created October 6, 2015 05:41 — forked from ruckus/gist:2293434
Basic setup of WAL-E for continuous archiving and recovery

WAL-E needs to be installed on all machines, masters and slaves.

How to install WAL-E

Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:

archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
@creichert
creichert / PipeLog.hs
Created September 30, 2015 15:49 — forked from tel/PipeLog.hs
Pipes-based logger
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module PipeLog where
import Control.Applicative
import Data.Functor.Identity
import Pipes
import qualified Pipes.Prelude as P
newtype LogT l m a =