Skip to content

Instantly share code, notes, and snippets.

View kejace's full-sized avatar

Kristoffer Josefsson kejace

  • NYC / LA and in between
  • X @kejace
View GitHub Profile
@edsko
edsko / DependentServant.hs
Last active July 2, 2020 06:52
See "Dependently typed servers in Servant" (http://www.well-typed.com/blog/2015/12/dependently-typed-servers/) for the blog post accompanying this gist.
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
@agocorona
agocorona / cordova.hs
Last active September 25, 2015 16:31
--
-- Hello-World of the cordova/phonegap application using Haskell.
--
-- here is the screenshoot
--
-- https://twitter.com/AGoCorona/status/532948528621178880
--
-- So that Haste-Haskell can be used to create hybrid smartphone applications
--
-- The original cordova JavaScript hello world is installed following the instructions of this page
@stonegao
stonegao / crdt.md
Created September 4, 2013 10:02 — forked from pozorvlak/crdt.md

CvRDTs are as general as they can be

What are you talking about, and why should I care?

Now that we live in the Big Data, Web 3.14159 era, lots of people want to build databases that are too big to fit on a single machine. But there's a problem in the form of the CAP theorem, which states that if your network ever partitions (a machine goes down, or part of the network loses its connection to the rest) then you can keep consistency (all machines return the same answer to

@edouardp
edouardp / radiance_writer.py
Created July 11, 2012 10:47
Numpy based writer for Radiance HDR files
# Assumes you have a np.array((height,width,3), dtype=float) as your HDR image
import numpy as np
f = open("xxx.hdr", "wb")
f.write("#?RADIANCE\n# Made with Python & Numpy\nFORMAT=32-bit_rle_rgbe\n\n")
f.write("-Y {0} +X {1}\n".format(image.shape[0], image.shape[1]))
brightest = np.maximum(np.maximum(image[...,0], image[...,1]), image[...,2])
mantissa = np.zeros_like(brightest)
@NicolasT
NicolasT / Primes.hs
Created August 1, 2011 14:14
Simple Haskell implementation of the Paillier homomorphic encryption scheme
{-# LANGUAGE BangPatterns, ScopedTypeVariables #-}
-- Stuff taken from the RSA module for now
module Primes where
import Data.Bits
import Data.Int
import Data.Word
import Data.ByteString.Lazy (ByteString)