Skip to content

Instantly share code, notes, and snippets.

Avatar
🍼

Guillem Borrell guillemborrell

🍼
View GitHub Profile
@guillemborrell
guillemborrell / author_trend.py
Last active Jan 1, 2016
Script that computes the trend for new authors in my chat.
View author_trend.py
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
View .emacs
(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 / dht11_1.py
Created Nov 10, 2016
Experimenting with micropython and the dht11
View dht11_1.py
import dht
import machine
d = dht.DHT11(machine.Pin(4))
d.measure()
print(d.temperature(), d.humidity())
@guillemborrell
guillemborrell / dht11_2.py
Created Nov 10, 2016
Still playing with micropython and the DHT11
View dht11_2.py
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 / mapreduce.py
Last active Jul 16, 2019
Class that implements a complete MapReduce in Python.
View mapreduce.py
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 / series.ipynb
Last active Oct 23, 2021
Percentiles of rolling windows in time series with Cython
View series.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.