Author Archive

Elixir: in the shell, create a helper function called cls() to clear the screen easily

April 16, 2022 Leave a comment


Elixir has an interactive shell, similar to Python’s. Unfortunately Ctrl+L doesn’t work (clear screen), but there’s a helper function available called clear . However, it’s too long to type. When I reach the bottom of the screen, I always clear the screen but typing “clear” tons of times a day is a big no-no for me. What about a custom function called cls ? I could live with that.


It’s not that easy :) I described the problem here: . In short: you can write a function called cls() but you must put it inside a module. But when you start the shell, you can’t autoimport it, thus you should import the module manually, which means too much typing again.

But, there’s a solution! See here: .

Here I sum up the steps. I put the necessary files on GitHub, you can find them here.

  • copy the folder .iex to your home folder
  • enter ~/.iex and compile the module:
    $ elixirc my_helpers.ex
    (where $ is the prompt)
  • copy the file .iex.exs to your home folder
  • add this alias to your ~/.bashrc file:
    alias iex='iex -pa ~/.iex'

Now open a new terminal and launch the Elixir shell (iex). Try the command cls ; it should work.

Categories: elixir Tags: , ,

Create a desktop icon under Ubuntu

March 3, 2022 Leave a comment


There is no easy way to add a launcher icon to the desktop under Ubuntu. A long time ago it was possible: right click on the desktop, create launcher, etc. But then they removed this feature. Why? No idea. So now if you want to create a launcher, you need to do it manually. If you are lucky, you already have an icon on the Desktop and you can make a copy of it. But it’s still painful and stupid.


It annoyed me so much that I wrote a simple script for this. It’s available here: .


  • put the script into the folder ~/Desktop
  • enter ~/Desktop and launch the script
  • answer three simple questions and the script will create a launcher for you
  • a launcher icon will appear on the Desktop
  • right click on the icon, allow launching, and you are done

This is a joke that one needs to write a script to accomplish such a simple task…

Microsoft Edge for Linux

February 25, 2022 Leave a comment

I’ve been using Firefox since version 3.0. That version came out in 2008. I tried some other browsers too, but I always missed something and went back to Firefox. But in Firefox there is nothing new. A new version is exactly like the previous. And it’s not super fast, to say the least.

A friend of mine said he was using Edge and he liked it. So a few days ago I checked if it existed under Linux. And guess what: it does :) I downloaded it, tried it and I like it so far. It’s like a breath of fresh air after Firefox. It’s fast, looks good, and it has a modern feeling.

There’s a high chance that Edge will become my primary browser.

Update (20220402):

I’ve been using Edge for more than a month on all my machines and it’s really great. I’ll stick to it.

On my home machine I had a problem with it. After an update, it got very slow and unresponsive, but doing a “reset settings” (you can find it under the Settings) brought it back to normal.

Categories: linux, windows Tags: , ,

Suspend your machine at a given time

February 6, 2022 Leave a comment


When going to bed, you leave your machine on because it’s working (e.g. rendering) and you need the result by morning, but you know it’ll finish in 2 hours. How to set your machine to suspend itself at a given time? Instead of a complete shutdown, you just want to suspend your machine.


Let’s say it’s 1am and you want to suspend the machine in 2 hours.

$ at 3am
warning: commands will be executed using /bin/sh
at Sun Feb  6 03:00:00 2022
at> systemctl suspend  
at> <EOT>
job 4 at Sun Feb  6 03:00:00 2022

After specifying the command(s) to be executed (here “systemctl suspend”), press Ctrl+d (“<EOT>” means this).


It’s a good idea to try “systemctl suspend” first in the command line manually to see if it works.

If you get this error:

Can't open /run/ to signal atd. No atd running?

Then atd (the daemon process) is not running. Enable and start it:

$ systemctl enable atd
$ systemctl start atd
Categories: linux Tags: ,

Useful modern Unix commands

January 15, 2022 Leave a comment
  • HTTPie (http command, similar to wget and curl)
  • bat (a fancy cat)
  • ncdu (similar to du)
  • htop (a fancy top)
  • fd (similar to find)
  • exa (similar to ls)
  • duf (similar to df)
  • tldr (like man)

For more info, see here: .

I’ve been using bat and htop for years.

ncdu helped me identify some really huge hidden folders in my HOME directory. I moved some of them to an external drive.

Categories: linux Tags: , ,

How to convert a 1 page PDF to a 2 page per sheet PDF?

January 8, 2022 Leave a comment


You have a PDF and you want to print it. However, you want to print 2 pages on a sheet. How to transform the PDF?


This question was asked here. I like this answer: . In short: you can do it with Evince easily.

Categories: linux Tags: , ,

Tube Offline

January 2, 2022 Leave a comment


You want to download videos from various *tube sites.


Categories: Uncategorized Tags: ,

R Markdown installation for Windows

October 20, 2021 Leave a comment


You want to use R Markdown under Windows too. How to install it?

You also want to use Python codes in the .Rmd files. You also need VS Code support.


  • Download and install R: . If you have a 64-bit system, then select the 64-bit installation option (i.e., don’t install the 32-bit version). Default installation path: C:\Program Files\R\R-4.1.1 .
  • Add C:\Program Files\R\R-4.1.1\bin to the PATH.
  • Download and install RStudio Desktop: . Default installation path: C:\Program Files\RStudio .
  • Launch R Studio, and select File -> New File -> R Markdown. It’ll offer to install some required packages. Accept.
  • In the R console, issue the following command:
  • Now you should be able to render an .Rmd file to PDF inside R Studio.
  • Add C:\Program Files\RStudio\bin\pandoc to the PATH.
  • In the R console, install some packages:
  • For VS Code, install the extension “R” by Yuki Ueda.
  • Install Miniconda too ( ). Put it to C:\miniconda3 (the path cannot contain spaces).
  • Add c:\miniconda3 and c:\miniconda3\condabin to the PATH.
  • In the R console, issue the following commands:
    It should find your miniconda installation.
  • If you want to have the command “make”, follow these steps:
    • Visit and download the latest installer ( mingw-18.0.exe ). Install it to C:\MinGW .
    • Add C:\MinGW\bin to the PATH.

Here is a test document: . Now you should be able to render it both in VS Code, and by issuing the “make” command.


Categories: windows 10 Tags: ,

Show desktop

October 20, 2021 Leave a comment


Under Ubuntu, how to minimize all windows? That is, you want to see the desktop. Under Windows it’s Super + d. I want to use this very same shortcut, I don’t want to learn a new one.


I found the solution here. In short: go to Settings -> Keyboard Shortcuts. There, under Navigation, locate “Hide all normal windows”. Assign the desired shortcut to it. Done.

Categories: ubuntu Tags: , ,

[R Markdown] use inline Python code

October 18, 2021 Leave a comment


You want to use inline Python code in R Markdown. Example:

1 + 1 = `r 1+1`         # 1 + 1 = 2

1 + 1 = `python 1+1`    # 1 + 1 = python 1+1

As you can see, it only works with R :( What to do?


Python is not supported in inline code, but I have the following workaround solution:

```{r setup, include=FALSE}

```{python include=FALSE}
result = 1 + 1

1 + 1 = `r py$result`    # 1 + 1 = 2

py$result means: take the value of the Python variable called result.