atlas news
    
Andrea Grandi
09  mars     00h00
Using AI tools for coding: good or bad?
   Every now and then, my Mastodon or LinkedIn timelines are full of messages either praising or condemning the use of AI tools for coding. Are they good or bad then As usual I think the truth is in the middle, or to be more precise: it depends on how you use them. Context In the last couple of years...
05  mars     00h00
iA Writer Authorship: a brilliant feature with a problematic implementation
   I recently started using iA Writer to edit my MarkDown files on iPad and I’m honestly quite impressed by its simplicity. With the latest version they introduced a feature called Authorship which basically helps you to keep track of external contributors. For example, suppose you asked a friend or...
03  mars     00h00
Self hosting a Copilot replacement: my personal experience
   For my job Software Developer I make a daily use of tools like GitHub Copilot and ChatGPT. I want to explore alternative solutions which can be hosted autonomusly, without relying on an external service. Disclaimer Before I continue, let me clarify that these are tools which makes my job faster,...
01  mars     00h00
Ollama: running Large Language Models locally
   I recently discovered a new tool called Ollama, which allows you to run Large Language Models LLMs locally, without the need of a cloud service. Its usage is similar to Docker, but it’s specifically designed for LLMs. You can use it as an interactive shell, through its REST API or using it from a...
28  février     00h00
My Backup Strategy with Borg, Vorta and BorgBase
   Recently I reviewed my backup strategy and started using a new open source software and a cloud service to keep my data safe. Before this my only backup was keeping my data in the cloud specifically I use pCloud , but I started thinking: what if they shut down What if I loose access to my account...
25  février     00h00
Migrating from Pelican to Hugo
   As you may have noticed, the blog has a new look. I recently migrated from Pelican to Hugo and I am very happy with the result. I’ve known Hugo for a long time, but I never had the opportunity to use it in a real project. With a little help from a couple of friends, I was able to complete the...
06  février     00h00
How to show a cover image in Pelican based blog posts
   Once you have written and published an article, it’s very likely that you will want to share it on social media or send to your friends on a messaging app. One method to make the link more attractive is to include a cover image that will be shown in the link preview. How do you set a cover image...
04  février     00h00
Kagi: a paid search engine which is worth the money
   It’s a not a news anymore that Google, the search engine which once was the best available, doesn’t work anymore for a lot of users. Its results are full of ads, they are not optimised for users, nor for advertisers and sometimes they also include malware. Their main goal is to boost ad revenue. So...
01  février     00h00
Blogging from an iPad
   A few years ago, I migrated from my Wordpress based blog which I self hosted... yeah... I know... no comment to a static generated using Pelican one which is hosted for free on GitHub Pages. This setup, believe me or not, is cool. I’ve all my blog posts written in MarkDown, versioned on and...
05  mai     00h00
Use OpenAI API to make two GPT bots talk to each other
   I wanted to learn how to use OpenAI API in Python, so I decided to make it fun and created an interesting experiment: what would happen if I let two GPT powered bots talk to each other Let’s find out Prerequisites If you want to run this experiment locally you will need the following things...
17  avril     00h00
HowTo use OpenAI API for ChatGPT in Python
   OpenAI is a research organization that develops and promotes friendly AI for the betterment of humanity. One of its most popular projects is the development of the GPT Generative Pre trained Transformer series, which includes ChatGPT, a large language model trained to generate human like text...
02  décembre     00h00
Ignoring hosts with python vcr when writing tests with pytest and generating cassettes
   If you are already using pytest to write your tests and are also using vcr to record and replay http responses, you already know that any http request is being recorded, so the next time the same request is made, the test won’t hit the real endpoint but it will use the recorded response. Sometimes...
06  mars     00h00
Archives
  
29  janvier     00h00
Using pyenv and pyenv-virtualenv to install Python and create a virtual environment on MacOS
   This is an update version of my previous tutorial Install Python with pyenv and pyenv virtualenv create virtual environment with specific Python version. In this version I will show how to install Python . . and create a virtual environment with that version. To manage my Python versions I’m...
16  décembre     00h00
How to safely store Arduino secrets
   You just got a new Arduino board maybe a wifi enabled one , you wrote a useful application and you are about to share it on GitHub. If your code looks like this: include lt;WiFi .h gt; char ssid ;myessid ; char pass ;mypassword ; ... do not share it You...
