Notes
The list is also available in chronological order.
Data-analysis
-
November 06, 2020
A quick tutorial on Miller
Recently I had to perform some analyses on a CSV file with a fairly complex format. I started with datamash, but I ended up using miller, because it performed considerably better on the input file I had, which had a tricky syntax. This page re ... [Read More]Category: data-analysis, Tags: emacs, sidebar
-
November 06, 2020
Tools to manipulate CSV files from the Command Line
Cleaning data and manually processing CSV files to make them readable to scripts and other applications is a tedious task. There are some nice tools to manipulate CSV files from the command line in Linux, which can ease some of the burden and even provide lightweight alternatives to R ... [Read More]Category: data-analysis, Tags: emacs, sidebar
-
August 21, 2020
Shifting and Diffing Columns in R's dataframe
Goal Goal of this post: showing how to shift and diff columns in R dataframes. Useful when you have absolute values in a data frame and you want to analyze variations. Setup For this tutorial we will use a data frame with the forecast temperature in Genoa for a week in August: ... [Read More]Category: data-analysis, Tags: emacs, sidebar
Covid
-
August 01, 2020
New Cases in Italy
Introduction This page focuses on new cases in Italy. This page was created on {{{date}}} and last updated on {{{modification-time(<%Y-%m-%d>)}}}. The source code available on the COVID-19 pages is distributed under the MIT License; the content is dis ... [Read More]Category: covid, Tags: R, org mode, literate programming, covid-19, ruby, datamash
-
August 20, 2020
COVID-19 Number of Tests in Italy
Introduction This page presents some data about the number of tests and people tested for COVID-19 over time in Italy and compares them with the number of people found positive. This page was created on {{{date}}} and last updated on {{{modification-time(<%Y-%m-%d>)}}}. The sour ... [Read More]Category: covid, Tags: R, org mode, literate programming, covid-19
-
March 28, 2020
Some Graphs about COVID-19 in Italy
Introduction This page contains various plots generated from that data using Org Mode and R: no fancy web services, just plain-old off-line generation. On top of being an interesting exercise on R and literate programming in Emacs, I use this page to get an idea of the evolution of th ... [Read More]Category: covid, Tags: R, org mode, literate programming, covid-19
-
August 20, 2020
Graphs and tables about COVID-19 in Italy
The Italian Civil Protection has a repository with data about COVID-19 in Italy on GitHub. In March 2020 I began using the repository to plot the evolution of the pandemic in Italy. It started as an exercise where I could use literate programming ... [Read More]Category: covid, Tags: covid-19
Webdev
-
August 28, 2020
Org Mode and Jekyll
I have always used static generators for my websites. At first the static generator was a text editor, then a dedicated app (Netscape HTML composer, iWeb, [[http://www.karelia.com/products/sandvox/ ... [Read More]Category: webdev, Tags: emacs, org mode, webdev, website
-
September 28, 2018
Making my website leaner
I decided to make my website a bit leaner, by reducing the size of its JavaScript and CSS assets. Here are the results of experimenting with two frameworks, Foundation and Spectre.css. Starting Point :PROPE ... [Read More]Category: webdev, Tags: webdev, foundation, spectre
-
November 11, 2015
Please Install ActiveRecord MySQL2 Adapter
I recently got this error on a Rails 3 application I am working on: % rake assets:precompile RAILS_ENV=production rake aborted! LoadError: Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (can’t activate mysql2 (~> 0.3.10), already activated mysql2-0.4 ... [Read More]Category: webdev, Tags: mysql, rails, webdev
-
October 30, 2014
Switching from Jekyll to Middleman
Remark (2020-03-19). My homepage underwent various framework changes. In retrospective and in most cases, the migrations have been motivated more by an intellectual challenge, rather than a technical limit of the technology being replaced. As the date of writing I am using [[ ... [Read More]Category: webdev, Tags: jekyll, middleman, website, webdev
-
April 10, 2020
Jekyll and ZURB Foundation
I use Jekyll and ZURB Foundation quite often, the most recent occasion being the new version of the website of BringTheFood. Adding ZURB to a Jekyll website is rather simple, but it requires to setup a few ... [Read More]Category: webdev, Tags: jekyll, zurb foundation, website, webdev
-
July 04, 2016
Page Titles in Rails Apps
Giving meaningful titles to the views of your Rails Application is a nice touch you can easily add to your Rails application. The most popular approach on StackOverflow seems to be that of defining a @title variable in the controller, which can then be u ... [Read More]Category: webdev, Tags: rails, webdev
-
November 07, 2018
Quick Development of Web apps in Ruby on Rails
Resources related to the webinar hosted by ITMPI on Nov 6, 2018. Link to the webinar: https://www.itmpi.org/Recordings/adolfo-villafiorita About Ruby and Ruby-on-Rails: Ruby On Rails, material, documentation, and information about Ruby on Ra ... [Read More]Category: webdev, Tags: seminar, webdev
-
June 16, 2014
Using Symbolic Names for Localhost Ports
A simple solution to a micro-problem. The micro-problem: when testing applications running on different ports on localhost, URL completion on the browser is ineffective. In fact, there will be different completions of “localhost”, such as localhost:3000, localhost:4000, =localhost:808 ... [Read More]Category: webdev, Tags: webdev, admin
-
February 14, 2021
Liquid tips and tricks
Liquid is a templating language developed by the people at Shopify and used extensively. I happen to use it every now and then on the websites we develop with Jekyll and this is a list of tips a ... [Read More]Category: webdev, Tags: jekyll, javascript, css, webdev
-
September 29, 2018
Asset Bundling from the Command Line
The original version has been slightly edited in <2020-05-19 Tue> to improve readability. Web Assets Management Asset Bundling. Performances of Web applications and Websites can be improved by bundling assets. Roughly ... [Read More]Category: webdev, Tags: jekyll, javascript, css, webdev
Emacsconf-2020
-
November 28, 2020
Moving from Jekyll to OrgMode
Moving From Jekyll to Org Mode An experience report Adolfo Villafiorita mailto:adolfo@shair.tech Shair.Tech https://shair.tech DataScientia Education https://datascientia.education/cl-2020 Static Website Generators ... [Read More]Category: emacsconf-2020, Tags:
-
November 28, 2020
Moving from Jekyll to OrgMode
Moving From Jekyll to Org Mode An experience report Adolfo Villafiorita mailto:adolfo@shair.tech Shair.Tech https://shair.tech DataScientia Education https://datascientia.education/cl-2020 Static Website Generators ... [Read More]Category: emacsconf-2020, Tags:
-
October 23, 2020
Static Websites Management Functions
Introduction These functions complement org-mode publishing features by adding a local preview and a deploy function using rsync: website-server-start (and corresponding stop function) website-deploy Projects managed with these functions need to be declared in a a ... [Read More]Category: emacsconf-2020, Tags:
-
November 28, 2020
EmacsConf 2020
Here you can find some resources related to my talk at EmacsConf 2020, “Moving from Jekyll to Org Mode”: Link to the page on the EmacsConf Wiki: Moving from Jekyll to OrgMode, an experience report The slides of the talk as a single page [[ ... [Read More]Category: emacsconf-2020, Tags: emacs, emacsconf, emacs lisp, org mode
Emacs
-
August 03, 2020
Multi-file Search and Replace in Emacs
Emacs can perform multi-file search and replace in a variety of ways. This is a simple way to do it: Get a Dired-like listing of the files to perform the search on, using one of these commands: find-name-dired, which searches for all the files matching a **pattern** fro ... [Read More]Category: emacs, Tags: emacs, dired
-
October 28, 2018
Yankpad
Note: the original content of this post has been edited on <2020-06-04 Thu>. Text snippets can help write code and test faster and, over time, I started appreciating and using Yasnippet. A few days ago I came across [[https://github.com ... [Read More]Category: emacs, Tags: emacs, org mode
-
November 16, 2014
Directory and Project Browsers
A rather common feature of many IDEs and text editors is a file system or project browser, typically shown on the left of the editor. Emacs provides various options to implement this feature. Here I recap the ones I am aware of. My choices: Dired, which I mainly use for file syste ... [Read More]Category: emacs, Tags: emacs, sidebar
-
June 02, 2020
Literate Programming Examples from my Website
I have become rather interested in literate programming, which I find a very interesting and elegant approach. Literate programming was first proposed by Donald Knuth and it is support ... [Read More]Category: emacs, Tags: emacs, org mode, literate programming
-
December 27, 2014
Reading IMAP email in Emacs
Introduction This post summarizes how to use Emacs to read and send email from distinct IMAP accounts. The solution is based on the following tools: mbsync, mu, [[http://www.djcbsoftware.nl/code/mu/mu4e.html][ ... [Read More]Category: emacs, Tags: imap, mu4e, offlineimap, mbsync
-
April 06, 2016
Grep in Emacs
M-x grep in Emacs is a great command and I use it quite often. Most of the time, however, I need to explicitly specify -r and I am never sure what directory grep will start searching from. Functions and packages, such as rgrep and igrep, help mitigate these nuisances, but I cann ... [Read More]Category: emacs, Tags: emacs
-
May 27, 2020
Linking my HTML pages and their Org Mode sources
If you have tinkered with Org Mode, you know you can control the information which appears in the footer using two variables: org-html-postamble (show the footer?) and org-html-postamble-format (how does the footer look like?) [fn:1]. Customizing the postambl ... [Read More]Category: emacs, Tags: literate programming, org mode
-
September 28, 2014
Ruby Source Code in Org Mode
Enable execution of ruby code in Org Mode files with the following require in your .emacs file: (require ‘ob-ruby) You can then insert ruby code in your org file using the following tags: a = 2 + 3 b = 10 * 2 [a + b, a] Evaluate with ... [Read More]Category: emacs, Tags: emacs, org mode, ruby, literate programming
-
March 21, 2021
Emacs Color Theme Switcher
I recently started using color theme modern, in place of custom themes, because color themes can be undone more easily—see [[https://www.emacswiki.org/emacs/CustomThemes#ComparedToColorT ... [Read More]Category: emacs, Tags: emacs, emacs lisp, org mode
-
January 04, 2015
Emacs and Caldav
This post summarizes my attempts to manage my CalDAV based calendars in Emacs. Managing your Calendar/Diary in Emacs Emacs has three main packages for managing a diary: Diary Mode ships with Emacs and allows one to manage an agenda sto ... [Read More]Category: emacs, Tags: emacs, caldav, org mode
-
May 28, 2020
Plotting a Histogram with Gnuplot
Brief (?) tutorial on creating histograms with Org Mode and Gnuplot. We start with a table with some random data. YearBooks BorrowedBooks BoughtBooks Sold 20128102 2013 ... [Read More]Category: emacs, Tags: org mode, gnuplot, literate programming
-
March 04, 2020
Emacs Server: GUI or Terminal?
Emacs can also be run as a server, with some advantages: editing sessions open faster and all edits take place in the same instance. There are different ways to start an Emacs server. From Emacs, with M-x server-start or by putting the following code in the init file (e.g., .emacs): ... [Read More]Category: emacs, Tags: emacs
-
April 28, 2016
Restoring Keybindings changed by a Major Mode
The Markdown major mode in Emacs binds M-<right> and M-<left> to markdown-demote and markdown-promote, respectively. On a Mac keyboard, the key combinations above correspond to “Option” + right/left arrow. A more “natural” binding of these keys, in my opinion, is forward and backw ... [Read More]Category: emacs, Tags: emacs, emacs-init-file
Admin
-
March 18, 2020
A bit of history here, a bit of history there!
This is not a post about the virtues of studying history, but, rather, a post about how to improve history management in Bash and in the Interactive Ruby Shell. Bash If you have multiple ... [Read More]Category: admin, Tags: bash, ruby
-
June 18, 2020
Quote Entire Message in Replies with Thunderbird
Thunderbird quotes the selected text when replying to a message. The behavior, however, can be changed by setting mailnews.reply_quoting_selection.multi_word to false. Quoting the chosen solution from https://support.mozilla.org/en-US/questions/1002362: *Tools > Options > Adva ... [Read More]Category: admin, Tags: Thunderbird, email, configuration
-
September 28, 2020
Convert Video Files using ffmpeg
This is a command I use to reduce the size of the video lessons we make available on the Computational Logic website. for file in *.mp4; do ffmpeg -i $file -vf “scale=iw/2:ih/2” $(basename $file “.mp4”)-small.mp4; done The command converts ... [Read More]Category: admin, Tags: video, ffmeg, teaching
-
July 04, 2015
Determining the URL of CalDAV Calendars
Apple Calendars Go to your ~/Library/Calendars folder. You will find a bunch of ID.caldav directories: each of these folders correspond to a calendar (or a set of of calendars) and contains either another directory or an Info.plist file. The Info.plist file store ... [Read More]Category: admin, Tags: caldav
-
October 05, 2020
Quickly Switch Screen Resolution in Gnome
During the lockdow I started using my laptop’s screen, rather than the external monitor I have at work. It wasn’t easy at the beginning, but it ended up becoming a habit. On a 15” monitor screen estate is precious, but HiDPI resolutions are tiring for the eye. Thus I started switching re ... [Read More]Category: admin, Tags: admin, linux, gnome
-
June 24, 2020
Inconsistent cursor size on HiDPI screens
In X each application can set its own cursor. This can cause the cursor size to differ from window to window, which can be annoying. To solve the issue, set the cursor size by adding gtk-cursor-theme-size=n to .config/gtk-3.0/settings.ini. Solution found here: [[https://unix.stackexc ... [Read More]Category: admin, Tags: configuration, linux
-
March 18, 2020
Change Activity Overview Keybinding in Gnome
Pressing the Super key in Gnome invokes the Overview, which shows all open windows in the current Workspace. While very nice at times, it can also be rather inconvenient, if you press it by mistake, like I do quite often. There are, fortunately, various ways of changing the default keybind ... [Read More]Category: admin, Tags: gnome
-
September 05, 2020
Systemd as a Cron replacement
Despite its very simple and effective syntax, installing new tasks in cron can be tricky. In fact: Cron tasks run in an environment different from that available in an interactive shell and a script running ok in a terminal might fail when installed as a cron job. As a consequ ... [Read More]Category: admin, Tags: linux, systemd, cron
-
December 12, 2020
Secret Tool Explained
secret-tool allows to access Gnome keyring from the command line. This is a good option to store and retrieve password, for intance if you are using offlineimap or isync to retrieve email, but the syntax is kind of awkward and things get more confused if you use Seahorse to store or ... [Read More]Category: admin, Tags: admin, linux, mbsync
-
June 25, 2020
Show progress of dd
Transferring an ISO image using dd can require quite some time and I am left wondering how long it will take to complete, since dd is silent, by default, and no information is shown. There are two simple solutions to remedy the situation. Instructing dd to show progress before it ... [Read More]Category: admin, Tags: linux, dd
-
July 07, 2020
Running an Inferior Ruby/Rails Shell in Emacs
Here is a list of tips and tricks to get started and work efficiently with the IRB shell in Emacs. Problem with the IRB prompt Even though this I tried this tip with Ruby 2.7 and Emacs 27, it seems to be relevant with other versions of Emacs as well. The tip, while it ma ... [Read More]Category: admin, Tags: rails, org mode, irb
-
July 16, 2014
Change OSX Terminal Settings from Command Line
Changing fonts and colors should be easy, also with terminals. Alas, neither iTerm2 nor OSX Terminal seem to have an easy way of doing this: you need to define a new profile or change some presets of the current profile. This is often an overkill. Various solutions exists on the Internet, t ... [Read More]Category: admin, Tags: cli
-
November 09, 2014
Color your Bash Prompt
How to color the Bash prompt To color the Bash prompt, you can set the PS1 variable (primary prompt) to something like: export PS1=”\[\033[38;5;COLOR_CODEm\]PROMPT\[\033[39m\] ” where COLOR_CODE is an integer specifying a color PROMPT is what you want to show on the pr ... [Read More]Category: admin, Tags: bash, cli
-
June 13, 2020
Disable IR Camera on Lenovo ThinkPad
The T580 ThinkPad I use comes with an infrared camera, which, on my Arch installation, is also the default camera, which is kind of annoying, since I always have to switch to the standard camera before starting any video conference. A small, but annoying step. Today I came across the [[htt ... [Read More]Category: admin, Tags: linux
-
April 12, 2014
Switching to NGINX
Last Friday I switched the web server running on my Mac Mini (MacOS) from Apache to Nginx. The main motivations for moving to Nginx, in my case, are: Nginx is faster at serving static content Configuration is simpler Nginx can ... [Read More]Category: admin, Tags: webdev, admin
-
January 13, 2021
The Right DPI
TL;DR Do not assume X11 is using the correct DPI for your screen. If your fonts look blurry and ugly, X11 might be using the wrong DPI value. I recently installed ArchLinux on my brand new Lenovo T590. (Second Thinkpad in a row and I couldn’t be happier with the choice.) The new co ... [Read More]Category: admin, Tags: x11, linux
-
June 25, 2020
Make bootable USB stick
To make a bootable USB stick of a Linux distro: Download an ISO image of your preferred Linux distro Insert the USB key and unmount it Copy IMG to USB key using dd (see instructions below) Using dd on Linux Find out the name of your USB drive with lsblk. Make sure that i ... [Read More]Category: admin, Tags: linux, dd
-
December 10, 2014
Format using FAT-16 in OSX
The Columbus V-900 logger requires a MicroCard formatted using the MS-DOS FAT16 format. The OSX Diskutil application, however, does not allow to specify this format. The task can be achieved using the CLI, however. Quoting from [[http://www.spotwise.com/2008/10/27/partition-usb-disk-with- ... [Read More]Category: admin, Tags: gps logging, osx, admin