Skip to content

Instantly share code, notes, and snippets.

View markhibberd's full-sized avatar

markhibberd markhibberd

View GitHub Profile
@markhibberd
markhibberd / postmortem.md
Created June 21, 2018 01:47 — forked from mlafeldt/postmortem.md
Example Postmortem from SRE book, pp. 487-491

Shakespeare Sonnet++ Postmortem (incident #465)

Date

2015-10-21

Authors

  • jennifer
  • martym
@markhibberd
markhibberd / .projectile
Created August 25, 2017 01:36
Haskell projectile file.
-/*/dist
-/lib
-/*/.cabal-sandbox
-/dist
-/.cabal-sandbox
```
/------ A -|
[submit batch] -------- B -|--[success-of-all-in-batch]-- D (which submits new batch to hydra to run next step)
\------ C -|
```
@markhibberd
markhibberd / .profile
Created September 23, 2016 08:09 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
module Boris.Http.TH (
embed
) where
import qualified Data.Text as T
{-# LANGUAGE GADTs #-}
{-# LANGUAGE Rank2Types #-}
{-
Lets start ^^ by enabling some language extensions. GADTs to encode our data types and
Rank2Types for the existental we will need to hide our types when we don't care about
the invariant.
-}
@markhibberd
markhibberd / gadt.hs
Created October 14, 2014 03:05
GADTs.
{-# LANGUAGE GADTs #-}
{-# LANGUAGE Rank2Types #-}
{-
Lets start ^^ by enabling some language extensions. GADTs to encode our data types and
Rank2Types for the existental we will need to hide our types when we don't care about
the invariant.
-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-- FIX de-dupe with apiengine-server
module Apiengine.Trace.Duration (
Duration
, durationToMicro
, microToDuration
, durationToDiffTime
, diffTimeToDuration
) where
def findMapM[F[_]: Monad, A, B](l: List[A])(f: A => F[Option[B]]): F[Option[B]] = l match {
case x :: xs =>
f(x).flatMap({
case Some(b) =>
b.some.pure[F]
case None =>
findMapM(xs)(f)
})
case Nil =>
none.pure[F]