Monthly Archives: November 2019

Compounding time-saving command-line tricks for Software Developers

First, find out what your most commonly used commands are, by running the below command.

history |  awk '{print $1}' | sort | uniq -c  | sort -nr | head -n 15

For me, it was the following.

    431 git
    122 ptw
    109 yarn
    100 sudo
     65 cd
     51 docker
     36 find
     34 rm
     31 pip
     31 ls
     23 cat
     20 pyenv
     20 kill
     16 gpg

To save time, over time. We can either try to remove commands or shorten the amount we need to type to execute them.

In my case, I added shell aliases for the following commands to shorten them.

g -> git
d -> docker
y -> yarn
f -> find

Sudo has to stay, but we can remove the need to have to keep typing in a password by taking the following steps.

  1. Type ‘sudo visudo
  2. In the file which opens in your editor, add the following line to the bottom, replacing ‘<your_username>’ with your system login username.

<your_username> ALL=(ALL) NOPASSWD: ALL

After this, you can type ‘sudo whatever command’ in a terminal without being prompted for the password.


That’s it. Although these changes seem minor, over time, you can save yourself a significant amount of time using these methods.

Do you have any tips to speed up your workflow and save time? If so, share them below!

One Python Development Setup to Rule Them All

Well, not quite. But here’s what I’ve settled on after working with Python constantly since 2012.

Virtualenv and Python version management

pyenv. I consider this the best as I can install and switch between any Python version (including conda) I like with ease. If you need this functionality and you’re not using pyenv, you’re missing out.

Installing Packages & managing their versions

I use pip. New tools have waded-in in recent years, but pip works for me and is still the most widely used tool.

Along with pip, I use requirements.txt (with fixed versions if it’s an application repo, supported version ranges if it’s a package/shared library project). I use requirements-dev.txt to hold development/test packages.

Releasing Packages

I use zest.releaser. This takes the pain out of releasing packages, automating the version number bumping, HISTORY updates, tagging etc.

IDE Setup

I use VSCode, because it’s fast and easy to use from day one.
I use an array of extensions. One, in particular, makes this choice a no brainer.

  • Settings Sync” this keeps your editor config in the ‘cloud’ meaning you can log in to any computer and sync that VSCode installation and you’re good to go in seconds.

I use the built-in terminal emulator within VSCode, along with Fish shell. I use Fish for its intelligent tab completion.

Testing

I use pytest for all Python unit and integration tests. It’s the industry standard right now and much better than the alternatives (nose, unittest).

To save a huge amount of time while doing TDD I use this tool avoid switching around my development environment.


That’s it, it’s quite boring but has stood the test of time. I hope this is useful to someone, if you have any suggested improvements please comment below, or Tweet me!