Installing Powerline in Ubuntu 18.04

Powerline is a “statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, fish, tmux, IPython, Awesome, i3 and Qtile”. It looks this cool (this is the most simply form):

Poweline for Bash

 

In combination with ZSH, it becomes an extremely powerful -and beautiful- tool.

To quickly install just Powerline for the bash:

sudo apt install powerline powerline-fonts

Add the following at the end of ~/.bashrc:

# Powerline
if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
  powerline-daemon -q
  POWERLINE_BASH_CONTINUATION=1
  POWERLINE_BASH_SELECT=1
  source /usr/share/powerline/bindings/bash/powerline.sh
fi

Sorting the fonts:

mkdir -p ~/.fonts
wget https://github.com/powerline/fonts/raw/master/LiberationMono/Literation%20Mono%20Powerline.ttf -O ~/.fonts/Liberation\ Mono\ Powerline.ttf
wget https://github.com/powerline/fonts/raw/master/LiberationMono/Literation%20Mono%20Powerline%20Bold.ttf -O ~/.fonts/Liberation\ Mono\ Powerline\ Bold.ttf
wget https://github.com/powerline/fonts/raw/master/LiberationMono/Literation%20Mono%20Powerline%20Italic.ttf -O ~/.fonts/Liberation\ Mono\ Powerline\ Italic.ttf
wget https://github.com/powerline/fonts/raw/master/LiberationMono/Literation%20Mono%20Powerline%20Bold%20Italic.ttf -O ~/.fonts/Liberation\ Mono\ Powerline\ Bold\ Italic.ttf
fc-cache -vf ~/.fonts

Now, reload the terminal:

source ~/.basrc

Done!

Column-navigation file manager

Pantheon File Explorer

If you want a file manager with column navigation (macOS-alike) in linux, Pantheon File Manager is probably the best option. Pantheon File Manager is part of the Pantheon desktop, developed for elementary OS using Vala and the GTK3 toolkit. In Ubuntu and derivatives (e.g. Linux Mint) it’s as easy to install as:

sudo add-apt-repository ppa:elementary-os/stable
sudo apt update
sudo apt install pantheon-files

Done! You just need to search the app called ‘Files’ to launch it. It also displays a message asking if you want to make it the default file browser.

Dealing with PPA and GPG problems in Ubuntu and derivatives

PPAs are extremely useful, making installing and maintaining apps in Ubuntu and derivatives (such as Linux Mint) extremely easy. However, upgrading the system or problems/changes in the maintainer of the PPA can turn things into a pain the neck. Y PPA Manager is a tool from Web UPD8 designed specifically to keep all this under control in a easy way.

Some of the functions are:

  • List the packages available in a PPA added on your system
  • Download packages from PPAs without adding them
  • PPAs backup / restore, along with all the PPA keys
  • Update single repositories using a command line tool (by the way, when you add a PPA using Y PPA Manager, it’s updated without updating all the software sources) called “update-ppa” – usage example: “sudo update-ppa ppa:webupd8team/java”
  • Some options that should help you re-enable the working PPAs when upgrading to a newer Ubuntu / Linux Mint version
  • Remove duplicate PPAs
  • Unity quicklists / optional AppIndicator

Installing Y PPA Manager is as easy as copy and pasting the next lines:

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt update
sudo apt install y-ppa-manager

If you are having problems with expired GPG keys:

We know that feeling. The maintainer of a repository changes something and suddenly we start having problems with the GPG Keys. In my case, this happens -too frequently, under my point of view- with QGIS. Luckily we can fix invalid GPG keys with a single-line command:

sudo apt-key list | \
 grep "expired: " | \
 sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | \
 xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys

Command explanation:

  • sudo apt-key list Lists all keys installed in the system.
  • grep “expired: “ Leaves only lines with expired keys.
  • sed -ne ‘s|pub .*/\([^ ]*\) .*|\1|gp’ Extracts keys.
  • xargs -n1 sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys Updates the expired keys with those found in the Ubuntu key server.

Sources:

