PostgreSQL: Understanding Deadlock
Many might have seen PostgreSQL issue the following error message: “ERROR: deadlock detected”. But what does it really mean? How can we prevent a deadlock and how can we reproduce the problem? Let’s dive into PostgreSQL locking and understand what deadlock and deadlock_timeout really mean.
How does a mutex work? What does it cost?
Concurrent programming requires synchronization. We can’t have more than one thread accessing data at the same time; otherwise, we end up with a data race.
The most common solution is to wrap the critical data access in a mutex.
When misused, it can cause a program to run worse in threaded mode than it would have single threaded!
Basics of Futexes
Now we know about mutex, then how about futexes, which are popup sometime especially when you are working with strace.
Futex mechanism was proposed by Linux contributors from IBM in 2002 ; it was integrated into the kernel in late 2003. The main idea is to enable a more efficient way for userspace code to synchronize multiple threads, with minimal kernel involvement.
Hosting SQLite databases on Github Pages
(or any static file hoster). So how do you use a database on a static file hoster? Firstly, SQLite (written in C) is compiled to WebAssembly. SQLite can be compiled with emscripten without any modifications, and the sql.js library is a thin JS wrapper around the wasm code.
It also leverage HTTP Range header, which we cover in issue #196
CSRF, CORS, and HTTP Security headers Demystified
With an increasing number of breaches, intrusions, and data thefts, securing a web application is extremely important.
On the other hand, programmers often do not have a strong grasp of how attacks work and how to mitigate them. This post attempts to close that gap a little.
Attacking JSON Web Tokens (JWTs)
JWT is gaining popularity due to its convenience use to hold information without issuing an auth storage. Naturally, it has a lot of attacking vectors. Let’s learn about those attacks so we can use JWT securely
Practical SQL for Data Analysis
The post target data scientist to use SQL instead of analyze data with Panda.
But we can see how thing are done in raw SQL to extract information out of SQL database
Running and Cumulative Aggregation, one of topic in this article can be quite useful to analyze the growth or trend.
Film simulations from scratch using Python
Back in old day, we take picture use film in camera. To create different look of image, we used a different film.
Modern mirrorless cameras from Fujifilm have film simulation presets that digitally mimic the style of a particular film stock.
So how these simulations were achieved? A good post to learn about image maniupulation, vector
css tips and tricks
We don’t usually include article that just show code without technical deep dive but this has some useful ones so we include it here
Code to read
a pure Python from-scratch zero-dependency implementation of Bitcoin for educational purposes.
Verify email via Regex, DNS, SMTP, MX blacklist. A useful way to fightbox and ensure no typo on email.
Fast high-level web crawling Ruby framework
a single-pass compiler for a tiny subset of the Go programming language – just enough to compile itself. It outputs (very naive) x86-64 assembly, and supports just enough of the language to implement a Mugo compiler.
Convert images to computer generated art using delaunay triangulation. Kind of a fun code to read about image manipulation
Highly Configurable Terminal Dashboard for Developers and Creators
Run SQL queries on your Terraform infrastructure. Query resources and analyze its configuration using a SQL-powered framework.
steps you through the local branches of a repo one at a time, outputting the following information about each: last commit, last author etc then you can select to delete them. Useful to cleanup when you hacked a lot on a repo.
Open-source vector similarity search for Postgres
Fast, modern, easy-to-use network scanner. If you use nc, nmap a lot, absolutely give this a try.
Open source Firebase + Heroku to develop, scale and secure serverless apps on Kubernetes
That's it for this round, have a great day! If you like this newsletter, please tell the world, or
tweet about this