Skip to content

Instantly share code, notes, and snippets.

Avatar
🍍
haskall

Ezequiel Alvarez alvare

🍍
haskall
View GitHub Profile
View wc.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
module Lib
( someFunc
) where
import Data.Char
import Data.IORef
import System.IO
View _.md
@alvare
alvare / 2015_1er_parcial_2ndo_c_p1.hs
Created Oct 3, 2016
2015_1er_parcial_2ndo_c_p1.hs
View 2015_1er_parcial_2ndo_c_p1.hs
module Main where
data Ball = R | B deriving (Show, Eq)
data Coin = Ca | Ce deriving (Show, Eq)
s_a = [(Ca, [a, b, c, d]) | a <- l, b <- l, c <- l, d <- l]
where l = [R, R, R, R, B, B]
s_e = [(Ce, [a, b, c, d]) | a <- l, b <- l, c <- l, d <- l]
@alvare
alvare / scraper.hs
Created Apr 1, 2016
Scalpel scraper for Dr. Who IMDB ratings.
View scraper.hs
-- stack --resolver lts-5.8 runghc --package "aeson scalpel bytestring text"
{-# LANGUAGE LambdaCase #-}
module Main where
import Control.Monad (forM)
import Text.HTML.Scalpel
import Data.Aeson
import Data.Text (Text, unpack, pack, strip)
import qualified Data.Text.IO as T
import qualified Data.ByteString.Lazy as B
@alvare
alvare / coder.clj
Created Feb 25, 2016
alphabet-cipher kata solution
View coder.clj
(ns alphabet-cipher.coder)
; Vemos que encodear un caracter `m` con
; una letra de keyword `k` es equivalente a sumar sus indices
; en el abecedario modulo 26.
;
; Por ejemplo: con indice("m") = 12 y indice("s") = 18 tenemos
; 12 + 18 ≡ 4 (mod 26)
; y 4 = indice("e")
;
View broken_mapTask_.hs
module Main where
import Control.Concurrent.Async.Pool
main :: IO ()
main = do
withTaskGroup 5 $ \g ->
mapTasks_ g $ map print [1..10]
putStrLn "Done!"
@alvare
alvare / clusters.py
Created Jul 1, 2015
Cluster/partition spatial data in equal sized convex spacially cohesive parts
View clusters.py
# coding: utf-8
import csv
import json
import numpy as np
def r_tree(points, K):
""" STR method for building R-Tree like structure.
http://stats.stackexchange.com/a/40785
http://www.dtic.mil/dtic/tr/fulltext/u2/a324493.pdf (pag. 8)
View keybase.md

Keybase proof

I hereby claim:

  • I am alvare on github.
  • I am alvare (https://keybase.io/alvare) on keybase.
  • I have a public key whose fingerprint is 299F A304 4E77 184C 7831 7E7D A45B 3D40 CF96 B477

To claim this, I am signing this object:

@alvare
alvare / testv2.hs
Last active Dec 30, 2015
Data.Sequence lol
View testv2.hs
import Text.Printf
import System.CPUTime
import qualified Data.Sequence as Seq
import Data.Sequence ((><), (<|), (|>))
import Data.Foldable (toList)
time :: IO t -> IO t
time a = do
start <- getCPUTime
v <- a
View test jp
import Text.Printf
import Control.Exception
import System.CPUTime
time :: IO t -> IO t
time a = do
start <- getCPUTime
v <- a
end <- getCPUTime
let diff = (fromIntegral (end - start)) / (10^12)