Hippocamplus My Second Memory

OS/Internet

Misc tools

DuckDuckGo

DuckDuckGo is a “search engine that doesn’t track you”. It provides nice “bangs” to search directly specific websites. By making DDG the default search engine these bangs can be used directly in the address bar.

  • !pub PubMed.
  • !scholar Google Scholar.
  • !bioc Bioconductor.
  • !so Stack Overflow.
  • !git GitHub.
  • !w Wikipedia.
  • !syn synonyms from thesaurus.com.
  • !tz Time Zone, time in other places.
  • !dgi DuckDuckGo Images.
  • !i Google Images.
  • !imd IMDb.
  • !marmiton Marmiton.
  • !map Google Maps.
  • !wref/wrfe Word Reference English to French (et vice versa).
  • !gtfr Google Translate to French.
  • !gten Google Translate to English.

Ubuntu

I’m using Ubuntu Gnome 16.04.

  • I followed some of the steps there to install essential packages.
  • To enable the use of my existing DSA SSH keys I did:

echo "PubkeyAcceptedKeyTypes +ssh-dss" >> ~/.ssh/config

  • To force the second screen to follow the workspace of the primary screen I found this:

gsettings set org.gnome.shell.overrides workspaces-only-on-primary false

Update expired keys

Sometimes apt-get update doesn’t work because keys have expired (e.g. The following signatures were invalid: EXPKEYSIG XXX). To update a key:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys XXX

(French) Accents in Gnome Ubuntu

I use the international layout with dead keys:

Settings -> Region & Language -> Input Sources -> + -> English (United States) -> English (intl., with AltGr dead keys)

An accented letter can be “spelled out” with, for example, AltGr+Super+' e. Some accented letters can be inserted directly with AltGr, e.g. AltGr+e. Inspired by this post, I modified the default accented letters to use grave/circumflex accents and cedilla. In /usr/share/X11/xkb/symbols/us I added to the xkb_symbols “altgr-intl” section:

   key <AD04> { [ r, R, egrave,       Egrave      ] };
   key <AD05> { [ t, T, ecircumflex,  Ecircumflex ] };
   key <AD02> { [ w, W, ediaeresis,   Ediaeresis  ] };
   key <AD06> { [ y, Y, ucircumflex,  Ucircumflex ] };
   key <AD07> { [ u, U, ugrave,       Ugrave      ] };
   key <AD08> { [ i, I, icircumflex,  Icircumflex ] };
   key <AD09> { [ o, O, ocircumflex,  Ocircumflex ] };
   key <AC01> { [ a, A, agrave,       Agrave      ] };
   key <AC02> { [ s, S, acircumflex,  Acircumflex ] };
   key <AB03> { [ c, C, ccedilla,     Ccedilla    ] };

Change the CTRL-. binding in Ubuntu 22.04

It calls a way to add emojis. I’ve changed it to use SUPER instead, as it was messing with my emacs keybindings. The configuration windows can be accessed by running ibus-setup.

Install a specific/older R version

R updated automatically once and I didn’t want to re-install all the packages, so I temporarily switched back to the previous version with:

sudo apt install r-base-core=4.0.5-1.2004.0
sudo apt install r-recommended=4.0.5-1.2004.0
sudo apt install r-base=4.0.5-1.2004.0

The available versions were listed using sudo apt list -a r-base-core

Sync a specific folder on Ubuntu

On the cloud

I use Nextcloud which offers a free tier with 2 Gb (for most providers). It also has an Ubuntu software and Android app that can sync a specific folder. I use it to synchronize the articles I read and annotate between my tablet and computer(s) (see the “Zotero” section below).

  1. Sign up for a free 2Gb server at https://nextcloud.com/sign-up/ (for example The Good Cloud)
  2. Download the AppImage for Ubuntu from https://nextcloud.com/install/
    • An AppImage is some kind of binary: make it executable using chmod +x and place in your PATH.
  3. When logging in to the Nexcloud app, there is an option to select exactly which folder(s) to sync.
  4. On the tablet, use the Nexcloud Android App from F-Droid or Google Play.
    • Note: the app is buggy on my tablet. An alternative solution is FolderSync which is slow (checks all the files!) but works. Another “alternative” is to sync directly using Syncthing (see below)

Sync in real time with Syncthing

Syncthing can be easily setup to synchronize specific folders. It needs to be running on all the devices but it’s fast and avoids using a cloud hosting service.

On Ubuntu, I run it using Docker with:

docker run --network=host -v `pwd`:/var/syncthing --hostname=my-syncthing syncthing/syncthing:latest

The GUI can then be openened in the browser, by default at http://127.0.0.1:8384/.

The Syncthing Androids app is available on F-Droid and Google Play.

[DEPRECATED?] Before: sync a specific Google Drive folder on Ubuntu

This might not work anymore. Last time I tried to use it, I was confused by an error and ended up switching to Nextcloud (see above).

I use grive and followed these instructions.

To install:

sudo apt-add-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install grive

To configure in a directory DIR, syncing the Drive folder “ArticlesPDF”:

cd DIR
grive -a -s ArticlesPDF

In the future just sync by running the following command (in the DIR folder):

grive -s ArticlesPDF

I usually try with the --dry-run option first because there are some glitches sometimes.

Since very recently (~Nov 2019) another step is necessary:

  1. Create a API key on https://console.developers.google.com/apis/library following those instructions.
  2. Run with grive -s zotero-library --id "<ID.apps.googleusercontent.com>" --secret "<SECRET>" (eventually add -a to configure).

Zotero

Mostly following this blog post.

In the general settings of Zotero I also specify the Google Drive folder as base directory and swich off the Sync full-text content.

Then using the Zotfile plugins to make sure the PDF files are consistent between computers. The configuration I use is:

  • Pointing at the folder synced with the Cloud (see below), with subfolders by authors /%a.
  • Changing to lower case and replacing blanks in file names.

For the Better BibTeX plugin, the most important setting is the citation key style: [auth:lower][year][journal:lower:abbr].

I still haven’t found a perfect way to synchronize my library with my Android tablet. Currently, I store the PDFs on Nextcloud (2 Gb free tier, see above), and then:

  1. Annotate the PDFs with Xodo.
  2. Synchronize the PDFs with:
    • When it doesn’t crash (which is rare), the Nextcloud app on Android is fast and ideal.
    • When I don’t have my computer around, the fallback app ias FolderSync which can be set up for Nextcloud. It works but takes a lot of time (>20m) checking each PDF.
    • When I have my computer around, I launch Syncthing on both for a much faster process (see above).
  3. Browse the library using ZotDroid, or Library (to search my library’s BibTeX file which is synced with the PDFs). None of those work that well. I organize my reading list in Orgmode so I don’t usually need this anyway.

Work in progress. I might realize that this was a bad idea later.

[DEPRECATED] Before: sync PDFs between Mendeley and Google Drive

Before switching to Zotero, I used Mendeley. I was still syncing my annotated PDFs between my tablet and computer. I had described this approach in this post.

Dowload files from Dropbox

By replacing https://www.dropbox.com with https://dl.dropboxusercontent.com in the link, a file can be dowloaded using command lines tools (e.g. wget or download.file in R). It’s useful to host files that are used in scripts, like some of the post I made using R-Markdown.

Originally it was useful to “serve” HTML pages but it doesn’t work anymore.

Record a webradio stream with VLC

VLC doc

vlc -vvv http://hazel.torontocast.com:2220/stream --sout=file/ogg:classical.ogg