Skip to content

Instantly share code, notes, and snippets.

View ygrenzinger's full-sized avatar

Yannick Grenzinger ygrenzinger

View GitHub Profile
open System
open System.IO
type MyRecord =
{ IP : string
MAC : string
FriendlyName : string
ID : int }
let IsMatchByName record name =
@ygrenzinger
ygrenzinger / fsharp-module-4.fs
Created December 13, 2015 13:18
Solution for problem of Edx F# Module 4
open System
open System.IO
type Shot =
{ X : float
Y : float
Speed : float
ExpectedDistance : float
Name : string }
@ygrenzinger
ygrenzinger / migrateRoutingSwitchs.go
Created December 29, 2015 17:59
Migration from MongoDB to ETCD
package main
import (
//"os"
"log"
//"fmt"
//"io/ioutil"
"encoding/json"
"time"
"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
@ygrenzinger
ygrenzinger / Simulation.scala
Created January 5, 2016 13:56
Gatling loadtest for aiguillage
package cos
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class RecordedSimulation extends Simulation {
@ygrenzinger
ygrenzinger / Watcher.java
Created February 26, 2016 15:04
Watch change in file
import java.io.IOException;
import java.nio.file.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.RunnableFuture;
import java.util.function.Consumer;
@ygrenzinger
ygrenzinger / DNA.hs
Created October 6, 2016 08:28
Rna Transcription on exercism.io
module DNA (count, nucleotideCounts) where
import Data.Map (Map, fromList, unionWith, mapKeys)
import Data.List
import Data.Maybe
import Control.Arrow
data NucleotideType = A | C | G | T deriving (Eq, Ord, Show, Read)
toNucleotideType :: Char -> Maybe NucleotideType
@ygrenzinger
ygrenzinger / chapter10.hs
Last active December 20, 2016 19:16
Haskell Book Chapter 10 exercise
module Test where
import Data.Time
import Data.Maybe (catMaybes)
data DatabaseItem = DbString String
| DbNumber Integer
| DbDate UTCTime
deriving (Eq, Ord, Show)
@ygrenzinger
ygrenzinger / chapter11-BinaryTree.hs
Created December 27, 2016 20:52
chapter11-BinaryTree
module C where
data BinaryTree a = Leaf
| Node (BinaryTree a) a (BinaryTree a)
deriving (Eq, Ord, Show)
insert' :: Ord a => a -> BinaryTree a -> BinaryTree a
insert' e Leaf = Node Leaf e Leaf
insert' e (Node left n right)
| e == n = Node left e right
module E where
notThe :: String -> Maybe String
notThe "the" = Nothing
notThe w = Just w
replaceNothing :: Maybe String -> String
replaceNothing (Just w) = w
replaceNothing Nothing = "a"
@ygrenzinger
ygrenzinger / Hangman.hs
Created December 27, 2016 20:55
Hangman Haskell
module Main where
import Control.Monad (forever)
import Data.Char (toLower)
import Data.Maybe (isJust, fromMaybe)
import Data.List (intersperse)
import System.Exit (exitSuccess)
import System.Random (randomRIO)
newtype WordList = WordList [String] deriving (Eq, Show)