Skip to content

Instantly share code, notes, and snippets.

MareinK MareinK

  • Netherlands
Block or report user

Report or block MareinK

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
View .py
def ignore_first_call(fn):
called = False
def wrapper(*args, **kwargs):
nonlocal called
if called:
return fn(*args, **kwargs)
else:
called = True
return None
return wrapper
View monadic_parsing.icl
module monadic_parsing
import Control.Applicative
import Control.Monad
import Data.Func
import Data.Functor
import qualified Data.Map
import Data.Maybe
import Data.Tuple
import StdEnv
View lockpick.py
import random
import statistics
class RandomLock:
def __init__(self, n):
self.open = False
self.buttons = set(range(n))
self._code = list(self.buttons)
random.shuffle(self._code)
@MareinK
MareinK / .py
Last active Apr 27, 2018
asof multi key monkey patch
View .py
import pandas as pd
merge = pd.core.reshape.merge
errors = pd.errors
common = pd.core.dtypes.common
def _validate_specification(self):
super(merge._AsOfMerge, self)._validate_specification()
@MareinK
MareinK / boeken.txt
Last active Apr 19, 2018
Marein geeft boeken weg
View boeken.txt
Academisch:
☐ Modern Control Systems - Richard C Dorf, Robert H Bishop
☐ Artificial Intelligence - David L Poole, Alan K Mackworth
☐ Statistiek voor de psychologie 1 t/m 4 - Jules L Ellis
☐ Problem Solving with C++ - Walter Savitch
☐ An Introduction to Brain and Behavior 3e editie - Bryan Kolb, Ian Q Whishaw
☐ An Introduction to Brain and Behavior 4e editie - Bryan Kolb, Ian Q Whishaw
☐ Evolutionary Algorithms in Theory and Practise - Thomas Bäck
☐ Logica voor informatica - JFAK van Benthem
☐ Functional Programming and Parallel Graph Rewriting - Rinus Plasmeijer
View standupmaths_rugpuzzle_2.py
import functools
import itertools
import operator
def is_shape(ps):
return all(map(connected, itertools.product(ps, repeat=2))) and not flat(ps)
def connected(ps):
View standupmaths_rugpuzzle.py
import itertools
def is_triangle(ps):
p1, p2, p3 = ps
return (connected(*p1, *p2)
and connected(*p2, *p3)
and connected(*p3, *p1)
and not flat(*p1, *p2, *p3))
View advent17_7b.py
import collections
import re
Entry = collections.namedtuple('Entry', ['name', 'weight', 'children'])
pattern = re.compile('(\w*) \((\w*)\)(?: -> (.*))?')
groups = [pattern.match(line).groups() for line in open('7.txt').readlines()]
entries = [Entry(n, int(w), c.split(', ') if c else []) for n, w, c in groups]
programs = dict()
@MareinK
MareinK / advent_17_1.pl
Last active Dec 1, 2017
advent of code 2017 day 1 prolog
View advent_17_1.pl
main(Input, OutputA, OutputB) :-
solve_a(Input, OutputA),
solve_b(Input, OutputB).
solve_a(Input, Output) :-
sum_of_rotated_matches(Input, 1, Output).
solve_b(Input, Output) :-
string_chars(Input, Chars),
length(Chars, Length),
@MareinK
MareinK / track.py
Created May 17, 2017
get cainiao order status for multiple orders
View track.py
import collections
import html
import json
import requests
import bs4
CODES_FILE = 'codes'
BASE_URL = 'https://global.cainiao.com/detail.htm?mailNoList={}'
JSON_ELEMENT_ID = 'waybill_list_val_box'
You can’t perform that action at this time.