Using better CLIs

For people who spend half of their lives in a terminal user experience and functionality is highly important; making you a happier person
10 October

Here are some very good alternatives to some default command line applications.


My full setup includes all the stuff discussed in this article and even more



When working with open-source (and Github) projects frequently sometimes git is not enough. So, Github created a tool called hub.

It allows to fetch from remote forks, browse issues, and create pull requests with ease!

# Open the current project's issues page
$ git browse -- issues
  → open

# Fetch from multiple forks, even if they don't yet exist as remotes:
$ git fetch user1,fork2

# Browse issues:
$ git browse -- issues
  → open

# Create a pull request:
$ git pull-request -F


Let's face it. git log sucks. It allows browsing commits history, but when you want to look inside a specific commit for its changesets or tree structure, well ... You will have to memorize all these commands or use a lot of external plugins.

tig solves it all. Firstly, it allows to browse commits history. Then you can dive inside! Browse changesets, file trees, blames, and even blobs!

tig code example
tig code example


postgres (and mysql too!)

When working with postgres we have to use psql. And it is quite good. It has history, some basic autocomplete and commands that are easy to remember. But, there is a better tool called pgcli.

pgcli example


  • smart autocomplete
  • syntax highlighting
  • pretty prints of tabular data

It also has a version for mysql called mycli.

By the way, yesterday a new 10th version of postgres was released.


System monitoring is a common task for every developer. Standard tools like top and htop are fine and trusted software. But look at this beauty, glances:

glances example
glances example

glances has a lot of plugins to monitor almost everything.

It also has a web interface and a pre-build docker-container to integrate it easily. My top list of plugins:

  • docker
  • gpu (very useful for miners and coins-folks!)
  • bottle (web-interface)
  • netifaces (IPs)

Create your own if you want to!


curl and wget are well-known and widely used. But are they user-friendly? I don't think so. httpie is user-friendly and can do everything these tools can

httpie example
httpie example

And even more. I don't regret a single minute using it instead of curl.


jq is like sed for json. It is useful in automation, configuration reading, and making requests.

You can try it online.


Sometimes you have to do something live: a screencast, a gif, a talk. But everything can go wrong. You can make a typo, or misspell a word. That's where doitlive comes to the rescue.

Just create a file called with command that needs to be executed and then run:

doitlive play

Now you are a command line magician.


I do a lot of python development. So, here are my tools to make it better.


pipsi = pip Script Installer. It creates a virtualenv for every script and symlinks it into your /usr/local/bin. So it won't pollute your global environment.


pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world.

pipenv example
pipenv example

The problems that Pipenv seeks to solve are multi-faceted:

  • You no longer need to use pip and virtualenv separately. They work together.
  • Managing a requirements.txt file can be problematic, so Pipenv uses the upcoming Pipfile and Pipfile.lock instead, which is superior for basic use cases.
  • Hashes are used everywhere, always. Security. Automatically expose security vulnerabilities.
  • Give you insight into your dependency graph (e.g. $ pipenv graph).
  • Streamline development workflow by loading .env files.


ipython = Interactive python.

ipython brings autocomplete, nice history, and multiline editing to the python shell. It integrates into django and flask nicely without any configuration.
It is a must for all of my projects. If you like it, also check out jupyter.

Author - Sobolev Nikita, sobolevn

Why tuples use less space in memory than lists in Python?

Small tutorial on basic classes in Python with code examples 
17 October

Let's create a Python tuple:

>>> a = (1,2,3)
>>> a.__sizeof__()

and list

>>> b = [1,2,3]
>>> b.__sizeof__()

Tuple will use less memory than list. Let's figure out why.

 lists are variable-sized while tuples are fixed-size.

So tuples can store the elements directly inside the struct, lists on the other hand need a layer of indirection (it stores a pointer to the elements). This layer of indirection is a pointer, on 64bit systems that's 64bit, hence 8bytes.

But there's another thing that lists do: They over-allocate. Otherwise list.append would be an O(n) operation always - to make it amortized O(1) (much faster) it over-allocates. But now it has to keep track of the allocated size and the filled size (tuples only need to store one size, because allocated and filled size are always identical). That means each list has to store another "size" which on 64bit systems is a 64bit integer, again 8 bytes.

So lists need at least 16 bytes more memory than tuples. Because of the over-allocation. Over-allocation means it allocates more space than needed. However, the amount of over-allocation depends on "how" you create the list and the append/deletion history:

>>> l = [1,2,3]
>>> l.__sizeof__()
>>> l.append(4)  # triggers re-allocation (with over-allocation), because the original list is full
>>> l.__sizeof__()

>>> l = []
>>> l.__sizeof__()
>>> l.append(1)  # re-allocation with over-allocation
>>> l.__sizeof__()
>>> l.append(2)  # no re-alloc
>>> l.append(3)  # no re-alloc
>>> l.__sizeof__()
>>> l.append(4)  # still has room, so no over-allocation needed (yet)
>>> l.__sizeof__()

Some handy links on this topic:

  • tuple struct
  • list struct