Instantly share code, notes, and snippets.

View nix-macos.md
View test.idr
-- 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
View stack.yaml
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
View TinyServant.hs
{-# 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
View pandoc.js.hs
{-# Language ForeignFunctionInterface #-}
{-# Language OverloadedStrings #-}
module Main where
import Text.Pandoc
import GHCJS.Marshal
import GHCJS.Foreign.Callback
import JavaScript.Object
View imageGeoDataToCsv.hs
{-# LANGUAGE LambdaCase #-}
import Graphics.HsExif (parseFileExif, getGpsLatitudeLongitude)
import System.Environment (getArgs)
import System.FilePath (takeFileName)
import System.IO (hPutStrLn, stderr)
import Data.List (intercalate)
printGeoLine :: FilePath -> IO ()
printGeoLine filename = do
View base62encode.hs
import qualified Data.DList as DL
import Control.Monad (forever)
base62Encode :: Integer -> String
base62Encode = map ((base62Alphabet!!) . fromIntegral) . DL.toList . digits
where base62Alphabet = ['0'..'9'] ++ ['A'..'Z'] ++ ['a'..'z']
digits n | n < 62 = DL.singleton n
| otherwise = digits (n `div` 62) `DL.snoc` (n `mod` 62)
readUuid :: String -> Integer
View keybase.md

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:

View lrss.cpp
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
unsigned int sharedPrefixLength(const char *a, const char *b);
std::string longestRepeatedString(const std::string s);
int main()
{
View prettyping.rb
require 'formula'
class Prettyping < ScriptFileFormula
homepage 'https://bitbucket.org/denilsonsa/small_scripts/overview'
url 'https://bitbucket.org/denilsonsa/small_scripts/raw/130bc1a6162fc14629cfd1cd30355d586cc38f5f/prettyping.sh'
sha1 '748ce4a5cfd098f728de1c4c374949a82302dcf1'
version '130bc1a'
def install
mv "prettyping.sh", "prettyping"