23  octobre     00h00
Getting started with TinyGo and WebAssembly (WASM)
   width With WebAssembly we can write a library in almost any language, compile it to WebAssembly WASM and use it from JavaScript. In this tutorial I will show you how to get started with TinyGo by writing a simple add method in Go and using it from a web page. All the code will be running...
16  octobre     00h00
Set specific environment variables activating a Python virtual environment
   When using Python virtual environments it can be useful to have certain environment variables automatically set when we activate it. For example we can have a projects that needs to connect to a database or we may need specific settings to run a service. Automating this process makes sure we don’t...
15  octobre     00h00
Optimise your website JavaScript loading speed with defer
   When a client requests a web page, the browser begins to download the html page and parses it. If an external resource is found it begins to request that resource in a parallel request. This means the the complete loading of the page may be delayed until all the external resources have been...
14  octobre     00h00
Improve your Pelican based website SEO by adding canonical url
   You may have notice that a few days ago this website changed its template. I’m still using Pelican static generator, but I switched to a template named Flex. The template is really nice and it’s also optimised for mobile clients, but it’s not very optimised for SEO. I’m in no way an expert, so I...
11  octobre     00h00
Python 3.9 introduces removeprefix and removesuffix
   Python . . has introduced two new methods to work with strings: removeprefix and removesuffix. As their names suggest, one is used to remove a prefix from a string while the other one is used to remove a suffix. removeprefix Given a string and a prefix, if the string begins with the prefix, the...
10  octobre     00h00
Using pyenv to install Python and create a virtual environment
   A few days ago Python . . has been released and I really wanted to test ist latest features maybe I will do a separate post to talk about them without messing my system with another Python version. To manage my Python versions I’ve been using pyenv for a while and once configured, it’s very...
20  avril     00h00
Contact Tracing: non e’ solo un problema di privacy o di sicurezza
   Contact Tracing in Italia Negli ultimi giorni non si fa che parlare di Immuni, la app che il Governo Italiano avrebbe scelto, come soluzione di contact tracing per il COVID , e vengono sollevati molti dubbi si va da quelli legittimi a quelli che rasentano il complottismo al riguardo. Per ...
10  avril     00h00
covid-api - a free and open source API service for COVID-19 data
   Introduction In this period of COVID emergency, many countries are publishing COVID related data that is being used by many existing projects and researchers. The main problem with these data is that they are being released in CSV format on some GitHub repository. While we fully appreciate the...
25  février     00h00
Google is moving some EU citizens data to US
   What is going on As you may have heard already, because of brexit, Google is moving UK citizens data from the Northern Ireland data controller to the US one Google LLC . Leaving the EU, UK citizens are not protected anymore by GDPR, and while this may be unfair, Google is legally allowed to do it....
24  février     00h00
How to deploy a static website to Github Pages using CircleCI
   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 acquisition and employees layoff,...
21  février     00h00
Skipping tests depending on the Python version
   Sometimes we want to run certain tests only on a specific version of Python. Suppose you are migrating a large project from Python to Python and you know in advance that certain tests won’t run under Python . Chances are that during the migration you are already using the six library. The six...
19  décembre     00h00
Installing Python and virtualenv on MacOS
   Every time I need to install Python on MacOS or whenever a colleague asks for help, I have to search fo the most updated instructions on Google, and every time I find different ways of doing the exact same thing. Tired of this, I decided to write down my own notes. Please note that I don’t claim...
04  novembre     00h00
Why I mentor on Exercism.io
   Exercism https: exercism.io 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 students can download, solve offline using...
16  octobre     00h00
Using ipdb with Python 3.7.x breakpoint
   Python . .x introduced a new method to insert a breakpoint in the code. Before Python . .x to insert a debugging point we had to write import pdb; pdb.set trace which honestly I could never remember and I also created a snippet on VS Code to auto complete it . Now you can just write breakpoint...
21  octobre     00h00
Keybase: PGP encryption made easy
   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. Keybase really makes encryption easy to use. PGP identity When...
30  septembre     00h00
Configuring an offline GnuPG master key and subkeys on YubiKey
   I’ve recently bought a YubiKey and decided to use it for GnuPG too, other than using it as hardware FA. I’ve also decided to make my GnuPG configuration much more safe, generating the master key on an offline computer in my case a simple RaspberryPi not connected to Internet and generating a...
