Archive

Archive for May, 2016

[mc] switch between horizontal and vertical panels

Problem
In Midnight Commander it can happen that a filename is too long and thus it is truncated. But still, you would like to see the complete filename.

Solution
switch from vertical to horizontal layout with Alt + ,

drawing trees / graphs easily

Problem
You want to draw a binary tree / graph quickly. You’ve already used graphviz but you forgot its DOT language and you don’t want to read its documentation again. What do you do?

Solution
I found a nice Python project that does exactly this: pygraph.

Command to execute:

$ pygraph -u -e neato circle ab bc cd de ea

Output (circle.png):
circle

See the project’s page for more examples and figures.

I sent a request to the author and he was kind to implement the --dot option that prints the .dot source in a file. This way you can easily tweak your graph. Don’t write the .dot file from scratch: do it quickly with pygraph, get a basic source, and refine it manually if necessary.

Categories: python Tags: , , ,

compile and try a Go project on GitHub

Problem
I found an interesting Go project on GitHub (https://github.com/ichinaski/pxl) that I wanted to try. How to compile it?

(This project “pxl” can display images in the terminal).

Solution

GOBIN=$(pwd) GOPATH=/tmp/gobuild go get github.com/ichinaski/pxl

Under Manjaro I had to install the package “gc”, which contains the official Go compiler.

Categories: bash Tags: , ,

redis: list all the keys

Problem
You want to list all the keys in your Redis database. Or, you want to list just some of them.

Solution
See the documentation here. Example:

$ redis-cli
127.0.0.1:6379> KEYS jabba*
1) "jabba:cnt1"
2) "jabba:cnt2"
127.0.0.1:6379> KEYS *
1) "jabba:cnt1"
2) "jabba:cnt2"
3) "others:counter"
Categories: bash Tags: ,

How to update a GitHub forked repository?

Categories: Uncategorized Tags: , , ,

Upgrade from Ubuntu 14.04 to 16.04

On my laptop I upgraded my Ubuntu to 16.04 but after the restart I didn’t get the graphical interface. The booting stopped and I found myself in a maintenance shell. I also got messages about some hard disk errors.

Well, I also have Windows 8.1 on this laptop and the Windows didn’t do a complete shutdown. Windows 8 does some tricky shutdown to boost the booting process, so it does some kind of half-hibernation. When I used Ubuntu 14.04, I got a message that one partition couldn’t be mounted, “press S to skip”. And I upgraded to 16.04 like this. And this unmountable partition caused this trouble.

So the solution was the following: start Windows 8.1, disable that shitty “fast startup” (see this post for more info), and restart Ubuntu. This time Ubuntu 16.04 booted normally.

Update (20160526)
I upgraded two more machines, there were no real problems. Libreoffice didn’t want to start on one of them, it dropped a “General I/O” error. Here is the cure:

$ sudo apt-get remove --purge libreoffice*
$ sudo apt install libreoffice

It’s a good idea to use “apt” instead of “apt-get”. It does the same thing but in addition you get a nice progress bar.

MongoDB stopped too. Here is how to start it with systemctl:

$ sudo systemctl enable mongodb
$ sudo systemctl start mongodb
# verification:
$ systemctl status mongodb
$ mongo

how to install Neovim under Ubuntu

Problem
Under Manjaro I installed neovim with yaourt. It installed version 0.1.4 and it works fine. For Ubuntu, the home page of Neovim suggests a PPA but it installed for me the version 0.1.5-dev, which is a development version.

How to install a specific version under Ubuntu (namely 0.1.4 in this case)?

Solution
Visit https://github.com/neovim/neovim and find the tagged version 0.1.4. Download the zip, uncompress it, and enter the project folder.

Install the dependencies:

$ sudo apt-get install libtool autoconf automake cmake libncurses5-dev g++

Build and install the project:

$ make cmake
$ make test
$ sudo make install

It’s a good idea to install the “neovim” Python package too:

$ sudo pip2 install neovim
$ sudo pip3 install neovim

Tips taken from here.

Categories: ubuntu, vim Tags: , , ,