Andrea Grandi
16  décembre     17h00
How to safely store Arduino secrets
   p Best practices to store Arduino secrets safely p
23  octobre     16h00
Getting started with TinyGo and WebAssembly (WASM)
   p This tutorial explains how to call a method written in Go and compiled to WebAssembly (WASM) from JavaScript by using TinyGo p
16  octobre     19h00
Set specific environment variables activating a Python virtual environment
   p How to set specific environment variables when we activate a Python virtual environment p
15  octobre     18h00
Optimise your website JavaScript loading speed with defer
   p A simple way to optimise the websites loading speed by deferring javascript download p
14  octobre     16h00
Improve your Pelican based website SEO by adding canonical url
   p A quick trick to improve your Pelican based website SEO p
11  octobre     17h00
Python 3.9 introduces removeprefix and removesuffix
   p A quick tutorial to removeprefix and removesuffix methods which have been introduced with Python 3.9.0 p
10  octobre     17h00
Using pyenv to install Python and create a virtual environment
   p How to use pyenv to install a specific version of Python and create a virtual environment with that version p
20  avril     17h30
Contact Tracing: non e’ solo un problema di privacy o di sicurezza
   h2 Contact Tracing in Italia h2 p Negli ultimi giorni non si fa che parlare di strong Immuni strong , la app che il Governo Italiano avrebbe scelto, come soluzione di strong contact tracing strong per il strong COVID-19 strong , e vengono sollevati molti dubbi (si va da quelli legittimi a...
10  avril     20h00
covid-api - a free and open source API service for COVID-19 data
   h2 Introduction h2 p In this period of COVID-19 emergency, many countries are publishing COVID related data that is being used by many existing projects and researchers. p p The main problem with these data is that they are being released in CSV format on some GitHub repository. While we...
25  février     17h30
Google is moving some EU citizens data to US
   h2 What is going on h2 p As you may have heard already, because of strong brexit strong , a href https: www.independent.co.uk life-style gadgets-and-tech news google-uk-us-data-brexit-gdpr-trump-protection-information-a9348191.html Google is moving UK citizens data a from the Northern...
24  février     10h00
How to deploy a static website to Github Pages using CircleCI
   p Since I created my blog with a static pages generator, I’ve been using TravisCI to automate the pages build and deployment. My desire to learn something new (we are using CircleCI at work, but I never configured it from scratch) and the recent news about TravisCI a href https: blog.travis-ci...
21  février     19h00
Skipping tests depending on the Python version
   p Sometimes we want to run certain tests only on a specific version of Python. p p Suppose you are migrating a large project from Python 2 to Python 3 and you know in advance that certain tests won’t run under Python 3. p p Chances are that during the migration you are already using the a...
19  décembre     14h00
Installing Python and virtualenv on MacOS
   p How to install Python and virtualenv on MacOS p
04  novembre     12h00
Why I mentor on Exercism.io
   p Exercism ( a href https: exercism.io https: exercism.io a ) is a platform that has been created to help people improving their coding skills, thanks to the volunteers mentoring the students. There are tracks for almost all the popular languages and each track has coding tests that the...
16  octobre     20h00
Using ipdb with Python 3.7.x breakpoint
   p Python 3.7.x introduced a a href https: docs.python.org 3 whatsnew 3.7.html#pep-553-built-in-breakpoint new method to insert a breakpoint a in the code. Before Python 3.7.x to insert a debugging point we had to write code import pdb; pdb.set trace() code which honestly I could never...
14  avril     19h00
Machine Learning: Pima Indians Diabetes
   p Solving the Pima Indians Diabetes problem with Machine Learning using Python and scikit-learn p
21  octobre     10h00
Keybase: PGP encryption made easy
   p Using PGP can be quite hard, even if you have a lot of experience with computers. By the way encryption is what gives us privacy and permits us to safely transmit information and for this reason it should be easy to use, for everyone. p p a href https: keybase.io Keybase a really makes...
30  septembre     12h00
Configuring an offline GnuPG master key and subkeys on YubiKey
   p I’ve recently bought a a href https: www.amazon.co.uk Yubico-Y-158-YubiKey-4-Black dp B018Y1Q71M ref as li ss tl?ie UTF8&qid 1507054059&sr 8-1&keywords yubico 4&linkCode ll1&tag andreagrandi-21&linkId 6da97357c6fe86ca94df918c172f6605 YubiKey 4 a and decided to use...
25  août     09h00
Getting latest Ubuntu AMI with Terraform
   p When we need to create an EC2 resource on AWS using Terraform, we need to specify the AMI id to get the correct image. The id is not easy to memorise and it changes depending on the zone we are working one. On every new release the id changes again. So, how can we be sure to get the correct ID...
17  août     05h00
Creating a production ready API with Python and Django Rest Framework - part 4
   p In the a href https: www.andreagrandi.it 2017 03 12 creating-a-production-ready-api-with-python-and-django-rest-framework-part-3 previous part a of the tutorial we implemented strong details strong management, strong relations strong between models, strong nested APIs strong and a...
02  juillet     11h00
Migrating from WordPress to a static generated website
   p As you may have noticed, my website looks very different compared to a few days ago. It’s just a different theme or template, I completely changed how the pages are generated and I’m hosting it in a completely different way. p h3 A brief history h3 p When I started this blog 10 years ago, I...
12  mars     10h21
Creating a production ready API with Python and Django Rest Framework - part 3
   p In the a href https: www.andreagrandi.it 2016 10 01 creating-a-production-ready-api-with-python-and-django-rest-framework-part-2 previous part a we implemented authentication, permissions and the possibility to POST new products for admins. In this new episode we will see how to implement ...
01  octobre     09h12
Creating a production ready API with Python and Django Rest Framework - part 2
   p In the a href https: www.andreagrandi.it 2016 09 28 creating-production-ready-api-python-django-rest-framework-part-1 first part a of this tutorial we have seen how to create a basic API using strong Django Rest Framework strong . This second part will explain how to implement strong...
28  septembre     11h47
Creating a production ready API with Python and Django Rest Framework - part 1
   p The aim if this tutorial is to show how to create a production ready solution for a strong REST API strong , using strong Python strong and a href http: www.django-rest-framework.org Django Rest Framework a . I will show you how to first create a very basic API, how to handle the...
10  mai     08h13
Using Python ipdb from Jupyter
   p If we try to use the usual ipdb commands from a Jupyter (IPython notebook) p div class highlight pre span span code span class kn import span span class nn ipdb span span class p ; span span class n ipdb span span class o . span span class n set trace span ...
10  avril     17h05
How to publish a Python package to PyPI
   p strong PyPI strong is the strong Python Package Index strong , that archive that let you install a package using pip, for example: strong pip install Flask strong p p In the past days I started writing a strong Python API client strong for strong a href https: www.toshl.com ...
08  février     21h49
Using a light sensor with BBC micro:bit and MicroPython
   p A strong a href https: en.wikipedia.org wiki Photoresistor light sensor a strong is a small component with a particular characteristic: it is basically a resistor and its resistance decreases if the light is more intense. To use it with micro:bit we need to use one of the strong...
07  février     20h47
Prototyping BBC micro:bit projects with Kitronik breadboard kit
   p strong BBC micro:bit strong has a few a href http: microbit-micropython.readthedocs.org en latest pin.html IO pins a that can be used to interact with external devices. The problem with the board is that it’s not easy to connect the classic jumper wires (those that we normally connect to...
26  janvier     21h41
Using BBC MicroBit accelerometer with Python
   p In these days I’m having a bit of fun with strong a href https: www.microbit.co.uk BBC MicroBit a strong board and I’m learning how to use the different sensors available. The latest one I wanted to try was the accelerometer. The board can sense if you are moving it in any of the 3...
18  décembre     16h29
Using Python PyPy in a virtual environment
   p Sometimes we need to test if our code also works with strong a href http: pypy.org PyPy a strong implementation of strong Python strong . Assuming you have already installed it in your system, first find out where it is installed: p div class highlight pre span span code...
10  décembre     22h48
Getting started with BBC MicroBit and Python
   p A few days ago I had the great opportunity to attend an event organised in collaboration with strong a href https: www.python.org Python Software Foundation a strong , a few strong primary school teachers strong and hosted by strong a href http: www.computingatschool.org.uk ...
09  décembre     21h47
Fix encfs under OSX after upgrading to 10.11.2
   p After having upgraded strong OSX strong to strong 10.11.2 strong on my MacBook, I noticed that my strong encfs strong volume didn’t mount after reboot. I tried to run the script manually and all I got was this error: p div class highlight pre span span code dyld: Symbol not...
06  décembre     13h15
Getting a free SSL certificate from Letsencrypt and configuring it on Nginx with automatic renewal
   p Finally strong a href https: letsencrypt.org Letsencrypt a strong went to strong public beta strong and I really couldn’t wait to use it on my VPS (where this blog is hosted). Until few days ago I was using a strong free SSL strong certificate from a href https: www.startssl...
11  octobre     20h14
Reversing a List in Python
   p Sometimes we need to reverse the order of the elements in a Python list. While there can be many different ways of implementing this task, I found three in particular that I appreciate for different reasons. Let’s define first a list of integers that we will reverse later. p div class ...
    17h44
How to configure EncFS on OSX 10.10 (Yosemite)
   p With strong EncFS strong it’s possible to keep our data in almost any cloud (Dropbox, OneDrive, etc...), having a good level of privacy and security. Infact EncFS encrypt and decrypt our data automatically. It’s available for Linux as well and using a commercial solution (that is currently...
31  août     17h32
Understanding Python decorators optimizing a recursive Fibonacci implementation
   p A strong decorator strong is a Python function that takes a em function object em as an argument and returns a function as a em value em . Here is an example of decorator definition: p div class highlight pre span span code span class k def span span class nf foo span ...
29  août     13h50
Django Notes: read values from settings in a safe way
   p Working on strong Django strong projects I find very often that many developers access the values that are defined in strong settings strong in this way p div class highlight pre span span code span class kn from span span class nn django.conf span span class kn ...
23  août     19h46
How to write a custom Django Middleware
   p To understand how a strong a href https: docs.djangoproject.com en 1.8 topics http middleware Django Middleware a strong works we need to remember that the basic architecture of Django is composed by a strong request strong and a strong response strong . A middleware is something...
22  août     12h59
Why I completely switched this website to HTTPS (and why you should do the same)
   p I must admit it, there was a time when I was not using strong HTTPS strong , not even to protect the admin section of the website. This means that anyone could have intercepted the password and published (or deleted) things in my name. Since a couple of years ago I started protecting my admin...
23  juillet     20h41
Django Notes: tests, setUp method and db data
   p This won’t be a full post, but just a quick note (probably the first one of a serie) about development with Django. p p When we write a strong TestCase strong test, if we have defined a strong setUp strong method, it will be called before the execution of each test. One could think that...
12  juillet     08h10
Soma.fm Spotify import.io Python mashup: automatically create a Spotify playlist with Soma.fm tracks
   p I’m a big fan of a href http: somafm.com Soma.fm a (a 25 channels streaming radio based in San Francisco) and during the years I’ve been writing clients for this radio for different mobile platforms (Maemo, MeeGo, Harmattan, Windows Phone, BlackBerry 10, Jolla). I love in particular their ...
19  avril     10h26
Goenv - Go Environment Manager
   p To briefly explain what a href https: bitbucket.org ymotongpoo goenv strong Goenv strong a is, I will assume you have previously worked with strong Python strong . Basically it’s what strong Virtualenv strong is for Python. Goenv (and it’s wrapper strong goof strong ) creates a...
16  mars     19h24
Go: defining methods on struct types
   p In strong Go strong it’s possible to define strong methods strong on strong struct types strong . The syntax needed for it can be a bit strange for people that are used to define classes and methods in Java, C# etc... but once you learn it it’s quite easy to use. p p In my case for...
21  février     19h24
How to create a Docker image for PostgreSQL and persist data
   p Before I start, let me confirm to you that official a href https: www.docker.com strong Docker strong a images for a href http: www.postgresql.org strong PostgreSQL strong a already exist and are available here: a href https: registry.hub.docker.com postgres https...
20  février     20h15
Moving away from Google Talk to a real Jabber XMPP service
   p I’ve been recently concerned about a href https: plus.google.com MayurKamat posts ETBvtp9VYav the future a of strong Google Talk strong service and all the implications related to recent changes to the existing service. What has been a nice implementation of the a href http: en...
25  octobre     08h56
Automatically pull updated Docker images and restart containers with docker-puller
   p If you use a href https: docker.io docker.io a (or any similar service) to build your strong Docker strong containers, it may be possible that, once the new image is generated, you want your Docker host to automatically pull it and restart the container. p p Docker.io gives you the...
12  septembre     13h27
Create an EncFS volume compatible with BoxCryptor Classic
   p If you are planning to share an encrypted volume between Linux OSX and Windows (I will assume you are sharing it on Dropbox, but you could use any similar service) and you are using a href http: www.arg0.net encfs strong EncFS strong a under Linux OSX and a href https: www.boxcryptor...
02  septembre     16h21
How to configure Edimax EW-7811UN Wifi dongle on Raspbian
   p If you want to connect your strong RaspberryPi strong to your home network and you want to avoid cables, I suggest you to use the strong Edimax wifi adapter strong . This device is quite cheap (around 8 on a href http: www.amazon.co.uk Edimax-EW-7811UN-150Mbps-Wireless-Adapter dp...
    14h26
Configuring ddclient to update your dynamic DNS at noip.com
   p a href http: noip.com strong noip.com strong a is one of the few dynamic DNS free services that are reliable to use. If you have, like in my situation, a RaspberryPi connected to your home DSL and you want it to be always reachable without knowing the current IP address (the IP could...
31  août     15h02
Getting started with Digital Ocean VPS: configuring DNS and Postfix for email forwarding
   p I have recently migrated my website from a shared hosting to a dedicated VPS on Digital Ocean. Having a VPS surely gives you unlimited possibilities, compared to a shared hosting, but of course you have to manage some services by yourself. p p In my case I only needed: SSH access, LEMP...