Archive for December, 2018

Designing Well-Structured REST APIs with Flask-RestPlus: Part 1

December 11, 2018 Leave a comment

This is the first part of a two-part series. In this post, I will introduce Flask-RestPlus and demonstrate how to start organising APIs around its simple REST-based conventions. Next time, I will address the topic of request/response marshalling (serialisation) and validation.

Categories: python Tags:

5 Lessons Learned From Writing Over 300,000 Lines of Infrastructure Code

December 10, 2018 Leave a comment
Categories: Interesting

pip – ImportError: cannot import name main

December 7, 2018 Leave a comment

Getting above error when running pip

ubuntu@ubuntu-xenial:~$ pip install --upgrade pip
Collecting pip
  Downloading (1.3MB)
    100% |████████████████████████████████| 1.3MB 646kB/s 
Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

ubuntu@ubuntu-xenial:~$ pip install --upgrade pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main


ubuntu@ubuntu-xenial:~$ python -m pip install -U pip
Requirement already up-to-date: pip in ./.local/lib/python2.7/site-packages (18.1)


Categories: python

Invalid value for field ‘resource.disks[0].initializeParams.sourceImage’

December 6, 2018 Leave a comment

You ran (from

$ gcloud compute instances create workshop-test \
 --image-project coreos-cloud \
 --image coreos-stable-835-12-0-v20160202 \
 --boot-disk-size 200GB \
 --machine-type n1-standard-1 \
 --can-ip-forward \
 --scopes compute-rw

And get the following error

– Invalid value for field ‘resource.disks[0].initializeParams.sourceImage’: ‘;. The referenced image resource cannot be found.

The image being referenced does not exist. Get the list of images and pick the correct one.

$ gcloud compute images list --uri | less

$ gcloud compute instances create workshop-test \
 --image-project coreos-cloud \
 --image coreos-stable-1911-4-0-v20181127 \
 --boot-disk-size 200GB \
 --machine-type n1-standard-1 \
 --can-ip-forward \
 --scopes compute-rw
Created [].
workshop-test  us-central1-f  n1-standard-1       RUNNING


Categories: gcloud Tags: ,

Reinstalling minikube

December 5, 2018 Leave a comment

How to reinstall minikube


1. Stop it if it was running

$ minikube stop

2. Delete the VM in Virtualbox
3. Delete the .minikube folder

$ rm -rf ~/.minikube

4. Reinstall it if need be. Follow install instructions ->

Troubleshooting annoying issues with minikube

Categories: kubernetes Tags:

ALE (Asynchronous Lint Engine)

December 4, 2018 Leave a comment

ALE (Asynchronous Lint Engine) is a plugin for providing linting in NeoVim 0.2.0+ and Vim 8 while you edit your text files, and acts as a Vim Language Server Protocol client.

ALE makes use of NeoVim and Vim 8 job control functions and timers to run linters on the contents of text buffers and return errors as text is changed in Vim. This allows for displaying warnings and errors in files being edited in Vim before files have been saved back to a filesystem.

In other words, this plugin allows you to lint while you type.

Categories: vim Tags: ,

How can I change the author name / email of a commit?

December 3, 2018 Leave a comment

I needed to change the email address for multiple commits.

Followed the steps under this section in the source.

Using Interactive Rebase

Interactive Rebase is the Swiss Army Knife of tools in Git: it allows you to do and change almost anything. However, being as powerful as it is, this also means you can very easily shoot yourself in the foot. Use it with care (and possibly read up on it)!


Categories: git, Interesting Tags: