Skip to content

Instantly share code, notes, and snippets.

@creichert
creichert / pghero_test.sh
Created May 6, 2017 19:14
PGHero one-liner test
docker run -ti -e DATABASE_URL=postgres://$USERNAME:$PASSWORD@$DATABASE_URL:5432/$DBNAME -p 8080:8080 bmorton/pghero
@creichert
creichert / Sha.hs
Created April 18, 2017 23:15
Example hashing functions using `cryptonite`
{-# LANGUAGE PackageImports #-}
module Crypto.Assertible
(
sha1Hex
, sha1HmacHex
, sha256Hash
) where
select conn q args = do
lbs <- formatQuery conn q args
print lbs
query conn q args
@creichert
creichert / fetch-url.hs
Last active January 9, 2020 19:39
Customize haskell http-client supported TLS ciphers
#!/usr/bin/env stack
-- stack -v runghc --package connection --package http-client --package http-client-tls --package tls --package data-default
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -fno-warn-deprecations #-}
import qualified Network.Connection as NC
import qualified Network.HTTP.Client as Http
import qualified Network.HTTP.Client.TLS as Http
import qualified Network.TLS as TLS
@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 / stack.yaml
Created May 13, 2016 14:52
Testing GHC Release Candidates w/ Stack (example w/ GHC 8)
compiler: ghc-8.0.0.20160421
setup-info:
ghc:
linux64:
8.0.0.20160421:
url: "http://downloads.haskell.org/~ghc/8.0.1-rc4/ghc-8.0.0.20160421-x86_64-deb8-linux.tar.xz"
resolver: lts-5.15
flags: {}