Skip to content

Instantly share code, notes, and snippets.

View Rydgel's full-sized avatar
😂
💯 🔥

Jérôme Mahuet Rydgel

😂
💯 🔥
View GitHub Profile
@Rydgel
Rydgel / gist:c47f92e6736cf0df43c1
Last active August 29, 2015 14:08
Algebraic Data Types - Binary Search Tree
/**
* Binary Search Tree in Scala with ADT
*/
sealed trait Tree[+T]
case object Leaf extends Tree[Nothing]
case class Branch[T](value: T, left: Tree[T], right: Tree[T]) extends Tree[T]
object Tree {
def showTree[T](tree: Tree[T]): String = tree match {
export GHC_DOT_APP="/Applications/ghc-7.8.4.app"
export PATH="${HOME}/.cabal/bin:${GHC_DOT_APP}/Contents/bin:${PATH}"
export PATH=$HOME/.cabal/bin:$PATH
#! /bin/bash
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@Rydgel
Rydgel / gist.hs
Created August 12, 2015 08:12
haskell async http requests example
{-# OPTIONS_GHC -Wall -O2 -threaded -with-rtsopts="-N" #-}
import Control.Concurrent
import Control.Concurrent.Async
import Control.Lens
import Control.Monad
import Data.ByteString.Lazy hiding (replicate)
import Data.List.Split
import Network.Wreq hiding (getWith)
import Network.Wreq.Session
@Rydgel
Rydgel / gist:15390ee158fbad881b13
Last active August 29, 2015 14:27 — forked from hyone/gist:3950460
Multiple async HTTP requests by Haskell
{-# LANGUAGE FlexibleContexts #-}
import Data.Conduit
import qualified Data.Conduit.List as CL
import Network.HTTP.Conduit
import Control.Concurrent.Async (mapConcurrently)
import Control.Concurrent.MVar
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Control (MonadBaseControl)
@Rydgel
Rydgel / gist:310f7e4381892db6f958
Created October 15, 2015 14:30
Glut workaround on OS X
cabal install GLUT --ghc-options="-optl-Wl,-framework,GLUT" --reinstall --jobs=1
@Rydgel
Rydgel / gist:4d8cafa96bc24ac799bd
Created January 9, 2016 14:58
Weakauras - Condensateur d'âmes
defrnaqEQG1JcjUVIiz)YawePwesLlrrKpHcPmksjlkfQSkcK8kcenle5wkc7cH(ffHggfLJrfTmkQEgrW0icDnfjBtrPVru04iIAXPqsVdPQ5HcP6EKIdsuYcvK6HerMivOlIOAJOq8rsPgjfrDscyLeAMevotkuQDIc(jrPgkfPokku0sjk8uknveCvffBLaHZIcLCkIQUPIiEybsTxL(lkny4WkSyfr9yKYKPkxwvBMG(SIQrJOCAvA1OqHxtrYSjv3MQA3K8BQ0WjshNIGLJKNtHPJQRRITJI(oku14jq15iq515syT(R1BTElH1k0vXTxgLFzW8PwR31qQ(WbcVGZxRjPwl1p)6Qi4G0FT8xW5R9QUCwAU(s1F(7Tm4CTdA8RRYyjSwHx11GSLWA9CzPDm4U(70RL2XG76V2XHAW(kMeP5Eu8NkOjyg9lFTx1LVewRNllTJb31FNET0ogCx)1ooud2xXKOuTNrahdAcZOUCTNrah1IoP6dhEk6KN(ehhQb7RysKM7rXFQGMGz0NyIJd1G9vmjAqBO0(hubnbHhfn(1vPL8jgcHGqxQWvJtjqYPedEUjgcHqiec6U0g6b9RYubnbTFUakMVI7s5Ga83xURYuArNu9HdpfDKcx5PpXqiecHq4kmOFvMkWj7vjgcHqiecHqiO7sBOhud)NuGLuGLu4k3Z81dAcA)Cb4VVakHUAPFvMsE6tmecHqiecHWvyqn8)Ggnb6KKRY7vgd(FOcEmQtAgBbnJZ)nOlWj7vjgcHqiecHqiecHW4qnyFftIVjCUsL(Ebnbo15PpXqiecHqiecHqieghQb7Rys0)OZVs1VpvqtWzqqgmJO5ZktzgeubNeDovtkT06k3Z81NywbBk5nrNtjp9jgcHqiecHqiecHa1Zpuk6tmecHqiecHq4vEjgcHqiecVYlXqieELxIHqimoud2xXK4BcNRuPVxqtq4q34PpXx5LyIJd1G9vmjAqBO0(huAjp9lF5R96Twj5Q8ELXG)hQGhJMG
@Rydgel
Rydgel / minimal-http.hs
Created November 30, 2016 10:41 — forked from aaronlevin/minimal-http.hs
Minimal Haskell HTTP server written on top of warp via the Web Application Interface (no frameworks)
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.Wai (pathInfo, Request, requestMethod, Response, responseLBS, ResponseReceived)
import Network.Wai.Handler.Warp (run)
import Network.HTTP.Types (status200, status401)
-- note: type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
application :: Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
@Rydgel
Rydgel / free-monad-example.hs
Created January 4, 2017 01:14 — forked from danstn/free-monad-example.hs
An example of using Free Monads for writing custom AST/DSL and its interpreters.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveFunctor #-}
import Prelude
import Data.String
import Control.Monad.Free
type Program a r = Free (AST a) r
data AST a next =
@Rydgel
Rydgel / FreeCoFree.hs
Created January 4, 2017 16:35 — forked from queertypes/FreeCoFree.hs
Exploring Free Monads, Cofree Comonads, and Pairings: DSLs and Interpreters
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-
Explores Free Monads (DSLs) and Cofree Comonads (interpreters) and
their relationship.
Most of the code in this file comes from (1) below. Only minor
modifications are made - semantics are preserved.