<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Posts on 3manuek</title><link>https://tr3s.ma/posts/</link><description>Recent content in Posts on 3manuek</description><language>en-us</language><lastBuildDate>Fri, 19 Dec 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://tr3s.ma/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>Upgrading Postgres Major, and Django model with Logical Replication.</title><link>https://tr3s.ma/posts/2025-11/pgmajorupgradedjango/</link><pubDate>Sat, 15 Nov 2025 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2025-11/pgmajorupgradedjango/</guid><description>&lt;h1 id="the-story"&gt;The story&lt;/h1&gt;
&lt;p&gt;A customer needed to upgrade their Aurora RDS Postgres from v13 to v16 due to &lt;strong&gt;v13&amp;rsquo;s EOL&lt;/strong&gt;. This is a common requirement, and so far, a straightforward process.
The complexity arose when they needed to upgrade their application model, which was taking a long time to run due that most of the tables required a full rewrite.&lt;/p&gt;
&lt;p&gt;The Django migration was taking several hours to run, which made a blue/green upgrade and subsequent migration execution unfeasible due to the long downtime it would incur.&lt;/p&gt;</description></item><item><title>Online Backups with no archives in PGBackRest</title><link>https://tr3s.ma/posts/2025-09/noarchive/</link><pubDate>Sun, 28 Sep 2025 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2025-09/noarchive/</guid><description>&lt;p&gt;Even tho is not documented in the official documentation, it is possible to avoid storing archives on PGBackRest setups. In certain scenarios, you may want to disregard storing archives for reducing costs, specially if you are using cloud storage for your backups.&lt;/p&gt;
&lt;p&gt;Those situations could be:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tests environments, whether you run intensive tests but you don&amp;rsquo;t need or care about PITR (Point in Time Recovery).
&lt;ul&gt;
&lt;li&gt;Also, you want to test your backup configuration rather than just having logical dumps in test environments.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Highly updated Postgres databases, where you can recover changes by other means, such as scrapping or restoring from external sources.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="notice warning"&gt;
&lt;span class="notice-emoji"&gt;
⚠️
&amp;nbsp;
&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;Not storing archives may lead you to &lt;code&gt;data loss&lt;/code&gt; if you don&amp;rsquo;t have a proper strategy for handling the deltas.&lt;/li&gt;
&lt;li&gt;You still need to store archives &lt;em&gt;during backup execution&lt;/em&gt; if you want &lt;em&gt;online&lt;/em&gt; backups. Otherwise, they won&amp;rsquo;t be recoverable.&lt;/li&gt;
&lt;li&gt;If you don&amp;rsquo;t want to store archives at all, you need to run backup &lt;code&gt;offline&lt;/code&gt;. That is, stopping your instance and executing &lt;code&gt;pgbackrest backup&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h2 id="configuration"&gt;Configuration&lt;/h2&gt;
&lt;p&gt;Configuration on your &lt;code&gt;postgresql.conf&lt;/code&gt;:&lt;/p&gt;</description></item><item><title>Evaluating PGCat's Sharding by hash</title><link>https://tr3s.ma/posts/2025-01/pgcat/</link><pubDate>Sun, 09 Mar 2025 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2025-01/pgcat/</guid><description>&lt;div class="notice info"&gt;
&lt;span class="notice-emoji"&gt;
ℹ️
&amp;nbsp;
&lt;/span&gt;
PGCat&amp;rsquo;s sharding feature is currently experimental. The code for the laboratory can be found at &lt;strong&gt;&lt;a href="https://github.com/3manuek/lab_pgcat" target="_blank"&gt;lab_pgcat&lt;/a&gt;.&lt;/strong&gt;
&lt;/div&gt;
&lt;h2 id="pgcat-sharding-mechanisms"&gt;&lt;a href="https://github.com/postgresml/pgcat" target="_blank"&gt;PGCat&lt;/a&gt; sharding mechanisms&lt;/h2&gt;
&lt;p&gt;As of today, PGCat supports 2 mechanisms of sharding through extended syntax:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;By setting the shard explicitly: &lt;code&gt;SET SHARD TO '&amp;lt;index&amp;gt;';&lt;/code&gt;, which allows you to do &lt;em&gt;deterministic sharding&lt;/em&gt;, whether you choose
your shard according to a rule, such a lookup, region, customer&amp;rsquo;s group, etc.
This is great if you have one of those well delimited or an even distribution. But, still a nice approach and kind scalable.
We won&amp;rsquo;t be focusing on this strategy in this post, as its implementation relies on custom requirements.&lt;/li&gt;
&lt;li&gt;Setting &lt;code&gt;sharding_function&lt;/code&gt; to use one of the available functions: &lt;code&gt;pg_bigint_hash&lt;/code&gt; and &lt;code&gt;sha1&lt;/code&gt;. The extended syntax &lt;code&gt;SET SHARDING KEY TO '&amp;lt;value&amp;gt;';&lt;/code&gt; will calculate the index. Not very clear from docs how &lt;code&gt;sha1&lt;/code&gt; function is used, so this post will focus on &lt;code&gt;pg_bigint_hash&lt;/code&gt; case.
Shard by hash is a bold strategy, particularly if you expect to have a large workload, and you need to have enough compute across all shards.
This extended syntax can be done through comments, see &lt;a href="https://github.com/postgresml/pgcat?tab=readme-ov-file#sharding" target="_blank"&gt;pgcat Sharding documentation&lt;/a&gt;.
In this laboratory, we&amp;rsquo;ll focus on the &lt;code&gt;pg_bigint_hash&lt;/code&gt; function. It is not clear from PGCat&amp;rsquo;s documentation how &lt;code&gt;sha1&lt;/code&gt; should be implemented, by I&amp;rsquo;ll extend the laboratory to cover it &amp;ndash; that is, if I overcome my &lt;em&gt;skill issues&lt;/em&gt; :P .&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At this point, you may be aware of the complexities of implementing sharding, and what limitations we expect from the hashing approach.
Keep in mind that this PGCat feature is tied to the Postgres partition, based on the same &lt;a href="https://github.com/postgres/postgres/blob/27b77ecf9f4d5be211900eda54d8155ada50d696/src/include/catalog/partition.h#L20" target="_blank"&gt;HASH_PARTITION_SEED&lt;/a&gt;.
See also &lt;a href="https://github.com/postgresml/pgcat/blob/main/src/sharding.rs#L6" target="_blank"&gt;pgcat hash seed&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>[BabelfishPG] Enabling Statements Execution Time logging and Plans</title><link>https://tr3s.ma/posts/2024-10/babelfishpg_slowqueries/</link><pubDate>Fri, 25 Oct 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2024-10/babelfishpg_slowqueries/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;div class="notice info"&gt;
&lt;span class="notice-emoji"&gt;
ℹ️
&amp;nbsp;
&lt;/span&gt;
Laboratory for this post can be found at &lt;a href="https://github.com/Plataform3/babelfishpg-lab" target="_blank"&gt;babelfishpg-lab&lt;/a&gt;.
&lt;/div&gt;
&lt;div class="notice warning"&gt;
&lt;span class="notice-emoji"&gt;
⚠️
&amp;nbsp;
&lt;/span&gt;
In this post, we cover &lt;code&gt;4.2.0&lt;/code&gt; version. There is a slight difference in the logging settings and format from &lt;code&gt;4.1.1&lt;/code&gt;.
&lt;/div&gt;
&lt;p&gt;Even tho BabelfishPG is a Postgres flavor, the configuration is done through its extensions (babelfish_tds and babelfish_tsql). In this post, we focus on how to log query timings and enable showing query plans.&lt;/p&gt;
&lt;p&gt;For Postgres vanilla, you can log slow queries by setting the &lt;a href="https://postgresqlco.nf/doc/en/param/log_min_duration_statement/16/" target="_blank"&gt;&lt;code&gt;log_min_duration_statements&lt;/code&gt;&lt;/a&gt;, but this won&amp;rsquo;t log TSQL statements. Queries execute through a different backend fork, so targeted statements executed through the TDS protocol, won&amp;rsquo;t get logged.&lt;/p&gt;</description></item><item><title>Cascading timeouts through Pool (PGBouncer)</title><link>https://tr3s.ma/posts/2024-10/pgbouncer/</link><pubDate>Wed, 02 Oct 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2024-10/pgbouncer/</guid><description>&lt;h2 id="combining-query_timeout-and-statement_timeout"&gt;Combining &lt;code&gt;query_timeout&lt;/code&gt; and &lt;code&gt;statement_timeout&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;In &lt;a href=""&gt;pgbouncer&amp;rsquo;s documentation&lt;/a&gt; it&amp;rsquo;s stated that the &lt;code&gt;query_timeout&lt;/code&gt; should be set slightly
higher that Postgres&amp;rsquo; &lt;code&gt;statement_timeout&lt;/code&gt;. Although this apply in most of the cases, it depends
on the business requirements.&lt;/p&gt;
&lt;p&gt;Generally, the &lt;code&gt;statement_timeout&lt;/code&gt; should be set to the 99th percentile of your statements duration.
However, there are cases were certain statements require larger timeouts, due to particularities like
a large customer set, or larger fields, as in TOAST compression cases.&lt;/p&gt;</description></item><item><title>[BabelfishPG] Using tds_fdw to access BabelfishPG</title><link>https://tr3s.ma/posts/2024-09/tdsfdw/</link><pubDate>Fri, 06 Sep 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2024-09/tdsfdw/</guid><description>&lt;h2 id="it-supports-tds-right"&gt;It supports TDS, right?&lt;/h2&gt;
&lt;p&gt;Some things happen once in a lifetime, and the story around this is quite particular.
A customer required something that at the beginning sound counter intuitive: migrate an existing Postgres database to BabelfishPG.&lt;/p&gt;
&lt;p&gt;The thing was that the application was a critical business core, with a large amount of code that would require years to migrate fully for supporting another storage strategy. But the real reason was that their customer didn&amp;rsquo;t want to stick to any private licensing model, and required to use Open Source solutions.&lt;/p&gt;</description></item><item><title>[BabelfishPG] Pooling TDS connections in BabelfishPG with FreeTDS</title><link>https://tr3s.ma/posts/2024-08/tdsbabelfish/</link><pubDate>Thu, 15 Aug 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2024-08/tdsbabelfish/</guid><description>&lt;blockquote&gt;
&lt;p&gt;Next post will cover performance tests using &lt;code&gt;tdspool&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="babelfishpg-connection-architecture"&gt;BabelfishPG connection architecture&lt;/h2&gt;
&lt;p&gt;Inherited from Postgres connection architecture, each connection trhough the TDS port will
instance a Postgres backend. As in Postgres, BabelfishPG needs a middleware for funnel
connections through the TDS port for avoiding running out of connections and processing capacity
in the database server.&lt;/p&gt;
&lt;p&gt;For Postgres, we have plenty of options, like PGBouncer, Odyssey, pgcat, name it.
For T-SQL (read as MSSQL compatible language), there aren&amp;rsquo;t many open sourced solutions.&lt;/p&gt;</description></item><item><title>[Earthly +v0.8.10 feature]: Disabling Earthly internal labels</title><link>https://tr3s.ma/posts/2024-07/nolabelsearthlyfeature/</link><pubDate>Mon, 01 Jul 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2024-07/nolabelsearthlyfeature/</guid><description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; &lt;em&gt;This has not been yet updated in the Earthly documentation, but I&amp;rsquo;m pretty sure it will be soon
(and I&amp;rsquo;ll update this post accordingly)&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="what-does-labels-do-to-reproducible-builds"&gt;What does labels do to reproducible builds?&lt;/h2&gt;
&lt;p&gt;By default, Earthly adds &lt;code&gt;dev.earthly.*&lt;/code&gt; labels in the built image. You can find these
by doing a &lt;code&gt;docker inspect &amp;lt;imageID&amp;gt; | jq -r '.[].Config.Labels'&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s an example of the image configuration including the &lt;code&gt;dev.earthly.*&lt;/code&gt; labels:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Config&amp;#34;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;:&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;Labels&amp;#34;&lt;/span&gt;: {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;dev.earthly.built-by&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;homebrew&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;dev.earthly.git-sha&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;6b41f8409d7ffef0d25072c2c04250074b6e3c72&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;dev.earthly.version&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;v0.8.14&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You may probably infer what&amp;rsquo;s the potential issue with these values.&lt;/p&gt;</description></item><item><title>Implementing a functional multi-process function in Bash</title><link>https://tr3s.ma/posts/2024-06/waiter/</link><pubDate>Sat, 01 Jun 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2024-06/waiter/</guid><description>&lt;p&gt;If you&amp;rsquo;re in this post, is because you need to implement a consistent way to add parallelization to your scripts.
This implementation is limited, as it does not contemplates grouping jobs for setting different process
groups with different settings or priorities.&lt;/p&gt;
&lt;p&gt;Although, probably most of the cases you just need to execute code that runs inside a block or just simply
does something in parallel. The &lt;code&gt;parallel&lt;/code&gt; command is a good option, but it requires to loose some code readability,
particularly on code blocks that might inject a complex semantic.&lt;/p&gt;</description></item><item><title>Testcontainers' customization for Postgres tests</title><link>https://tr3s.ma/posts/2024-05/testcontainers-postgres/</link><pubDate>Sun, 26 May 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2024-05/testcontainers-postgres/</guid><description>&lt;p&gt;Testcontainers allows you to test your code with &lt;em&gt;ephemeral containers&lt;/em&gt; right inside your tests.
It provides different modules for simplifying the process, however, sometimes you many need
to customize the container beyond the default parameters or it contents.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://github.com/3manuek/pgtestcontainers" target="_blank"&gt;Source Code&lt;/a&gt; of the laboratory. All examples
are functional, follow the instructions in the README file for setting up.
The csv file is generated by the Docker Compose setup, you can regenerate the example
by running &lt;code&gt;docker compose up -d&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Building dynamically-linked binaries in distroless images</title><link>https://tr3s.ma/posts/2024-05/distroless-sqlite/</link><pubDate>Tue, 14 May 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2024-05/distroless-sqlite/</guid><description>&lt;h2 id="case"&gt;Case&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;ve been developing an application in Go that uses SQLite as a local cache of the backend. The
story would end there if it wasn&amp;rsquo;t that I decided to go for a distroless image for opmitization purposes,
and also, why not?&lt;/p&gt;
&lt;p&gt;The thing here is that for enabling certain features of the &lt;code&gt;database/sql&lt;/code&gt; driver, the artifact should
be dynamically linked through &lt;code&gt;CGO_ENABLED=1&lt;/code&gt; and with the &lt;code&gt;-tags &amp;quot;fts5&amp;quot;&lt;/code&gt; (for the FTS5 feature support,
see &lt;a href="https://github.com/mattn/go-sqlite3/issues/756#issuecomment-1049493077" target="_blank"&gt;this issue comment&lt;/a&gt;).&lt;/p&gt;</description></item><item><title>Using parallel with multiple arguments</title><link>https://tr3s.ma/posts/2024-04/multiargparallel/</link><pubDate>Mon, 01 Apr 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2024-04/multiargparallel/</guid><description>&lt;h2 id="a-handy-tool-for-parallelization"&gt;A handy tool for parallelization&lt;/h2&gt;
&lt;p&gt;If you are reading this post, is because you have heard about &lt;code&gt;parallel&lt;/code&gt;. It is a GNU developed tool for
paralelizing commands across sets of arguments. I&amp;rsquo;ll be honest, I use to forget about its existence until
I need to do quick and dirty things when dealing with tasks that require paralelization, and whenever time
is a constraint.&lt;/p&gt;
&lt;p&gt;It has plenty of options and arguments, although once you get up on its usage, it is very handy in many
cases.&lt;/p&gt;</description></item><item><title>Ergodox Keyboard Layout for Colemak, QWERTY and Dvorak</title><link>https://tr3s.ma/posts/2023-02/oryxlayout/</link><pubDate>Wed, 24 Jan 2024 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2023-02/oryxlayout/</guid><description>&lt;p&gt;&lt;img src="https://tr3s.ma/images/posts/ergodox.png" alt="Ergodox"&gt;&lt;/p&gt;
&lt;div class="notice info"&gt;
&lt;span class="notice-emoji"&gt;
ℹ️
&amp;nbsp;
&lt;/span&gt;
This is my current &lt;a href="https://configure.zsa.io/ergodox-ez/layouts/GLL7M/latest/0" target="_blank"&gt;MacOS Layout&lt;/a&gt;.
&lt;/div&gt;
&lt;p&gt;A few months ago, I bought the Ergodox OrthoLinear Split Keyboard. After a period of trying it, I&amp;rsquo;ve found that
the QWERTY layout was considerably uncomfortable to type in the keyboard disposition. I wasn&amp;rsquo;t the only one, of course,
so I started the journey for searching a suitable layout. During a period of time, I switched back and forth between
three layouts (QWERTY, Dvorak, and Colemak), although I picked Colemak at the end.&lt;/p&gt;</description></item><item><title>[Useless Code] Swapping variable values with no additional libraries</title><link>https://tr3s.ma/posts/2023-02/swap/</link><pubDate>Thu, 23 Feb 2023 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2023-02/swap/</guid><description>&lt;h2 id="background"&gt;Background&lt;/h2&gt;
&lt;p&gt;There was a contest in an internet thread about how to code a variable swap as low-level and minimal as possible.
So, I ended up writing a low-level function in C calling instructions for a modern amd64 platform.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-c" data-lang="c"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#include&lt;/span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span style="color:#75715e"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#include&lt;/span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;span style="color:#75715e"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;void&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;swapshit&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt;arg1, &lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt;arg2) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; __asm__ &lt;span style="color:#a6e22e"&gt;__volatile__&lt;/span&gt; (&lt;span style="color:#e6db74"&gt;&amp;#34;movl %2, %%eax;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;movl %3, %%ebx;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;movl %%eax, %0;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;movl %%ebx, %1;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;=g&amp;#34;&lt;/span&gt; (&lt;span style="color:#f92672"&gt;*&lt;/span&gt;arg2) , &lt;span style="color:#e6db74"&gt;&amp;#34;=g&amp;#34;&lt;/span&gt; (&lt;span style="color:#f92672"&gt;*&lt;/span&gt;arg1)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;a&amp;#34;&lt;/span&gt; (&lt;span style="color:#f92672"&gt;*&lt;/span&gt;arg1), &lt;span style="color:#e6db74"&gt;&amp;#34;b&amp;#34;&lt;/span&gt; (&lt;span style="color:#f92672"&gt;*&lt;/span&gt;arg2) );
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;main&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; argc, &lt;span style="color:#66d9ef"&gt;char&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt;argv[])
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; arg1 &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;atoi&lt;/span&gt;(argv[&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; arg2 &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;atoi&lt;/span&gt;(argv[&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;swapshit&lt;/span&gt;(&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;arg1,&lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;arg2);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;printf&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;arg1 es %d , arg2 es %d&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;,arg1,arg2);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The explanation of the above is quite simple. We use registers to allocate the values and call them in a different order
using &lt;code&gt;movl&lt;/code&gt; instruction. The &lt;code&gt;main&lt;/code&gt; is just a wrapper that passes arguments.&lt;/p&gt;</description></item><item><title>Switching layout and key disposition experience</title><link>https://tr3s.ma/posts/2022-12/colemakjourney/</link><pubDate>Mon, 12 Dec 2022 00:00:00 +0000</pubDate><guid>https://tr3s.ma/posts/2022-12/colemakjourney/</guid><description>&lt;p&gt;This post has no intention to discuss what layout might be better in terms of
efficiency or effort. There are a considerable amount of great articles related
to all the analisys across different layouts, and even tools for ingesting text
and estimate the effort of typing the text for several layouts.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll find this article more useful if you already decided to switch to Colemak, and
make it your primary layout. Personally, I have found very comfortable to write
in Dvorak, although there are some perks in Colemak regarding shortcut compatibility
among other benefits that made me do the choice. You can read a very interesting
comparision at this &lt;a href="http://xahlee.info/kbd/dvorak_vs_colemak.html" target="_blank"&gt;Xahlee post&lt;/a&gt;.&lt;/p&gt;</description></item></channel></rss>