RSSAmplifier

Blog

Sylvain Durand

sylvaindurand.orgRSS feed ↗45 posts

Latest posts

Encrypt and automatically mount a disk

I have a personal server at home, fully encrypted, and I regularly add hard drives to store data. To prevent any data leaks in case of theft, it’s crucial to ensure the data is also encrypted on the drives. This guide will walk you through the process of formatting the drive, encrypting it, and setting it up to be automatically decrypted and mounted at startup. Formatting the hard drive First,…

Restore IPs in nginx logs using Cloudflare

Cloudflare allows you to set up a proxy between your website and the outside world, providing a number of benefits: content caching, DDOS protection, analytics… However, this comes with a drawback when using logs for web analytics or to track actions: visitors’ IPs are replaced by the IPs of Cloudflare’s servers. Fortunately, Cloudflare always sends the original IP via the…

Yabai tiling window manager on macOS

A few years first under i3 , then under sway , have definitely converted me to tiling window manager . The windows automatically occupy the whole screen, without overlapping, and can be created, moved and resized with a few keyboard shortcuts. Back on macOS, finding these features was my first priority! Although not as fast as its Linux counterpart, Yabai , together with skhd for keyboard…

Sideload books to a Kindle with Calibre

I recently had the opportunity to play for a few days with an Amazon Kindle Paperwhite (2021). If the reader itself is of excellent quality, the counterpart is its very closed ecosystem, turned around the Amazon store and a proprietary format with DRM. Fortunately, the fantastic Calibre software allows you to use your Kindle with your own library of books and take full advantage of your e-reader.…

Personal finance with Beancount

When I was 7 years old, my parents gave me pocket money for the first time: 10 F per week (about €2 today) accompanied by a small notebook in which I had to do my accounting. I suppose it was a way to monitor what I was going to do with that fortune, but I kept track of my finance. Since my first debit card 15 years ago, I’ve tracked every expense I’ve made. The goal is pretty simple:…

Setting up a VPN with Wireguard

VPNs are very practical tools that allow you to secure the connection between two machines, to secure your connection to the Internet when you connect in public places or to bypass geographical access restrictions. When you have a personal server and you don’t want to expose it to the public, a VPN is ideal to reduce the attack surface and access your tools. For a long time, I used OpenVPN,…

Remote backups with Borg and Rclone

For a long time, my backup methods were very… questionable. A few times a year, I would manually copy the files I wanted to download to an external hard drive. Of course, this raised a lot of problems: the backups were irregular and rare (up to six months between two backups, so it was not unusual for me to lose the previous day’s work because of a mistake). Moreover, they were done…

Access the logs of a shared OVH server

As it only weighs a few megabytes, does not generate any income and only has a few hundred visitors each day, I wanted to host this site on a free platform. The advantage of static sites is that a lot of platforms actually offer free hosting: GitHub Pages, Netlify, Cloudflare, Render all offer a continuous integration that allows to generate and host a static site. But I had another constraint: to…

Deploy a static website with FTP

Until now, I was used to exporting static sites with a simple rsync , which synchronizes the locally generated directory with the files on the server. However, I had to deal with a shared server only accessible through FTP. For me, it was a tool I hadn’t used since the 2000s, with CuteFTP and then FileZilla, dragging and dropping files… Fortunately, the command line tool lftp simply…

Decrypt multiple drives at boot

The previous articles showed how to use a fully encrypted Arch Linux system which could be remotely unlocked if necessary. In any case, a simple password is enough to decrypt the main disk and start the system: In my case, however, several other hard disks are also encrypted, not necessarily with the same passwords: here we will see how to decrypt them all at once, with a single password. To do…

Remotely unlock an encrypted system

I self-host a server under Arch Linux on which are stored various personal data: documents, photos, music, videos… Its data are fully encrypted , including the main system, to avoid any risk – in case of burglary for example. However, encrypting the whole system raises a difficulty: a password is needed at every reboot. This means that it is necessary to connect a keyboard and a…

Setting up a dynamic DNS with OVH

My ISP, like most of the others in France, only assigns dynamic IP addresses to its customers: this means that the IP address is likely to change at any time, especially when my box is updated or rebooted. Most of the time, the possibility to have a fixed IP address is an option, reserved for expensive offers. For most users, this does not present any practical problems. However, the situation…

Arch Linux with full encryption

Over the past years, I have installed Arch Linux several dozen times on different devices. This article allows me to easily find the steps to install the distribution on a Dell XPS 9300, with UEFI and full encryption of the whole computer. Warning: the Arch Linux installation guide should remain your reference if you try to install on your own machine. Not only can the instructions evolve over…

From cron tasks to systemd timers

Like the vast majority of users of Linux systems, I have long used cron tasks when it came to running tasks at regular intervals. The tasks to be performed are to be entered in a text file, accessible from crontab -e : # m h dom mon dow command * * * * * /path/to/script.sh # each minutes @reboot /path/to/script.sh # on startup The disadvantages are multiple. The smallest unit of time is the…

Real-time log analytics with Matomo

