Skip to content

Instantly share code, notes, and snippets.

View rmeertens's full-sized avatar
💭
leading thoughts

Roland Meertens rmeertens

💭
leading thoughts
View GitHub Profile
@rmeertens
rmeertens / gear_ratio_finder.py
Created December 23, 2018 20:01
Wanted to know what lego technic gears I needed to make something rotate once a year... guess I found it :)
from collections import defaultdict
def get_gears_for_ratio(ratio, gears, maxdepth=10):
shortestpath = dict()
shortestpath[1] = list()
expanded = defaultdict(lambda: False)
depth = 0
while ratio not in shortestpath.keys():
depth +=1
if depth > 14:
@rmeertens
rmeertens / Test BLEU score
Created March 24, 2017 08:35
I wanted to know more about the BLEU score, so did this experiment:
import nltk
reference = "today I go cycling".split()
references = [reference]
hypothesis_strings = ["today I go cycling",
"today I go biking",
"today , I go cycling",
"today I go ride my bike",
"today I go bicycles",
"today I go fietsen",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPClient.h>
// The WIFI SSID and password you connect to
const char* ssid = "XXXXX";
const char* password = "XXXX";
@rmeertens
rmeertens / tensorflowsort.py
Created November 2, 2016 08:27
Whoo. Ineffective sorting algorithm!
import tensorflow as tf
import numpy as np
import tempfile
import random
vocabulary_size = 250 # amount of numbers our algorithm can handle
batch_size = 256
length_vector = 10 # length of the sequences we try to sort
training_epochs = 10000
@rmeertens
rmeertens / wbw.py
Last active October 30, 2016 20:55
Wie betaalt wat
import operator # For sorting my dictionary
bills = {"Kim":392.08,"Peter":71.81,"Mike":48.09,"Roland":5.91,"Yorick":0.0,"Elvira":-74.37,"Lisette":-103.22,"Robert":-340.30}
transactions = 0
while sorted(bills.items(), key=operator.itemgetter(1),reverse=True)[0][1]>0.001:
transactions+=1
sorted_bills = sorted(bills.items(), key=operator.itemgetter(1),reverse=True)
diff_highest_lowest = sorted_bills[0][1]+sorted_bills[-1][1] # Note that array[-1] is the last element of an array (for us: lowest value)
if diff_highest_lowest > 0: # In this case the lowest amount can't fill the highest amount
@rmeertens
rmeertens / matlabROI to opencv cascade training
Created August 8, 2016 12:31
Safe MATLAB ROI data to a format for opencv training
%% 'Global' variables
% Assuming that we are saving the positive instances:
filesToSave = positiveInstances;
vecFormatName='output_vec.dat'
fileID = fopen(vecFormatName,'w');
%% Write each object
for i = 1 : length(filesToSave)
%% Get data we want to write
instance = filesToSave(i);
@rmeertens
rmeertens / quine.py
Created June 24, 2016 22:02
creating a quine in python
def f():print("xx = 'f';eval('%s()'%(xx))")
xx = 'f';eval('%s()'%(xx))
@rmeertens
rmeertens / test.c
Created April 13, 2016 09:39
asdf
samenwerken. super gezellig