Andrea Casarin

Andrea Casarin

Published on: 11/13/2022, 1:51:38 PM - Reading time: 0 minute

Postgres, where and null

Some days ago I was working on a project which uses Postgres as DBMS. Postgres is great, but it has some significant differences if you are used to MySql. I learned one of them the hard way. While doing a simple select query I was looking for tuples which were where x != 42 trying to extract all of them regardless of x being some number or null. That didn't work as I expected. In Postgres if you select something via where x != 42 it will not extract tuples where x is null. So, if you are doi

Published on: 10/8/2022, 8:05:00 AM - Reading time: 0 minute

OpenSSH ssh-dsa and ssh-rsa

OpenSSH 8.8 is deprecating ssh-rsa and ssh-dss as key types. In the SSH protocol, the "ssh-rsa" signature scheme uses the SHA-1 hash algorithm in conjunction with the RSA public key algorithm. It is now possible to perform chosen-prefix attacks against the SHA-1 algorithm for less than USD$50K. [https://www.openssh.com/txt/release-8.7] So you will get this error: no matching host key type found. Their offer: ssh-rsa,ssh-dss You can add those algorithms back, with: HostKeyAlgorithms +ssh-

Published on: 9/11/2022, 8:43:00 AM - Reading time: 1 minute

Nginx caching on Kubernetes

Nginx ingress is one of the best ingress you can use on your K8S cluster, by default it comes with a lot of features but caching is not enabled. Let's see how to set up a simple static cache for our websites. On cluster ingress (this is managed by an Nginx config map): proxy_cache_path /tmp/nginx-cache levels=1:2 keys_zone=static-cache:32m max_size=5g inactive=7d use_temp_path=off; proxy_cache_valid any 5m; proxy_cache_valid 200 30m; On application ingress (managed via deploy): proxy_ignore_

Published on: 7/9/2022, 9:17:11 AM - Reading time: 1 minute

Static assets optimization for websites

I recently restyled my website (this one! [https://andreacasarin.com]) switching from Wordpress to GhostCMS and SvelteKit (which are great,but that's a story for another day). In the process I wanted to reach some good speed to please both the users and Google [https://developers.google.com/speed/pagespeed/insights/]. One of the mayor aspect of this is static assets optimization, here are a few tips I found out in my journey. Images PJPEG: jpeg images are loaded from top to bottom, progressive

Published on: 6/11/2022, 10:17:19 AM - Reading time: 1 minute

Ansible forks/serial on a task level

If your inventory contains the same host multiple times (think dynamic inventories or something defined via Terraform) and then you run a playbook against that (eg. target: all) you'll end up trying to run the same tasks simultaneously on the same host. That's not usually an issue, however some tasks require a lock (eg. apt install pkg) thus breaking for errors or timeouts. Ansible has some attributes to manage this situations, like: * forks [https://docs.ansible.com/ansible/latest/user_

Published on: 5/3/2022, 4:23:00 PM - Reading time: 0 minute

eBPF application monitoring on Kubernetes

Just a quick one, since I recently found out about Pixie which is a super interesting opensource project recently bought by NewRelic. It's an agent which you can install on your k8s cluster (or on your standard VM). It uses eBPF [https://ebpf.io/] to collect deep data from Linux Kernel, granting the ability to monitor an application without the need of an APM (Application Performance Management). It promises a maximum 5% overhead. The frontend uses PxL Script (which is similar to python + pand

Published on: 4/9/2022, 10:04:17 AM - Reading time: 1 minute

Backup Kubernetes volumes in AWS

When using Kops [https://kops.sigs.k8s.io/] on AWS to deploy your Kubernetes cluster you'll find yourself with multiple elastic block storage volumes which are the PersistentVolumeClaim implementation on AWS. Snapshots are then a great way to provide backups, and especially so if coupled with lifecycle manager [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-lifecycle.html] which can define your backup schedule and retention. Usually when defining a life-cycle policy you create a

Published on: 2/7/2022, 8:33:45 AM - Reading time: 1 minute

DevPresto resources for developers

DevPresto [https://www.devpresto.com/] is a fast online resource collection for developers. It features some tools (like markup formatting [https://www.devpresto.com/formatters/xml], sql formatting [https://www.devpresto.com/formatters/sql], md5 calculation [https://www.devpresto.com/calculators/md5]) and will host a series of hand-picked guides and tutorials. It aims to be a useful website for everyday development or system administration. Most of our favorite instruments live in our editor/

Published on: 12/23/2021, 7:00:00 AM - Reading time: 1 minute

Switching from Minitest to RSpec

Minitest [https://guides.rubyonrails.org/testing.html] is great and it now the standard tool to test a Ruby on Rails application, I have been using it for a long time and it works great. However while working on a client's project I found that RSpec [https://rspec.info/] tests are easier to read and its ecosystem provides a faster and cleaner way to write tests. Said that I decided to switch the test suite for an application I was working on to RSpec, to try and learn this different tool. I als

Published on: 10/27/2021, 3:29:25 PM - Reading time: 1 minute

VirtualBox 6.1.28 and Minikube issues

So VirtualBox 6.1.28 has been released and with it the support for Linux 5.14 and, of course, a lot of other interesting features. I just discovered one the hard way, while upgrading my Arch machine. I'm using minikube for local Kubernetes development, minikube itself it's a VM which by default runs on VirtualBox (and a bunch of other platforms). It creates a host-only network plus a nat network to make the magic possibile. The default host-only network CIDR is 192.168.99.1/24, and here come

Published on: 10/29/2019, 9:00:58 AM - Reading time: 4 minutes

PSD2 dal punto di vista di uno sviluppatore

Cos’é la PSD2 La direttiva dell’UE 2015/2366 (Payment Service Directive 2 – PSD2) è una nuova legge Europea che ha come oggetto il mercato dei pagamenti nell’Unione. È un’evoluzione della direttiva 2007/64/CE (Payment Service Directive – PSD). Photo by Web Hosting on Unsplash FinTech e Europa Il settore FinTech non ha avuto fin’ora molto successo in Europa a differenza del mercato Americano. Molti strumenti non avevano la possibilità di funzionare qui a causa della mancanza di API per la conn

Published on: 4/30/2019, 4:14:10 PM - Reading time: 2 minutes

Page Speed: S3 recursive image optimization

I have been recently involved in a website optimization project for SEO purposes. One of its major steps was the (lossless) image optimization to improve performances and, of course, to make sure to be Google Page Speed friendly. Google Page Speed Insights PageSpeed Insights is a tool from Google which “analyzes the content of a web page, then generates suggestions to make that page faster”. Photo by Jannik Selz on Unsplash It’s the base index for every website performace optimization and mig

Published on: 3/28/2019, 6:23:05 PM - Reading time: 4 minutes

Trello + Zapier + Google Sheets = Time Tracking

Trello [https://trello.com/andreacasarin/recommend], un tool di organizzazione con più di 10 milioni di utenti, è diventato uno strumento essenziale per la gestione dei miei progetti. Lo trovo un software fantastico, è molto flessibile e può essere adattato a molteplici esigenze. Inoltre è estremamente semplice da usare, tanto che spesso condivido le bacheche di progetto con il cliente [https://www.andreacasarin.com/2017/05/04/e-tu-di-cosa-ti-occupi.html] che può così restare aggiornato sugli sv

Published on: 12/14/2018, 3:50:06 PM - Reading time: 3 minutes

Blockchain backed assets management: Oblatum.

Dealing with assets property certificates is, most of the times, cumbersome.In Italy when you buy a car you have to pay at least € 235 in property transfer. When you buy a house it starts from around € 5000. Even if you buy something not legally regulated but valuable (in terms of money) you need to keep your receipt and register your purchase for warranty purposes on a proprietary software given by the manufacturer. Then if you sell it, or more so if you are the one who buys second-hand, it’s

Published on: 10/2/2018, 6:15:04 PM - Reading time: 12 minutes

Applicazioni web a pagina singola, un manifesto

Le applicazioni web a pagina singola (SPA o interfacce web a pagina singola SPI) sono ormai diventate una realtà e hanno superato, grazie agli avanzamenti delle tecnologie web, quasi tutte le problematiche iniziali. Tuttavia non sono ancora così diffuse, soprattutto da questa parte dell’oceano. Ho avuto il piacere di leggere un “vecchio” manifesto che rappresenta il movimento agli albori delle SPI e ho pensato di riproporlo, tradotto in italiano. Eccolo. Photo by Danika Perkinson. Manifesto de