Skip to content

Instantly share code, notes, and snippets.

View mtourne's full-sized avatar

Matthieu Tourne mtourne

View GitHub Profile
@mtourne
mtourne / slurp_taco.js
Created October 21, 2020 16:54
Slurping TACO/annotate image urls
const puppeteer = require('puppeteer');
const fs = require('fs');
// after MAX_TRY collisions OR attempts in a row exit
const MAX_TRY = 300;
let attempts = 0;
let collisions = 0;
const image_regex = /(?:.*\.amazonaws\.com\.*)|(?:.*staticflickr\.com.*_o\..*)/;
@mtourne
mtourne / coffee_water_temp.py
Created March 6, 2018 00:13
graph for perfect coffee water temp
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.colors as mc
T1 = 212
# T1 is always boiling
def get_m_ratio_given_T_T2(t, t2):
if t2 - t == 0:
@mtourne
mtourne / README.md
Last active July 6, 2022 16:30
zerorpc with zmq curve
@mtourne
mtourne / Makefile
Created April 10, 2015 00:31
Compiling two c++ standards at once ?
CPP=g++
SRC=main.03.cc toto.11.cc
BIN=foo
OBJ=$(SRC:.cc=.o)
LDFLAGS=
CXXFLAGS=-O0 -g
all:$(BIN)

Summary

I'm trying to figure out how to use rebar to:

  • create erlang project
  • add a dependency on an erlang module from github
  • start the app via the erl console
  • create a release and start the app from the release (via the generated scripts)
@mtourne
mtourne / cut_words.js
Last active August 29, 2015 14:05
js cut words
function is_word_char(c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
function cut_words(content) {
var in_word = false;
var start_word = 0;
var word;
var result = [];
var i;
@mtourne
mtourne / space_saver.js
Last active August 29, 2015 14:05
top k in Javascript
function topk_words(content, nbItems) {
var space_saver = new_space_saver(nbItems * 2);
var words = content.toLowerCase().replace(/\W/g, ' ').split(/\s+/);
for (var i = 0; i < words.length; i++) {
insert_space_saver(space_saver, words[i]);
}
return get_top_space_saver(space_saver, nbItems);
@mtourne
mtourne / ardrone_autonomy_armv7.patch
Created October 31, 2013 23:04
Ardrone autonomy patch // armv7
diff --git a/ARDroneLib/VLIB/Platform/video_config.h b/ARDroneLib/VLIB/Platform/video_config.h
index 21263fa..ccb8b6f 100644
--- a/ARDroneLib/VLIB/Platform/video_config.h
+++ b/ARDroneLib/VLIB/Platform/video_config.h
@@ -8,7 +8,7 @@
////////////////////////////////////////////
#if TARGET_CPU_ARM == 1
// IPhone
-#if defined (USE_ANDROID) || defined (TARGET_OS_IPHONE)
+#if defined (USE_ANDROID) || defined (TARGET_OS_IPHONE) || defined (USE_LINUX)
@mtourne
mtourne / heavy_hitter.lua
Created July 5, 2013 18:43
Heavy hitter algorithm (get top-k token in a possibly infine set of token), in constant space. This version only allows a increments of 1 The design is based on "Efficient Computation of Frequent and Top-k Elements in Data Streams" by Metwally et al, available at www.cs.ucsb.edu/research/tech_reports/reports/2005-23.pdf‎
-- Copyright (C) 2013 Matthieu Tourne
-- @author Matthieu Tourne <matthieu@cloudflare.com>
local M = {}
--------------------
--- Heavy Hitter ---
--------------------
local obj_mt = { __index = M }
@mtourne
mtourne / strtok.py
Created April 11, 2013 22:13
Exercice python
#!/usr/bin/env python
# exercise python #1
import argparse
def tokenize_wrong(string, separator):
for index, char in enumerate(string):
if char == separator:
return index