Skip to content

Instantly share code, notes, and snippets.

@ehamberg
ehamberg / scatterv.c
Last active January 17, 2024 00:55
MPI_Scatterv example
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define SIZE 4
int main(int argc, char *argv[])
{
int rank, size; // for storing this process' rank, and the number of processes
@ehamberg
ehamberg / spellcast.6.md
Last active November 15, 2018 11:52
spellcast man page

NAME

spellcast - a game of duelling wizards

SYNOPSIS

spellcast remotedisplay [ remotedisplay ... ]

One game window will appear on the default display (determined by the contents of the DISPLAY environment variable.) The second will appear on

ply
format ascii 1.0
element vertex 36
property float x
property float y
property float z
property float nx
property float ny
property float nz
property float intensity
@ehamberg
ehamberg / nix-macos.md
Last active September 3, 2018 12:07 — forked from ykomatsu/nix-macos.md
Installing Nix on macOS in single-user mode
@ehamberg
ehamberg / trampoline.hs
Created December 13, 2011 15:50
The “Trampoline” monad transformer from Mario Blažević's paper in Monad.Reader issue 19
{-# Language FlexibleContexts, Rank2Types, ScopedTypeVariables #-}
import Control.Monad (liftM)
import Control.Monad.Trans (MonadTrans (..))
newtype Trampoline m r = Trampoline {
bounce :: m (Either (Trampoline m r) r)
}
instance Monad m => Monad (Trampoline m) where

Keybase proof

I hereby claim:

  • I am ehamberg on github.
  • I am eh (https://keybase.io/eh) on keybase.
  • I have a public key whose fingerprint is 45C3 E2E7 86CA ADB7 8DAD 51E7 3A1A F085 AD3B CF19

To claim this, I am signing this object:

-- code based on https://www.youtube.com/watch?v=umiUJNcvPl0
data Command : Type -> Type where
PutStr : String -> Command ()
GetStr : Command String
data InfIO : Type where
Do : Command a -> (a -> Inf InfIO) -> InfIO
(>>=) : Command a -> (a -> Inf InfIO) -> InfIO
@ehamberg
ehamberg / stack.yaml
Last active May 18, 2017 05:54
Stack config for GHC 8.2.1-rc2
compiler: ghc-8.2.0.20170507
compiler-check: match-exact
resolver: lts-8.13
setup-info:
ghc:
linux64:
8.2.0.20170507:
url: https://downloads.haskell.org/~ghc/8.2.1-rc2/ghc-8.2.0.20170507-x86_64-deb8-linux.tar.xz
content-length: 141011788
sha1: ff886437c1d2ddfa5686d6c9efb0819a957c3dde
@ehamberg
ehamberg / highlight_functions.vim
Created August 25, 2011 09:11
Highlight Function names in Vim
" Highlight Function names. From
" http://stackoverflow.com/questions/736701/class-function-names-highlighting-in-vim/773392#773392
syn match cCustomParen "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(" contains=cCustomParen
hi def link cCustomFunc Function
hi Function term=bold gui=bold
@ehamberg
ehamberg / TinyServant.hs
Created February 16, 2017 07:58 — forked from kosmikus/TinyServant.hs
Implementation of a small Servant-like DSL
{-# LANGUAGE DataKinds, PolyKinds, TypeOperators #-}
{-# LANGUAGE TypeFamilies, FlexibleInstances, ScopedTypeVariables #-}
{-# LANGUAGE InstanceSigs #-}
module TinyServant where
import Control.Applicative
import GHC.TypeLits
import Text.Read
import Data.Time