25  août     00h00
Getting latest Ubuntu AMI with Terraform
   When we need to create an EC 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 for...
17  août     00h00
Creating a production ready API with Python and Django Rest Framework - part 4
   In the previous part of the tutorial we implemented details management, relations between models, nested APIs and a different level of permissions. Our API is basically complete but it is working properly Is the source code free of bugs Would you feel confident to refactor the code without...
02  juillet     00h00
Migrating from WordPress to a static generated website
   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. A brief history When I started this blog years ago, I was hosting it on...
12  mars     00h00
Creating a production ready API with Python and Django Rest Framework - part 3
   In the previous part we implemented authentication, permissions and the possibility to POST new products for admins. In this new episode we will see how to implement details management, relations between models, nested APIs and a different level of permissions. If you haven’t completed the previous...
01  octobre     00h00
Creating a production ready API with Python and Django Rest Framework - part 2
   In the first part of this tutorial we have seen how to create a basic API using Django Rest Framework. This second part will explain how to implement POST methods and add different levels of permissions and authentication. If you are starting from part, you may want to checkout the source code at...
28  septembre     00h00
Creating a production ready API with Python and Django Rest Framework - part 1
   The aim if this tutorial is to show how to create a production ready solution for a REST API, using Python and Django Rest Framework. I will show you how to first create a very basic API, how to handle the authentication and permissions and I will cover deployment and hosting of images. The full...
10  mai     00h00
Using Python ipdb from Jupyter
   If we try to use the usual ipdb commands from a Jupyter IPython notebook import ipdb; ipdb.set trace we will get a similar error: ...
10  avril     00h00
How to publish a Python package to PyPI
   PyPI is the Python Package Index, that archive that let you install a package using pip, for example: pip install Flask In the past days I started writing a Python API client for Toshl expense manager and I decided to publish the library on PyPI. You can have a look at my library here https...
08  février     00h00
Using a light sensor with BBC micro:bit and MicroPython
   A light sensor 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 analogic ports. To build this circuit you will need a breadboard, jumper wires, a k...
07  février     00h00
Prototyping BBC micro:bit projects with Kitronik breadboard kit
   BBC micro:bit has a few IO pins 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 a breadboard to the micro:bit, unless using a crocodile clip and being limited to just pins....
26  janvier     00h00
Using BBC MicroBit accelerometer with Python
   In these days I’m having a bit of fun with BBC MicroBit 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 dimensional axes: X, Y, Z. According to the documentation there...
18  décembre     00h00
Using Python PyPy in a virtual environment
   Sometimes we need to test if our code also works with PyPy implementation of Python. Assuming you have already installed it in your system, first find out where it is installed: which pypy usr local bin pypy then you need mkvirtualenv to create a virtual environment that will use this...
10  décembre     00h00
Getting started with BBC MicroBit and Python
   A few days ago I had the great opportunity to attend an event organised in collaboration with Python Software Foundation, a few primary school teachers and hosted by Computing at School, in London. The meeting was organised by Yvonne Walker from CAS and Nicholas Tollervey PSF . The aim of the...
09  décembre     00h00
Fix encfs under OSX after upgrading to 10.11.2
   After having upgraded OSX to . . on my MacBook, I noticed that my encfs volume didn’t mount after reboot. I tried to run the script manually and all I got was this error: dyld: Symbol not found: ZN boost archive xml iarchive implINS xml iarchiveEE load overrideERNS class...
06  décembre     00h00
Getting a free SSL certificate from Letsencrypt and configuring it on Nginx with automatic renewal
   Finally Letsencrypt went to public beta 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 free SSL certificate from StartSSL. The service is nice and I’m grateful to them for this important resource they are providing for free, but it must...
11  octobre     00h00
How to configure EncFS on OSX 10.10 (Yosemite)
   With EncFS 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 unsupported even on...
    00h00
Reversing a List in Python
   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. l ,,,,,...
31  août     00h00
Understanding Python decorators optimizing a recursive Fibonacci implementation
   A decorator is a Python function that takes a function object as an argument and returns a function as a value. Here is an example of decorator definition: def foo function : make a new function def new function : some code return new function To apply a...
29  août     00h00
Django Notes: read values from settings in a safe way
   Working on Django projects I find very often that many developers access the values that are defined in settings in this way from django.conf import settings my value settings.MY SETTING What happens if MY SETTING has not been defined in settings.py The code will raise an error and...