Skip to content

Instantly share code, notes, and snippets.

Andreas Ekeroot Rembane

Block or report user

Report or block Rembane

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Rembane
Rembane / Main.hs
Created Nov 27, 2018
The order of StateT and ReaderT.
View Main.hs
{-# LANGUAGE FlexibleContexts, GeneralizedNewtypeDeriving #-}
module Main where
import Control.Monad.Reader
import Control.Monad.State.Strict
newtype MyStackT1 m r s a = MyStackT1
{ runMyStackT1 :: ReaderT r (StateT s m) a }
deriving (Functor, Applicative, Monad, MonadReader r, MonadState s, MonadIO)
@Rembane
Rembane / speedtest.hs
Last active Jun 19, 2018 — forked from kuribas/speedtest.c
speedtest
View speedtest.hs
module Main where
import Data.List
f :: Int -> Int -> Int
f x y = x + (y * 2)
sum' :: [Int] -> Int
sum' = foldl' (+) 0
g :: Int -> Int
View upgrade_to_0.12.md

How to upgrade to Purescript 0.12

Before we begin, the type search in Pursuit is a great way to search for the functions you need.

Reset your tooling by deleting the bower_components/, .psci_modules/, .pulp-cache/, .psc-package/ and output/ folders. Then run psc-package build --only-dependencies.

Import changes and effects

Using sed or your other favourite global replace tool to search and replace all occurences in the list

View keybase.md

Keybase proof

I hereby claim:

  • I am Rembane on github.
  • I am eqroot (https://keybase.io/eqroot) on keybase.
  • I have a public key whose fingerprint is A05D 2DCD 038E 751E B1A1 DDDD 88AA 23B7 AEA5 8DCE

To claim this, I am signing this object:

View klapasnelhest.py
from collections import Counter
from operator import itemgetter
# Javascript för att hämta data från val.sverok.se.
# Array.from(document.querySelectorAll('#content > div > table > tbody > tr td:nth-child(4)')).map(x => x.textContent).join(', ')
# Resulterande data.
orter = "Skövde , Helsingborg  , Trollhättan , Ålberga , Upplands Väsby , Lövestad ,  , Göteborg , Nybro , Göteborg ,  ,  , Norrköping , Malmö ,  ,  , Hagfors ,  , Kalmar ,  , Kristinehamn  , Linköping , Göteborg  , Lindome , Krokom ,  ,  , Jönköping ,  ,  ,  , Göteborg , Lund , Göteborg ,  ,  , Göteborg , Malmö , Karlstad , Göteborg ,  ,  , Lund , Norrköping , Norrköping , Malmö , Jonkoping ,  , Malmö ,  ,  , Göteborg , Burträsk , Västervik , Visby , Sävar , Lund , Staffanstorp , Västerås , Göteborg ,  , Limhamn , Göteborg , Linköping ,  ,  ,  , Huskvarna  , Eskilstuna , Norrköping , Karlskrona , Linköping , Tyringe , Luleå , Göteborg , Farsta ,  , Stockholm ,  , UMEÅ , Ålberga , Lund ,  , Skövde ,  ,  , Genarp ,  , Malmö ,  , Rydsgård , Karlsh
View NiceHaskell.hs
runRandom :: State StdGen a -> IO a
runRandom x = do
g <- newStdGen
return $ evalState x g
View cosplaying_ints.c
#include <stdio.h>
int main() {
int x = 42;
int *p = &x;
printf("Value of the cosplayer: %d", p);
}
View get_and_group_photos.py
#!/usr/bin/env python3
import os
import os.path
import re
import subprocess
currdir = os.path.dirname(os.path.realpath(__file__))
picpattern = re.compile(r'(jpg|cr2)$', flags=re.IGNORECASE)
datepattern = re.compile(r'(\d{4}):(\d{2}):(\d{2})')
@Rembane
Rembane / FizzBuzz4.hs
Created May 21, 2015
Another FizzBuzz. This time with lots of recursion.
View FizzBuzz4.hs
module Main where
continue :: ([a] -> [b]) -> [a] -> [b]
continue _ [] = []
continue f (x:xs) = f (x:xs)
f1, f2, f3, b1, b2, b3, b4, b5 :: [Int] -> [(Bool, String)]
f1 (x:xs) = (False, show x):continue f2 xs
f2 (x:xs) = (False, show x):continue f3 xs
@Rembane
Rembane / msgorder.erl
Created May 13, 2015
How to get messages in correct order, with interference.
View msgorder.erl
-module(msgorder).
-compile(export_all).
% How to get messages in correct order, even though things outside of our
% control try to put them in a semi-random order.
f(T, X) ->
Parent = self(),
Ref = make_ref(),
spawn_link(fun() -> timer:send_after(T, Parent, {Ref, {T, X}}) end),
You can’t perform that action at this time.