Skip to content

Instantly share code, notes, and snippets.

// Some (Java) library:
class Context {
fun register(cl: SomeClient) {
cl.initClient(this)
}
}
abstract class SomeClient {
abstract fun initClient(ctx: Context)
@evertheylen
evertheylen / keybase.md
Created December 17, 2017 22:17
Keybase proof

Keybase proof

I hereby claim:

  • I am evertheylen on github.
  • I am evertheylen (https://keybase.io/evertheylen) on keybase.
  • I have a public key ASDEEigkHemxyZVrfE_oTr2JU3KP5XwGhD4jwDA_51-rBQo

To claim this, I am signing this object:

# Stap 0: Wat voorbereiding
turn transaction DB {TID -> {item}} into items {item -> {TID}} (aka tidlists)
freq_itemsets = { {}: <alle TIDs> }
eclat({}, items)
# Het resultaat van het algoritme is freq_itemsets
def eclat(items, alpha):
while items not empty:
@evertheylen
evertheylen / eclat.py
Last active January 2, 2017 10:44
Simple Eclat algorithm
import sys
from collections import defaultdict
import random
def tidlists(transactions):
tl = defaultdict(set)
for tid, t in enumerate(transactions):
for item in t:
tl[item].add(tid)
@evertheylen
evertheylen / csp.py
Created November 15, 2016 17:40
AI CSP
import inspect
from collections import defaultdict
from itertools import combinations
from util import *
latex = False
class Constraint:
#!/bin/python3
# === Configuration ========================
basename = "localhost"
#basename = "jarvis.ydns.eu"
ws_url = "ws://"+basename+":8888/ws"
post_url = "http://"+basename+":8888/add_data"
filename = "config.json"
This file has been truncated, but you can view the full file.
# Initial and Transition Probabilities Occupants
# weekday initital
wdini=[[0.843713278495887,0.797619047619048,0.754002911208151,0.734090909090909,0.680000000000000,0.615384615384615],
[0.156286721504113,0.144841269841270,0.189228529839884,0.181818181818182,0.176000000000000,0.205128205128205],
[0.000000000000000,0.057539682539683,0.043668122270742,0.061363636363636,0.120000000000000,0.102564102564103],
[0.000000000000000,0.000000000000000,0.013100436681223,0.020454545454546,0.008000000000000,0.051282051282051],
[0.000000000000000,0.000000000000000,0.000000000000000,0.002272727272727,0.008000000000000,0.000000000000000],
[0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.008000000000000,0.025641025641026],
[0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000]]
[./execs/evert]
./testcases/wireframes048.ini: 0.2s 79304 KB
./testcases/specular_light122.ini: 1.83s 98148 KB
./testcases/wireframes012.ini: 0.01s 5752 KB
./testcases/ambient_light059.ini: 0.05s 15712 KB
./testcases/diffuse_light667.ini: 0.41s 15272 KB
./testcases/specular_light183.ini: 0.15s 14956 KB
./testcases/diffuse_light658.ini: 0.36s 91128 KB
./testcases/diffuse_light356.ini: 0.04s 12508 KB
./testcases/diffuse_light553.ini: 0.08s 11920 KB
for (auto it=working_set.begin(); it!=working_set.end(); ++it) {
if ((! q.valid(*it)) || D.is_dead((*it).dfa_pos.state)) {
// delete!
working_set.erase(it);
it--;
}
}
@evertheylen
evertheylen / convert.py
Created May 5, 2015 23:12
Converteer oude formaat Speelveld.xml naar nieuw formaat
#!/usr/bin/python3
# HOE TE GEBRUIKEN:
# ./convert.py Speelveld.xml
# Om Bewegingen.xml om te zetten naar Acties.xml; all hail the console!
# mv Bewegingen.xml Acties.xml
# sed -i "s/SPELERNAAM/ID/g" Acties.xml
# sed -i "s/BEWEGINGEN/ACTIES/g" Acties.xml