How I boost my development environment to focus on task at hand

Written by crazydiv | Published 2017/09/04
Tech Story Tags: productivity | self-improvement | time-management | tech | data-science

TLDRvia the TL;DR App

As a developer, I find manual software installations, typing long command in shells repetitively , endless Alt+Tabs to switch between one application to another, typing username & password every-time on localhost forms to be an extra baggage which comes in the way of actually doing things.

This article is an attempt to consolidate a variety of productivity tools, tips and shortcuts I’ve read from sources like HackerNews, StackExchange, AskUbuntu and other productivity related blog posts. Most will have probably seen most of these, but I’m glad if someone discovers something new and useful.

This list contains a couple of external links, which could be referred to for details, in-depth usage and tricks.

These are a couple of tools and tricks which I use daily, on my Lenovo Z-50 Ubuntu 16.04 and sometimes on a MacBook, working on Python for a majority of the time. However, most of it could be applied/transformed to a generic experience as well.

Switch less, Type less, DO more

Not that I have anything much against redundancy. But I said that already.

Terminal

One of the first few things I realised early on was that using default terminal of Ubuntu is causing me to do a lot of tab-switching when a lot of terminal tabs and windows are opened and it’d take extra time for me to reach the correct one. After experimenting with terminals, I ended up using guake. It is a drop-down terminal which I bind to shortcut (Ctrl+~ is a hot-key I’m comfortable with). It supports named tabs (so that you don’t rm -rf on production, confusing it with other instance :P) and customizable startup script to load your entire project and tail logs in a single shot.

Guake worked well for most of the cases, until last year, I had to work on a project which needed me to run htop, watch file size and tail logs on 3–4 different machines. While Guake is available at the press of a key, I still have to switch tabs within.

So, on my second screen, I ended up using terminator. It supports multiple terminals in a single window, custom layouts, broadcasting each keystroke to multiple terminals. Preserving the layout means, simply by opening terminator with dev/staging configuration, I can load everything I need & don’t have to ssh into multiple windows and run commands manually.

On both Guake & Terminator, I use zsh + oh-my-zsh, a powerful shell which supports a variety of plugins and shortcuts.

Typos

To overcome typos in terminals, one day I accidentally landed on thefuck. It also is available as a oh-my-zsh plugin (press Esc twice for those who feel uncomfortable using the F-word). If you feel over-confident like I do, you can configure it with with require_confirmation:False setting to stop asking for confirmation. :)

Git-hooks

While committing, sometimes I have to attach the commit to Asana or Trello ticket and also sometimes I need to add detailed description (apart from the commit message), to start a discussion on Asana/Trello. Git’s support of post-commit-hooks allow to post the commit message and an extra paragraph of discussion right from my command line to Asana.

Aliases

I keep defining a lot of aliases to create a shortcut to practically any set of bash commands. To me, one powerful use-case is that they reduce the chances of typos in a long command or a command chain( And swearing(#thefuck) doesn’t help much in correcting long chains :P ). A couple of aliases sourced in my ~/.zshrc for example:

# To check the contents of a key in redis, I don't need to# login to 'redis-cli -a XXX' > 'select db 13' > 'get mykey'# 1. I can simply type 'mykey' from shell.# 2. Makes it easier to set 'watch -n 10 mykey' on terminator splitalias mykey='echo "select 13\nget mykey" | redis-cli -a $MY_REDIS_PASSWORD'

# Whenever I load my redis-cli I directly load with db 12, instead# of writing 'select 12' or typing password every-timealias rcli='redis-cli -a $MY_REDIS_PASSWORD -n 12'alias mcli='mongo -u test -p $MY_MONGO_PASSWORD my_db--authenticationDatabase admin'

alias rs='python manage.py runserver'alias sp='python manage.py shell_plus'alias pthn='ps axf| grep python'alias ga='git add 'alias gs='git status'alias gc='git commit -m '

# Don't ask :(alias xkill="kill -9 $(ps axf | grep 'celery' | awk '{print $1}')"

# SSH aliases, to avoid confusion in IP Addresses & pem filesalias my_dev_web='ssh -i /home/ubuntu/pem/api-web.pem ubuntu@XXX.XXX.XXX.XXX'

Keyboard Shortcuts

Ubuntu allows to configure custom keyboard shortcuts. Sometimes, when frustrated, I do use my Ctrl+Alt+Del override to execute commands like ‘restart-supervisor && flush-redis’ to restart my Django server, all the Celery queues and flush all the existing data in queues, all in the background. Note that this also supports aliases like my custom defined function flush-redis.

Browser

I sometimes feel that filling out the same login credentials and forms while testing is a guilty pleasure. Autofill and FormFiller help take some of the pain away. Creating collections with a proper environment setup (within Postman) can lead to super-productivity in testing out APIs.

For more advanced tinkering and automation, I ended up using Tampermonkey scripts.

Avoid distractions, declutter and organise

I try to use two different browsers to separate office work from personal. Vivaldi is one browser I’m trying out these days and it looks very promising. It supports a lot of features like an inbuilt notepad, tab preview & grouping etc.

Tab preview in vivaldi

For most of the time however I use the all-magnificent Chrome and load it with a couple of extensions.

Avoid distractions

Save to Pocket: In combination with Pocket, resist the temptation to read those HackerNews discussions and articles right-away and save them for a later read.

Block-site: or any other site-blocker to block anything non work-related like “facebook.com”, “gmail.com”, “whatsapp.com”. If needed, I open them in second browser.

Declutter

OneTab: Declutter all open tabs by combining them into a single tab, which can also be exported. Instead of sifting through over a 100 opened tabs, simply onetab them and de-clutter on a daily/weekly basis.

Bookmark Manager: Offered by google, a material design upgrade to the standard bookmark manager.

Organise

Be Limitless: Besides awesome backgrounds on new-tab, it tracks time spent across different categories of websites(customizable). Also comes with a notepad and a todo-list.

Evernote Web Clipper: If you don’t use Evernote already, now would be a great time to start. This web-clipper not only helps save articles/snippets but also runs a private search inside Evernote and displays results every time you do a google search. Any command/snippet for which I search stackoverflow the second time, I clip it to Evernote.

Consistent library installations

Docker is an open platform for developing, shipping, and running applications. It can be rather intimidating to start with, but the effort sure does pay-off.

While docker has very broad uses, one of the primary advantage is ensuring that all the team-members and production env have the exact same tech-stack and environment. I must stress on how important this is, because many a times I myself have turned to stackoverflow to quickly fix a library install error on a new test/staging setup, only to later realise that the library dependency did get installed but with a different version, causing problems.

Docker hub contains ready-made images for stacks like ELK, Kafka cluster to Tensorflow. I’d recommend searching on docker hub before prototyping something for a side-project/hackathon. Although after proof-of-concept, do take it with a pinch of salt and get confident before building on top of an existing image or starting it’s usage in production mode.

Another use case is cluster deployment using docker+swarm. Even though there are better alternatives available (debatable), using swarm provides a quick and less-messy way to deploy the application cluster, saving a lot of time in manual/semi-automated installations on different machines.

That’s it! I hope you found this article useful. If you have other cool tool/tricks up your sleeve, please do share it in the comments. After all it’s a never-ending quest and all the excitement lies in trying things out and then deciding what suits you best. :)

Thank you very much for your time. And, until next time, have a great day!


Published by HackerNoon on 2017/09/04