MySQL Survival Guide

Posted on Sat 28 September 2024 in misc

As I continue working with MySQL, I’ve come across a few quirks and issues that I wish I had known earlier. This blog post highlights some of the key lessons learned, and I will update it as I discover more interesting findings.

The Upsert Problem: Auto-Increment ID Gaps

When …


Continue reading

Django Architect Post Migrate Signal

Posted on Sun 05 September 2021 in misc

I just started to use architect to create a partition on PostgreSQL tables. To create a partition you either have to call the below command from a shell or call after a migration.

architect partition --module path.to.the.model.module

To create partition on tables I created an app …


Continue reading

FreeSWITCH Randomly Answer Calls

Posted on Thu 24 December 2020 in misc

I needed to answer calls randomly and came across the mod_expr module that is used to evaluate math functions. The below script generates a number between 1 and 4. It then checks if the generated number is greater than 2. If true, it answers the call and sends a random …


Continue reading

PostgreSQL Backup Encoding Fix

Posted on Tue 25 August 2020 in misc

Today I dumped some data from PostgreSQL's docker instance and when I try to restore it it brokes the data. After checking the dump's encoding via file command, figured out that dump file has UTF-16 encoding. When converting dump file encoding to utf-8 using iconv it worked.


Gevent Creating Progress Bar with TQDM

Posted on Thu 20 August 2020 in misc

tqdm is a library for showing progress bar on command line. Using it with gevent has problems. I managed to workaround with contextmanager and local . The example mocks a network request and process data with seperate Greenlet. We link these Greenlets to update tqdm instance so it can print progress …


Continue reading