Skip to content

Instantly share code, notes, and snippets.

View basvandijk's full-sized avatar

Bas van Dijk basvandijk

View GitHub Profile
{-# LANGUAGE DeriveDataTypeable #-}
-- |
-- Module : Data.Attoparsec.Text.Number
-- Copyright : Bryan O'Sullivan 2011, Bas van Dijk 2011
-- License : BSD3
--
-- Maintainer : [email protected]
-- Stability : experimental
-- Portability : unknown
--
{-# LANGUAGE DeriveDataTypeable, TemplateHaskell, TypeFamilies, EmptyDataDecls, TypeOperators #-}
module Main where
--------------------------------------------------------------------------------
import Criterion.Main
import Control.DeepSeq (NFData, rnf, deepseq)
{-# LANGUAGE DefaultSignatures
, EmptyDataDecls
, FlexibleInstances
, FunctionalDependencies
, KindSignatures
, OverlappingInstances
, ScopedTypeVariables
, TypeOperators
, UndecidableInstances
, ViewPatterns
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (mapM_)
import Data.Functor ((<$>))
import Data.Hashable (Hashable)
import Data.Int (Int64)
import Data.List (foldl', sort)
import Data.Monoid (mappend)
import System.IO (stdin)
import qualified Data.HashMap.Strict as H
@basvandijk
basvandijk / attoparsec-hoogle.hs
Created February 4, 2012 12:13
Bug when parsing lazy text
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Applicative
import Control.Monad
import Data.Monoid (mappend)
import System.Environment
import System.Exit
import System.IO
@basvandijk
basvandijk / TH.hs
Created July 15, 2012 08:58
New Data.Aeson.TH
{-# LANGUAGE CPP
, NoImplicitPrelude
, TemplateHaskell
, NamedFieldPuns
, FlexibleInstances
, UndecidableInstances
, OverlappingInstances
#-}
{-|
@basvandijk
basvandijk / TaglessSerialization.hs
Created September 8, 2012 10:31
Tagless, Applicative, bidirectional serialization combinators
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
import Control.Applicative
class Field a where
fieldType :: a -> String
fieldRead :: String -> a
From 44ddcb44e675fa0979c94efe5364b4c5fc83fab0 Mon Sep 17 00:00:00 2001
From: Bas van Dijk <[email protected]>
Date: Fri, 19 Apr 2013 21:04:35 +0200
Subject: [PATCH 1/2] Fixed a stack-overflow in randomRs The following
generated a stack-overflow exception:
g <- getStdGen
randomRs (0,10::Int) g !! 1000000
Because randomRs generated a list without forcing the generator. This
starting VDE switch for network 0
starting VDE switch for network 1
running the VM test script
starting all VMs
carol: starting vm
carol# Formatting '/tmp/nix-build-vm-test-run-strongswan-swanctl.drv-0/vm-state-carol/carol.qcow2', fmt=qcow2 size=536870912 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
carol# qemu-system-x86_64: -net nic,vlan=0,model=virtio: 'vlan' is deprecated. Please use 'netdev' instead.
carol: QEMU running (pid 10052)
moon: starting vm
moon# Formatting '/tmp/nix-build-vm-test-run-strongswan-swanctl.drv-0/vm-state-moon/moon.qcow2', fmt=qcow2 size=536870912 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
@basvandijk
basvandijk / PKI checks on alice
Last active September 5, 2017 07:27
No private key found while key is loaded
[alice] $ pki --print --in /etc/swanctl/x509/aliceCert.der
subject: "C=CH, O=strongSwan, CN=alice"
issuer: "C=CH, O=strongSwan, CN=strongSwan CA"
validity: not before Sep 04 20:36:35 2017, ok
not after Sep 03 20:36:35 2020, ok (expires in 1094 days)
serial: 15:e5:2b:aa:af:61:cf:f1
authkeyId: ec:cd:2d:9a:ab:0c:d0:62:aa:87:7f:1c:92:5c:7d:29:0f:e0:14:3b
subjkeyId: 05:20:15:f0:62:c4:24:8f:69:2a:bd:c3:7e:dd:ee:dd:c9:7d:e4:72
pubkey: RSA 2048 bits
keyid: 95:94:34:5c:6f:4b:3b:9c:1f:b2:19:96:9d:1b:80:33:9d:f2:19:3a