Skip to content

Instantly share code, notes, and snippets.

View WJWH's full-sized avatar

Wander Hillen WJWH

View GitHub Profile
@WJWH
WJWH / gist:2d4cb80f2799256e8703d2e904d0b707
Last active August 25, 2019 08:24
Generic dockerfile for statically compiled Crystal applications
# See https://wjwh.eu/posts/2019-07-21-static-crystal-images.html for the reasoning behind each line
# Build stage
FROM durosoft/crystal-alpine:0.28.0 as build
COPY shard.yml shard.yml
RUN shards install --production
COPY . ./
RUN crystal build src/my_app.cr --release --static
# omg this is such a long comment, good thing I can spread it out over multiple lines like this so it will be clear for my colleagues what this code will do
@WJWH
WJWH / redisparsing.hs
Created December 31, 2018 14:55
Parsing the redis replication stream with AttoParsec
{-# LANGUAGE OverloadedStrings #-}
module RedisParsing where
import Control.Exception
import qualified Data.ByteString as B
import Data.Attoparsec.ByteString as AB
import Data.Attoparsec.ByteString.Char8
import Data.List
import Network.Socket hiding (recv)
import Network.Socket.ByteString (recv, sendAll)