Cache implementation using weakref
Bird's cache (Photo credit: Wikipedia)
This article presents a quick example of how to use
weakref to implement a
home-made cache mechanism.
Let's use the following use case:
- Let's consider items:
- items can be stored on a storage
- items can be retrieved from storage
- items are identify by an ID …
Read More
Tkinter and Asyncio
Asynchronous process results waiting (Photo credit: Wikipedia)
Graphical interfaces are typically the kind of object that can take advantage
of asynchrounous programming as a GUI spend lot of time waiting for user input.
Tkinter <https://docs.python.org/3/library/tkinter.html#module-tkinter>_
is a kind of standard for …
Read More
Latex generator using Jinja
Kawasukune-jinja (Photo creadit: Wikipedia)
The goal is to generate a PDF file using python.
I decided to generate \(\LaTeX\).
Pipeline
I decided to use jinja as its documentation
mention it.
\begin{equation*}
\boxed{\text{Jinja template}} \xrightarrow[\text{python}]{}
\boxed{\LaTeX} \xrightarrow[\text{pdflatex}]{}
\boxed{\text{PDF}}
\end{equation*}
The …
Read More
HTTP to HTTPS
Public key (Photo credit: Michael Drummond)
The goal was to migrate from HTTP to HTTPS
HTTPS overview
The HTTPS protocol rely on TLS
(previously SSL) to ensure data integrity (data cannot be modified unnoticed),
confidentiality (requested URL and content are only known by end points) and
authentication (end points are …
Read More
Wikipedia crawling (part II)
Crawling (Photo credit: Wikipedia)
This article is the follow up of the one about
wikidata crawling.
Wikipedia has specific
infobox templates.
This is the normalized way to enter specification inside wikipedia articles.
It provides templates with already defined fields.
For example the
planet template
has fields such as periapsis or …
Read More
Travis setup
One job in continuous integration pipeline (Photo credit: Wikipedia)
The goal is to setup a CI pipeline based on Travis
with external dependencies integrated to a Github repository
Travis basics
To enable Travis integration in Github, one must edit ./.travis.yml file.
I won't go into detail. The setup is …
Read More
Wikidata crawling
Graph database representation (Photo credit: Wikipedia)
I wish to have reliable data about vehicles. I decided to rely
on one large source, namely Wikipedia. I chose it because it is reviewable and
most of the time reviewed, and regularly updated and completed.
Wikipedia - Wikidata relationship
Wikidata items are made to …
Read More
Differential equation in python
Second order differential equation (Photo credit: Wikipedia)
In python, differential equations can be numerically solved thanks to scipy .
Is usage is not as intuitive as I expected.
Simple equation
Let's start small.
The first equation will be really simple:
\begin{equation*}
\frac{\partial{f}}{\partial{t}} = a \times f …
Read More
Zombie propagation
Zombie favorite food warning (Photo credit: wikipedia)
I recently read a paper trying to model a disease propagation.
I wanted to play with this model.
The model
The model is know as "SIR" as it divide the population into 3 groups:
- S: suceptible to become a zombie
- I: infected …
Read More
Virtual Jupyter
Jupyter and a Python (almost) (Photo credit: Wikipedia)
Following the isolation of python environements
and given I use jupyter notebooks,
isolating jupyter kernels inside virtualenv is a logical step.
To do so, you must install a new kernel using the ipython you installed inside
your virtualenv:
- Create your virtualenv
- Install …
Read More