Skip to content

Instantly share code, notes, and snippets.

@llelf
llelf / -
Created January 14, 2016 08:40
$ riak-admin bucket-type create --help
--help created
@llelf
llelf / pi12.hs
Last active December 19, 2015 06:48
module PI where
import Data.Number.CReal
import Data.List
fractPartToBase :: RealFrac x => Int -> x -> [Int]
fractPartToBase base x = unfoldr f x
where f d = Just (d'int, d' - fromIntegral d'int)
where d' = d * fromIntegral base
@llelf
llelf / a.sh
Last active August 29, 2015 14:24
Betty:fake lelf$ cabal --version
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library
Betty:fake lelf$ cabal install "mtl-2.2.1" "text-1.2.1.1" "hashable-1.2.3.3" "parsec-3.1.9" "scientific-0.3.3.8" "kill-me-666.666"
Resolving dependencies...
All the requested packages are already installed:
hashable-1.2.3.3
mtl-2.2.1
parsec-3.1.9
Betty:fake lelf$ cabal install "mtl-2.2.1" "text-1.2.1.1" "hashable-1.2.3.3" "parsec-3.1.9" "scientific-0.3.3.8" "attoparsec-0.13.0.0"
Resolving dependencies...
All the requested packages are already installed:
hashable-1.2.3.3
mtl-2.2.1
parsec-3.1.9
scientific-0.3.3.8
text-1.2.1.1
Use --reinstall if you want to reinstall anyway.
Betty:flamingra lelf$ cabal configure
Resolving dependencies...
Configuring flamingra-0.1.0.0...
Betty:flamingra lelf$ cabal haddock --html-location='/package/$pkg-$version/docs' --contents-location='/package/$pkg-$version'
Running Haddock for flamingra-0.1.0.0...
Preprocessing library flamingra-0.1.0.0...
Haddock coverage:
0% ( 0 / 1) in 'I'mHereOnlyToPleaseHaddock'
Documentation created: dist/doc/html/flamingra/index.html
> {-# LANGUAGE RankNTypes, DataKinds, KindSignatures, GADTs #-}
> import Unsafe.Coerce
> data M = A | B deriving (Show, Eq)
> data V1 :: M -> * where
> V1A :: Int -> V1 A
> V1B :: Double -> V1 B
> V1a :: () -> V1 a
@llelf
llelf / hammer
Last active December 30, 2015 17:39
[lelf@dragon ~]$ echo 11111111 > myfile
[lelf@dragon ~]$ sync
[lelf@dragon ~]$ echo 22222222 >> myfile
[lelf@dragon ~]$ sync
[lelf@dragon ~]$ hammer history myfile
myfile 00000001073a3ee6 clean {
00000001073abc60 08-Dec-2013 23:05:34
00000001073abd20 08-Dec-2013 23:05:47
}
@llelf
llelf / clib.c
Created November 30, 2013 18:01
#include <stdio.h>
int result_c (int max_a0, int *max_len_r, int *longest_r) {
int longest = 0, max_len = 0;
int a0, len;
unsigned long a;
for (a0 = 1; a0 <= max_a0; a0++) {
a = a0;
len = 0;
@llelf
llelf / vec.hs
Created November 30, 2013 16:37
{-# LANGUAGE ForeignFunctionInterface #-}
import System.Environment
import qualified Data.Vector as V
import Control.Monad (join)
import Data.Word
import Criterion.Main
import Foreign.C
import Foreign.Marshal
import Foreign.Ptr
use Modern::Perl;
while (<>) {
# Kill
s{<abr>\w+</abr> \s+ <rref>.*wav</rref>}{}xg;
s{<rref>.*\.(wav|jpg)</rref>}{}g;
# Head
s{<k>.*</k>}{};