http://www.webupd8.org/2016/03/y-ppa-manager-updated-with-important.html

https://stackoverflow.com/a/46737148/3866828

Fix and prevent Windows continuously changing UEFI order

Having a dual-boot machine with Windows 8 or Windows 10 and Linux is frustrating, because Windows changes continuously the UEFI booting order, thus preventing GRUB to load. This usually happens after an update.

This command executed from Windows’ Command Prompt (as an administrator) seems to fix the problem for Ubuntu and derivatives:

bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

For other distros, you will need to identify first which .efi file is needed to boot. More information about the commands available for bcdedit is available in the Window’s IT center‘s website.

MEAN.JS and the CRUD Module Sub-Generator

MEAN.JS still needs to pulish a few things. For example, the compatibility with NODE 7.x. But a part from that, there is the CRUD Module Sub-Generator, which fails to properly add entries to the menu, and it is something that should be working out of the box.

Basically, you can use this generator for automatically creating the files needed for a CRUD interaction, but if you choose to add an entry to the menu… The website stops working and the only thing you can see is a blank page.

I was able to find more people with the same problem, for example:

  • https://groups.google.com/forum/#!searchin/meanjs/yo$20meanjs$3Acrud-module|sort:relevance/meanjs/wKavBQOCZvw/0-dlYj6hCLMJ
  • https://github.com/meanjs/mean/issues/347

But just when I was about to delete the project and find an alternative to MEAN.JS, I found the solution to the problem:

in client\config\customers.client.config.js reemplace this line:

menuConfig.$inject = [‘menuService’];

with this:

menuConfig.$inject = [‘Menus’];

Thanks StackOverflow!

Fix Telegram not showing accents in elementary OS

Diving in the Internet I found some answers, mainly related with IBus. However, it seems like they are not working with elementary OS 0.4 Loki.

The workaround is simple, just edit the file of the launcher corresponding to Telegram:

nano .local/share/applications/telegramdesktop.desktop

and change this line:

Exec=/home/YOUR-USER/Downloads/Telegram/Telegram -- %u

to look like this other one:

Exec=env QT_IM_MODULE=xim /home/YOUR-USER/Downloads/Telegram/Telegram -- %u

That should do the trick. But maybe you need to install a couple of IBus dependencies first? Just in case:

sudo apt install ibus-gtk ibus-gtk3 ibus-qt4

15 awesome Sublime Text plugins for web development

http://tutorialzine.com/2016/10/15-awesome-sublime-text-plugins-for-web-development/

Computer Science and visually impaired people

One day, they tell you that you have cancer. Your life changes. Then, while fighting against it, you go blind. In just 24 hours you can’t see almost anything. However, that’s not stopping you to reach your dreams. This is the story of my friend Rafael Cantos, and in this article he tells us how he, a person with a huge visual impairment, manages to code. Because he, a person that managed to have a title in Computer Sciences, and a masters in the same field, even dealing with a huge visual impairment, is discovering how the real challenge lays in overcoming prejudices.

The article is in Spanish, but Google Translator can help you with that.

Command line, human-readable, disk usage analyser

ncdu

It happens continuously. We have a server with no graphical interface, and our disk quota is gone in God knows what.

We could use different commands to identify the source of the problem, roll perception checks, roll will checks… Or we can use NCurses Disk Usage. Beautifully simple, it fulfils more than correctly this task.

Easy to install:

sudo apt install ncdu

And easy to use:

ncdu

Piece of cake.

Run Mongo from a docker

MongoDB Logo

To create the container:

docker run --name mongo -v /home/core/mongo-files/data:/data/db -v /home/core/mongo-files:/opt/keyfile --hostname="node1.example.com" -p 27017:27017 -d mongo:2.6.5 --smallfiles

(remember to change 2.6.5 with the version you want to use)

To run the container:

docker start mongo

For accessing Mongo terminal:

docker exec -it [NameOfTheContainer] mongo

Therefore, in this case:

docker exec -it mongo mongo

More information here and in the official Docker image documentation. This script example is also interesting.