I must admit, I like to know how many people visit my site. However, I hate trackers, and I won’t consider using Google Analytics which would retrieve much more private information about my users for its own account. I really appreciate Matomo (formerly Piwik), which is open source, offers a quality interface and plenty options. By default, Matomo uses a javascript tracker, but it also has a…

Gemini and Hugo

For a few years, I have been using Hugo, a static site generator, to produce these pages. At the same time very fast and corresponding perfectly to my needs, it is above all very modular. I was therefore not surprised to see that it was quite easy to convert, with little effort, my site for the Gemini protocol. This was not done without some tricks. Let’s see how! Declaring Gemini as an…

Discovering the Gemini protocol

Recently, I made the discovery of the Gemini protocol, developed earlier this year, and I must say I was immediately quite excited about it. I miss the web of 20 years ago: simpler, open, where you used to browse directories to find some small websites, often made by passionate amateurs. All the content was available, there were no barriers, no social networks, no tracking. The pages did not…

Dynamic wallpapers with Sway

During the last few months, I fell in love with Sway, a tiling window manager modeled on i3 that runs natively under Wayland. I found there all the efficiency and all my habits acquired under i3, but with a much smoother and more responsive display. All the applications I use run very smoothly, and I am discovering the joy of a responsive display without tearing. Firefox in particular has an…

Update notifications with libnotify

The libnotify library allows you to send desktop notifications to a notification daemon commonly used under Linux. Here we will see how to successfully update notifications already displayed. With notify-send? This library offers the notify-send command, which displays a notification directly on the desktop: notify-send "Notification title" "Notification description" But what if you want to update…

Arch Linux on Macbook Pro late 2013

Arch Linux is a distribution whose installation procedure may seem demanding, but which in return offers complete control over what is installed, but above all allows you to experiment with and understand many of the basic elements of how a Linux system works. This article details the specific steps that allow me to get a minimum functional installation on a 13" MacBook Pro, late 2013 (11.x). This…

Outlook emails analytics with Python

Microsoft Outlook uses a proprietary data format, “PST” (Personal Storage Table), to store emails, appointments or tasks. It was not until 2010 that the specifications of this format were made public, which probably explains why few tools are available to open it and use its data. Under Python, however, there is the libpff library that allows most metadata to be exported. The following…

Send emails with msmtp

There are many situations in which sending emails from a server can be useful, either because applications require it, or to do monitoring, such as being notified of security updates available on your system or the proper execution of cron tasks. However, configuring a mail server with postfix , exim or sendmail requires a large number of steps to be performed and a careful configuration, due to…

Overlay image in pure CSS

There is no native solution within browsers to display, on click, a full screen image. Several Javascript libraries have come to fill this gap: Lightbox (which was a precursor, to the point of giving its name to the concept), Fancybox, PhotoSwipe… These solutions are sometimes heavy, whereas if you are only looking for a simple behavior, a few lines of CSS are enough, and no Javascript code…

GPS data from photos with Python

Most recent cameras and mobile phones record photographs with geographical data (longitude, latitude, but also altitude). If this data is readable with most photo and file explorer software, it is also possible to access it with Python. Reading metadata The Python Imaging Library (PIL) provides easy access to EXIF data with the function _getexif() . It is easily installed, under Python3, with the…

Surveillance camera with Raspberry Pi

While connected surveillance cameras can be useful, they are also likely to have serious security breaches. They are thus at the origin of one of the most important DDOS attacks, or are sometimes publicly visible. In fact, it is very difficult to identify the origin of the cameras; no guarantee can be given on the security level or the durability of the manufacturer’s servers. However, it is…

Installing Pi-hole with PiVPN

While ad blockers remain highly effective within browsers, advertisements and trackers remain largely intact outside, whether it is computers, phones, televisions and other connected objects. Pi-hole is an application that allows you to block ads and trackers by acting directly at the DNS resolution level. In general, it provides relatively comprehensive information on a large number of…

Raspbian Lite on Raspberry Pi

More than four years ago, I wrote an article explaining how to Install Arch Linux on Raspberry Pi : I have since migrated to the Raspbian distribution, based on Debian and made specifically for the Raspberry Pi. Historically very large, because it has a graphic interface and several specific software, Raspbian now exists in a Light version that allows you to limit the packages to the essentials,…

Emulate a browser with Selenium

Python is particularly effective when you want to automatically browse or perform actions on web pages. If it is enough to use libraries like Beautiful Soup when you just scrape web pages, it is sometimes necessary to perform actions on pages that require Javascript, or even to imitate human behavior. To do this, it is possible to fully emulate a web browser with Python. Installation We will use…

Wildcard certificates with Let’s Encrypt

Launched in late 2015, Let’s Encrypt is a public benefit organization which democratized the use of HTTPS by providing free SSL certificates with an automated validation system. After several months of testing, Let’s Encrypt has launched the second version of its client (ACME v2) with a highly anticipated feature: you can obtain wildcard certificates, valid for all subdomains of one domain.…

Use Tor with Python

This page will show you how to use Tor to anonymously access data with a Python script. This can be particularly useful if you want to create a scrapper without being banned by the server concerned. Tor installation The installation of Tor depends on your system, and is detailed on the official website. On a Debian or Raspbian, we use: sudo apt-get install tor To launch Tor, just run: sudo service…

