Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am carlohamalainen on github.
  • I am carlohamalainen (https://keybase.io/carlohamalainen) on keybase.
  • I have a public key whose fingerprint is 7679 121C 2296 4C12 8888 93D1 269E 0DC4 E3E4 A5B8

To claim this, I am signing this object:

@carlohamalainen
carlohamalainen / AddProjToBruker.hs
Created July 23, 2015 03:07
Add CAI project ID to Bruker file (demo)
module AddProjToBruker where
-- ##$SUBJECT_comment=( 2048 )
-- <CAI:10001>
import Control.Monad (when)
import Data.Either
import Data.List
import Data.Maybe
import System.Environment
@carlohamalainen
carlohamalainen / join.py
Created June 12, 2015 00:27
Join binary files.
#!/usr/bin/env python
from functools import partial
import sys
BLOCKSIZE = 1048576
# Similar to http://bugs.python.org/issue20992
# but with Python 2.x syntax.
def read_blocks(files):
@carlohamalainen
carlohamalainen / TestWithHsJWT.hs
Created August 7, 2014 04:32
Trying to use hs-jwt to validate an AAF Rapid Connect assertion.
{-# LANGUAGE OverloadedStrings #-}
module TestWithHsJWT where
import qualified Data.Text as T
import qualified Crypto.JWT as JWT
import qualified Crypto.JOSE as JOSE
import qualified Data.HashMap.Lazy as HM
import Data.Aeson
@carlohamalainen
carlohamalainen / Airports.hs
Created July 1, 2014 10:00
Airports for Blinco.
{-# LANGUAGE FlexibleInstances #-}
-- Airports for Blinco!
module Airports where
import Control.Monad (forM_)
airportsRaw :: [String]
airportsRaw = [ "BNE", "SYD", "ADL", "PER", "CNB", "NTL", "UDG", "CTL"
@carlohamalainen
carlohamalainen / gist:b540375f1fe7218dec8b
Last active August 29, 2015 14:01
The expression "give him the wall".
Quote from _At Day's Close: Night in Times Past Paperback_ (A. Roger Ekirch, 2006).
Courtiers took the place of knights, satin and silk replaced chain
mail. The growing power of nation states, marked by their
monopolization of military force, only broadened the scope of
this transformation. Well-understood rules of civility governed
social exchanges among friends and strangers. Hence, it was thought
inappropriate, if walking on a street, to ask questions of a stranger
or to touch, much less jostle, other pedestrians. Above all, persons
of quality required respect, lest their dignity be affronted. Besides
@carlohamalainen
carlohamalainen / ghc-7.6.3 vs Cabal-1.18
Created January 23, 2014 08:15
ghc-7.6.3 vs Cabal-1.18
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: ghc-imported-from-0.1.0.0 (user goal)
next goal: Cabal (dependency of ghc-imported-from-0.1.0.0)
rejecting: Cabal-1.16.0/installed-c6e... (conflict: ghc-imported-from =>
Cabal>=1.18)
trying: Cabal-1.18.1.2
next goal: ghc (dependency of ghc-imported-from-0.1.0.0)
rejecting: ghc-7.6.3/installed-189... (conflict: Cabal==1.18.1.2, ghc =>
Cabal==1.16.0/installed-c6e...)
{-
Response to http://lists.samba.org/archive/linux/2013-November/032604.html
and http://lists.samba.org/archive/linux/2013-November/032610.html
Author: Carlo Hamalainen <carlo@carlo-hamalainen.net>
-}
import Control.Monad
import Data.Binary.Get
import Data.Bits
@carlohamalainen
carlohamalainen / corrector.hs
Last active December 27, 2015 08:59
bitwise fiddling in Haskell
{-
Response to http://lists.samba.org/archive/linux/2013-November/032604.html
and http://lists.samba.org/archive/linux/2013-November/032610.html
Author: Carlo Hamalainen <carlo@carlo-hamalainen.net>
-}
import Control.Monad
import Data.Binary.Get
import Data.Bits
@carlohamalainen
carlohamalainen / mincworkflow.py
Last active December 26, 2015 09:49
Test workflow for the new MINC interface in Nipype.
# Artificial example (averaging and then dumping) using the new
# MINC interface in Nipype.
#
# Carlo Hamalainen <carlo@carlo-hamalainen.net>
import os
import nipype.interfaces.minc as minc
import nipype.interfaces.io as nio
import nipype.interfaces.utility as util
import nipype.pipeline.engine as pe