Skip to content

Instantly share code, notes, and snippets.

View guillemborrell's full-sized avatar
🏠
Working from home

Guillem Borrell guillemborrell

🏠
Working from home
View GitHub Profile
@guillemborrell
guillemborrell / series.ipynb
Last active October 23, 2021 04:13
Percentiles of rolling windows in time series with Cython
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@guillemborrell
guillemborrell / mapreduce.py
Last active July 16, 2019 06:57
Class that implements a complete MapReduce in Python.
from itertools import groupby
from functools import reduce as functools_reduce
from operator import itemgetter
class MapReduce(object):
"""
Class that emulates the behaviour of an actual map-reduce
infrastructure.
"""
def map(self, pairs: dict, map_function):
@guillemborrell
guillemborrell / dht11_2.py
Created November 10, 2016 08:45
Still playing with micropython and the DHT11
import dht
import machine
from machine import Timer
d = dht.DHT11(machine.Pin(4))
def display_dht11(t):
d.measure()
print('Temperature:', d.temperature(), 'Humidity:', d.humidity())
tim = Timer(-1)
@guillemborrell
guillemborrell / dht11_1.py
Created November 10, 2016 08:32
Experimenting with micropython and the dht11
import dht
import machine
d = dht.DHT11(machine.Pin(4))
d.measure()
print(d.temperature(), d.humidity())
(custom-set-variables
'(inhibit-startup-screen t))
(custom-set-faces
)
(autoload 'julia-mode "julia-mode"
"Major mode for editing Julia source files" t)
(add-to-list 'auto-mode-alist '("\.jl\'" . julia-mode))
(require 'package) ;; You might already have this line
@guillemborrell
guillemborrell / author_trend.py
Last active January 1, 2016 12:59
Script that computes the trend for new authors in my chat.
import json
import datetime
import numpy as np
import matplotlib
from itertools import groupby
from operator import itemgetter
from matplotlib import pyplot as plt
from time import perf_counter
matplotlib.rcParams['font.size'] = 18