Skip to content

Instantly share code, notes, and snippets.

View basvandijk's full-sized avatar

Bas van Dijk basvandijk

View GitHub Profile
@basvandijk
basvandijk / cabal.project.freeze
Created July 26, 2022 10:58
cabal dependencies @ GHC-9.0.2
active-repositories: hackage.haskell.org:merge
constraints: any.HUnit ==1.6.2.0,
any.OneTuple ==0.3.1,
any.Only ==0.1,
any.QuickCheck ==2.14.2,
any.SHA ==1.6.4.4,
any.StateVar ==1.2.2,
any.abstract-deque ==0.3,
any.abstract-par ==0.3.3,
any.adjunctions ==4.4,
@basvandijk
basvandijk / cabal.project.freeze
Last active July 26, 2022 10:58
cabal dependencies @ GHC-9.2.3
active-repositories: hackage.haskell.org:merge
constraints: any.HUnit ==1.6.2.0,
any.OneTuple ==0.3.1,
any.Only ==0.1,
any.QuickCheck ==2.14.2,
any.SHA ==1.6.4.4,
any.StateVar ==1.2.2,
any.abstract-deque ==0.3,
any.abstract-par ==0.3.3,
any.adjunctions ==4.4,
@basvandijk
basvandijk / alice
Last active September 5, 2017 19:32
$ cat /etc/swanctl/swanctl.conf
connections {
alice {
children {
alice {
remote_ts = 10.0.0.0/24
start_action = trap
updown = /nix/store/jdcviy5z25xamq35g8k9qbdpskkx3w9g-strongswan-5.6.0/libexec/ipsec/_updown iptables
}
}
@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
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
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
@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
@basvandijk
basvandijk / TH.hs
Created July 15, 2012 08:58
New Data.Aeson.TH
{-# LANGUAGE CPP
, NoImplicitPrelude
, TemplateHaskell
, NamedFieldPuns
, FlexibleInstances
, UndecidableInstances
, OverlappingInstances
#-}
{-|
@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
{-# 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