In my 20 years of experience in software industry, I have met two kinds of programmers. Although they all call themselves software engineers or programmers, they exhibit very different behaviors and ways of thinking when it comes to programming.

I call the first kind “coders”, and the second kind “hackers”.

How do “coders” think and behave?

Coders put a lot of emphasis on “the code”. When I’m talking to them, I can clearly see that they think the code is 80% of what matters when it comes to building software.

  • They tend to be very strict about coding style. “Absolutely no lines can be longer than 120 characters.” …


I can’t believe Google Cloud still to provide a convenient method to generate signed object url in their Python library, a task that is so common that AWS has built into their Python client for many years. Even Azure, which I have not been too impressed with, provides a convenient method in their Python client library.

It took me two painful hours to figure this out. The code below doesn’t do MD5 digest. Hopefully it’s not too hard to add should you need to.

def _sign_gcp_blob_url(verb, obj_path, content_type, expiration):
from oauth2client.service_account import ServiceAccountCredentials
import base64
from six.moves.urllib.parse import urlencode, quote
GCS_API_ENDPOINT = '
expiration_in_epoch = int(expiration.timestamp())
signature_string = ('{verb}\n'
'{content_md5}\n'
'{content_type}\n'
'{expiration}\n'
'{resource}')
signature = signature_string.format(verb=verb,
content_md5='',
content_type='',
expiration=expiration_in_epoch,
resource=obj_path)
creds = ServiceAccountCredentials.from_json_keyfile_name(settings.GOOGLE_APPLICATION_CREDENTIALS)
signature = creds.sign_blob(signature)[1]
encoded_signature = base64.b64encode(signature)
base_url= GCS_API_ENDPOINT + obj_path
storage_account_id = creds.service_account_email …


Since we live in 2019, not 1999, your users probably expect to login with email, as opposed to assigning themselves a user name that looks like “kennthji2018348”. They probably also want to just login to your app with their Google or Facebook account.

Well, if you are stuck with using Django, you’d be probably surprised to learn this is not how Django thinks. What’s worse, it’s actually not easy to configure Django to behave this way. As a starter, you actually have to be intimately familiar with Django internals to make username an optional field in auth_user model.

Fret no more. This blogpost serves as a one-stop-shop to make your Django user login look more appropriate for 2019, not 1999. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store