Although something like Flask’s globally accessible
Continue reading Flask-like “global” request context in Sanic (asyncio)
request object is considered a terrible way of writing code (explicit is better than implicit), sometimes it makes sense to use it. For example, while passing a Correlation-ID to track a request’s life cycle through your micro-services.
pyenv can get particularly annoying during building Python. Dependencies are often missing resulting in failed builds. This short blog post is outlining the required dependencies to reduce headaches for future me, and anyone else reading this.
Continue reading pyenv build depencies on Ubuntu
While working with OpenCV, constantly popping up a new Window to view the results might not be the most effective way of work. However, we can minimize the burden if we are working on Jupyter Notebook; with matplotlib. Essentially we plot the matrices with
Continue reading Viewing OpenCV matrices with matplotlib (w/ Jupyter Notebook)
Bangladeshi NID and Smart Cards come printed with a 2D Datamatrix Barcode, known as PDF417. The information on the cards can be extracted without using an OCR solution through the barcode. We’ll be using Google’s ZXing library; learn about the basics of using it. Continue reading Reading Bangladeshi NID and Smart Cards with ZXing
A coin’s faces are marked with 0 and 1. What is the probability of scoring K 1s in N tosses?
Continue reading Probability of Coin Tosses and Pascal’s Triangle
Doctests are essentially tests embedded in a docstring. They serve both as example use cases and test cases! A Python expression is provided along with an expected outcome, a test runner collects that and evaluates the expression. Continue reading Beginners’ Guide to Effortless Doctests in Python
Profiling is imperative to understand your application. However, getting started with profiling might seem to be a steep learning curve; but it doesn’t have to be! IPython has a lot of built-in magic commands, and some of them are helpful to profile your Python code. %timeit and %prun are among the ones I found most useful. Continue reading Simple Python Profiling with IPython
Your application probably does not need to execute some code each time it is used. We have been caching for decades; reducing database queries, using key-value stores, OPcode caching and the list runs on. Things become overwhelming. I believe often we can find the best answers in simplicity; complexity should not be introduced where a simple solution can help. Continue reading Mitigating High-Traffic with Simple Static Content Generation
We all use HTTP, develop for HTTP and think that we know HTTP. But, I believe as engineers we should never take things for granted; rather we should dissect everything that comes before us, recursively as many times as possible. So, let’s keep applying this principle for HTTP. Continue reading Learn you some HTTP for fun and glory
Often keeping multiple versions of Erlang or Elixir on the same machine might become necessary; also it helps to have the latest versions on your machine as soon as they are released. An amazing tool
asdf is capable of doing just that. It makes things as easy as,
asdf install erlang 20.3.2
asdf install elixir 1.6.4
asdf global elixir 20.3.2
asdf global elixir 1.6.4
Continue reading Erlang and Elixir: Managing Multiple versions with asdf