Launch Chromium in kiosk mode

Chromium makes it easy to be started in “kiosk” mode, that is to say to launch in full screen, without any window border, toolbar or notification (surprisingly, this feature is not offered by Mozilla Firefox). Our goal will be to get: a minimal installation of the graphical server, without desktop environment or window manager; an automatic launch on startup, in full screen; no toolbar…

Setting up a Nginx server on macOS

Seeking a satisfactory solution to create a local web server for programming in macOS with PHP and MySQL, I was disappointed that the turnkey solutions were far from equaling the WAMP that may exist on Windows. But I forgot macOS is a Unix system, and unlike Windows, it’s perfectly possible to create a customized local server with some packages. We will see how to install Nginx, PHP-FPM and…

PHP 5.2 on Debian 7 Wheezy

Sometimes you need to bring back to life old lines of code which will only works with old PHP versions. We will here see how to install PHP 5.2 on Debian 7 Wheezy (because I couldn’t get it work on Debian 8 Jessie…). PHP 5.2 end of life occured in January 2011; thus it is obviously a very bad idea to install it on a production environment, for obvious security reasons. Sources We will…

Making Jekyll multilingual

Jekyll has a very flexible design that allows a great freedom of choice, allowing the user to simply introduce features that are not integrated into its engine. This is particularly the case when one wants to create a multilingual website: while CMS remain very rigid and often require plugins, few filters are sufficient to achieve it with Jekyll . This article aims to present a way to create a…

Getting a git server with Gitolite

Github helped popularize git and its concepts to many. Nevertheless, it involves making public all the codes you want to host, unless you buy a fairly expensive subscription, and for a limited number of projects. Moreover, Github is not open, and it is therefore necessary to give it some trust to store its projects. Several solutions exist to host a git server on his personal server. For example,…

SSH key-based authentication

When you want to connect to an SSH server, default authentication is based on username and password. However, passwords are quite insecure, difficult to remember and hard to write; they are effective against computers if they are very restrictive, even unusable, for humans. The key-based authentication can fill these two requirements: it provides a very high safety and makes connection fast and…

Improving typography on Jekyll

Observing typographical rules on the Internet is not always easy: although Unicode reserves many areas of characters for typographic symbols, many punctuation marks and spaces are most of the time unused. With Jekyll, the articles are written very simply with Markdown before being generated in HTML by the engine: we can add automatic rules to improve typography on our site without carrying about…

Compressing Liquid generated code

The Liquid syntax, which is used by Jekyll, has an unpleasant default: it generates significant spaces and unneccessary line breaks in the generated pages source code. This is especially true when you want to indent your Liquid code, or want to use loops. For instance, the following example (which show each multiplication which gives “12”) will generate almost 500 lignes of codes,…

Getting a web server with Nginx

Apache was once the ideal solution for creating a web server. Its great features induced a certain heaviness, and its popularity made him very attacked, and therefore frequently updated. In recent years, Nginx has established itself as a high quality alternative: although comprehensive features, the software is characterized by great lightness, which allows to run on very modest configurations…

Installing Arch Linux on Raspberry Pi

Is it still necessary to present it? The Raspberry Pi is a nano-computer which, due to its small size, low power consumption and very low cost (about 35 € in its most powerful version, to which must be added an SD card, μUSB and ethernet cables, less than € 50 in total), makes an essential personal server or hack tool. Despite its limited computing power, it is perfectly possible to make a web…

Using CSS to add line numbering

When you want to display a code listing with HTML, you use a <pre> tag in order to indicate that the text is preformatted, then inside one or multiple <code> tags to specify it is a code. Showing line numbers appears may be quite useful, and the methods to achieve this vary widely: many use Javascript or tables&hellip; Yet it is possible to achieve this in a simple way, using only CSS and HTML.…

Using Github to serve Jekyll

GitHub has created a wonderful ecosystem built around the static websites generator Jekyll. GitHub Pages allows to generate, then to serve automatically Jekyll websites. This service, free and quite effective, brings together the best aspects of static websites – speed, reliability, security, ability to use git – while allowing their modification online. This article aims to show how to:…

Website delivery with Cloudfront

The main interest of static website is to be able to be stored in the cloud, that is to say on a content delivery network able to serve our data with amazing performances, a very low cost, and multiple benefits in terms of lightness, safety and reliability. This article sets out to show how to host a static website (wether built from a generator like Jekyll, Pelican or Hyde, or &ldquo;by…

Static website with Jekyll

At the beginning of the Internet, there were static sites: each web page was written &ldquo;by hand&rdquo; using a text editor, and then put online. The disadvantages are many, especially the need to duplicate the same changes on some pages (this is why it was sometimes really hard to maintain a website), to know HTML and to have his computer available to edit pages. The advent of CSS, which…

Spatial Data Analysis with R

If R language has already become a reference in statistical analysis and data processing, it may be thanks to its hability to represent and visualize data. They can be used in order to visualize spatial data in the form of cartographic representations which, combined with its other features, makes it an excellent geographic information system. This article sets out to show, through the provision…