Blog / Tech

How to reset the primary key sequence in PostgreSQL with Django

March 19, 2019

I was working on some fairly big features involving new Django models for one of our apps and when I pushed to our staging environment, I got this error during deployment at the database migration step:

duplicate key value violates unique constraint "auth_permission_pkey" DETAIL: Key (id)=(55) already exists

It looks like new records were getting added to the auth_permission table. I was puzzled as I didn't make any changes related to the Django auth app. …

Django 2.1 SameSite cookie issue with Safari 12

February 16, 2019

We just ran into this issue two days ago as we've recently upgraded the Django version for one of our Shopify apps to version 2.1.

We had a user tried to use the app and he kept getting redirected to the login page during the OAuth flow. He then tried it on Chrome and it worked fine so we narrowed down the issue to his web browser, which was Safari, specifically version 12 of Safari …

The Best Books I Read in 2018

February 3, 2019

I was just going through some of the highlights I made on my Kindle to reflect on some lessons and insights I've learned from a bunch of books I read last year and thought I should write a blog post about the best ones.

Below are 6 of the best books I read in 2018. Many of these I'd probably come back to again in the future.

1. The Internet of Money Vol. 1 & …

Flameshot: An awesome screenshot capture tool for Linux

December 24, 2018

When it comes to screen capture and other media editing tools, Linux really falls behind in terms of good options out there compared to Windows and Mac.

For a long time I've been using the default "Screenshot" tool that comes with Ubuntu. While it works fine, it does require quite a bit of additional steps if you need to annotate the image as you have to save it first then use another tool to add …

How to resume download over SSH using "rsync"

October 30, 2018

This is one of those "note to self" again.

I needed to download big file (close to 6GB) from a remote server last night but the Internet connection at my AirBnB was a bit spotty and would drop periodically.

Normally, I'd just use scp and even 6GB of data is no big deal on a fast and stable connection. But with a slow or unstable connection, I needed a way to resume the download.

The …