Elixir

Optimizing DateTime Serialization in Elixir

Optimizing DateTime Serialization in Elixir

The Journey of Optimization

A deep dive into optimizing Elixir’s Calendar module, improving datetime serialization performance through iodata and improper lists

Recently, I watched some Elixir vs Go comparison videos on YouTube. After the first comparison, José Valim made a PR to make the comparison more accurate. One key difference was that the Elixir version used Ecto and serialized datetime multiple times, while the Go version used raw SQL and single datetime serialization.

Read More
Pseudolocalization in Phoenix with gettext_pseudolocalize

Pseudolocalization in Phoenix with gettext_pseudolocalize

Understanding Gettext in Elixir Applications

Gettext is a widely adopted internationalization (i18n) system that helps developers make their applications available in multiple languages. Originally developed for GNU projects, it has become a standard solution across many programming languages and frameworks, including Elixir and Phoenix.

Read More
Enhancements to dbg in Elixir 1.18

Enhancements to dbg in Elixir 1.18

Elixir 1.18 added some interesting features, but one that went under the radar was extended support for dbg. In 1.17 when you had this code:

Read More
SQL Commenter with Postgrex

SQL Commenter with Postgrex

A few years ago, I discovered sqlcommenter, a tool that enables adding trace context to SQL queries. This feature makes it possible to match database calls visible in PostgreSQL logs or any observability tool. At the time, I found several questions about this topic scattered across the internet, but no concrete solutions. I attempted to solve this myself and experimented with various approaches, but none of them proved viable for implementation in Elixir, particularly with Ecto.

Read More
Running Livebook as a Systemd Service for Your User

Running Livebook as a Systemd Service for Your User

Livebook is a powerful tool for creating and sharing interactive notebooks with Elixir. To make it even more convenient, you can set it up to run as a systemd service for your user. This ensures that Livebook starts automatically whenever you log in, and runs in the background without requiring root permissions. Here’s a step-by-step guide to help you get started.

Read More
Livebook on Steam Deck

Livebook on Steam Deck

This post may be updated in the future.

Steam deck is a modern machine. I wanted to test how long it takes to generate images using stable diffusion on it. Thanks to livebook this becomes trivial. The biggest problem is to install the package. I did it using ssh but it can also be done directly on deck.

Read More
Reverse Engineer Unknown Data Format Using Elixir

Reverse Engineer Unknown Data Format Using Elixir

I recently worked on porting the csv file converter for AdventureWorks database from ruby to elixir. This ended successful and I have all the data in my local postgresql to play with. By browsing the tables I found spatial_location column in person.address table and I wanted to decode it.

Read More
TIL: Non Standard Postgres Types in Livebook

TIL: Non Standard Postgres Types in Livebook

Livebook has a new, nice feature that allows you to connect to a database. It works with basic data types.

Read More
Show Country Emoji with Elixir

Show Country Emoji with Elixir

Recently jorik posted about converting country code to flag emoji. I decided to give it a try in elixir.

Read More
Porting Files Generated by Phoenix to Surface

Porting Files Generated by Phoenix to Surface

This post is intended to get you started with surface provided components. I provided the original code and surface versions so you can compare the differences yourself without installing anything.

Read More
Serving Open Street Map Vector Tiles with Elixir and Phoenix

Serving Open Street Map Vector Tiles with Elixir and Phoenix

Some background on mbtiles files from mapbox/mbtiles-spec

MBTiles is a specification for storing tiled map data in SQLite databases for immediate usage and for transfer. … The metadata table is used as a key/value store for settings. It MUST contain these two rows:

Read More
Nginx Logs in Live Dashboard

Nginx Logs in Live Dashboard

Building on top of my previous blog posts on creating a nginx log parser and displaying ps output in live dashboard I decided to build a nginx log display.

Read More
Parse Nginx Access Log with Nimble Parsec

Parse Nginx Access Log with Nimble Parsec

Lately I played with some string parsing and found nimble_parsec a library which does the job perfect. I will show you how to convert nginx logs to something readable in elixir. A typical log line looks like:

Read More
Phoenix Live Dashboard Custom Page

Phoenix Live Dashboard Custom Page

Today I played with custom live dashboard pages, That’s a short documentation how to use it. We will implement a page that shows the currently running system processes on the box running our elixir system.

Read More