Asim Ihsan's Meanderings

Hi, I’m Asim. I work as a software engineer.

Cache or Crash: Exploring the risks of using caching in distributed software systems

Discover the complexities of caching in distributed software systems as we explore both its benefits and potential risks. Learn from real-world examples and delve into best practices for implementing caching securely, without compromising availability.

Deterministic Encryption for Database Primary Keys

Explore the benefits of deterministic encryption for database keys, enhancing security while maintaining unique constraints. This post covers how it functions, compares to traditional methods, and offers practical tips for successful implementation.

Creating a Cost-Effective and Highly Available Chatbot with OpenAI, AWS, and Discord

This blog post discusses how to create a cost-effective and highly available chatbot with OpenAI, AWS, and Discord. It explains the advantages of using these three tools together, and the challenges involved in creating a chatbot. Solutions proposed in this article include using EC2 Spot Instances for cost-effective hosting and using distributed locking with leases to prevent duplicate work and handle faults, providing a cost-effective and reliable way to create a chatbot.

Formal modeling as a design tool

Alloy is a language and analyzer for formal software modeling. As a way of starting to learn Alloy I model a toy design that I know to be broken: Python pip’s legacy dependency resolution algorithm.

Healthy breathing with a smart bulb

Inhale 5 seconds, exhale 5 seconds. Research repeatedly demonstrates that this breathing pattern reduces anxiety, stress, high blood pressure, and insomnia, both during sessions and durably for months afterward. In this article I summarize research into breathing, and create an open-source tool that uses a smart bulb as a peripheral-vision breathing guide.

Using a native cryptography library in Flutter

Flutter is a Google UI toolkit for writing cross-platform mobile applications. Using native code from Flutter is now easier than ever by using the dart:ffi library that is currently in beta. In this article we demonstrate why you’d want to use native code, and a practical example of doing so using the libsodium cryptography library.

[DRAFT] Random Permutations With Constant Space

You want to iterate over a random ordering of items without storing or needing to lookup already-used items. We can borrow an algorithm from cryptography called the Feistel Network to generate random permutations in constant space and time. Applications include generating unique gift card codes or credit card numbers for your customers without exposing already-generated codes/numbers, and efficiently implementing the fizzlefade effect from Wolfenstein 3D.