<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>Arvids Blog</title>
      <link>https://arvid.io</link>
      <description>A blog by Arvid Gerstmann, a programmer and CTO.</description>
      <generator>Zola</generator>
      <language>en</language>
      <atom:link href="https://arvid.io/rss.xml" rel="self" type="application/rss+xml"/>
      <lastBuildDate>Fri, 27 Jun 2025 00:00:00 +0000</lastBuildDate>
      <item>
          <title>Single file scripts using `uv`</title>
          <pubDate>Fri, 27 Jun 2025 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2025/06/26/uv-single-file-scripts/</link>
          <guid>https://arvid.io/2025/06/26/uv-single-file-scripts/</guid>
          <description xml:base="https://arvid.io/2025/06/26/uv-single-file-scripts/">&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;astral-sh&#x2F;uv&quot;&gt;uv&lt;&#x2F;a&gt; is a package manager for Python that’s been gaining some traction for the past year or so.&lt;&#x2F;p&gt;
&lt;p&gt;As already &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;docs.astral.sh&#x2F;uv&#x2F;guides&#x2F;scripts&#x2F;#using-a-shebang-to-create-an-executable-file&quot;&gt;blogged&#x2F;written&lt;&#x2F;a&gt; &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;simonwillison.net&#x2F;2024&#x2F;Aug&#x2F;21&#x2F;usrbinenv-uv-run&#x2F;&quot;&gt;about&lt;&#x2F;a&gt; &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.cottongeeks.com&#x2F;articles&#x2F;2025-06-24-fun-with-uv-and-pep-723&quot;&gt;many&lt;&#x2F;a&gt; &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;treyhunner.com&#x2F;2024&#x2F;12&#x2F;lazy-self-installing-python-scripts-with-uv&#x2F;&quot;&gt;times&lt;&#x2F;a&gt;, &lt;code&gt;uv&lt;&#x2F;code&gt; can be used to write single-file Python scripts without having to worry about virtual environments.&lt;&#x2F;p&gt;
&lt;p&gt;However, they all suggest using &lt;code&gt;#!&#x2F;usr&#x2F;bin&#x2F;env -S&lt;&#x2F;code&gt; as a shebang to invoke the script with &lt;code&gt;uv run --script&lt;&#x2F;code&gt; like this:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;!&#x2F;usr&#x2F;bin&#x2F;env -S uv run --script&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Unfortunately, this depends on a reasonably new version of &lt;code&gt;&#x2F;usr&#x2F;bin&#x2F;env&lt;&#x2F;code&gt;.  The &lt;code&gt;-S&lt;&#x2F;code&gt; flag was introduced in version &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;coreutils&#x2F;coreutils&#x2F;blob&#x2F;5a5b4a7810a433331ede492114205e949217e733&#x2F;NEWS#L1225-L1227&quot;&gt;8.30 (published 2018-07-01) of the GNU coreutils&lt;&#x2F;a&gt;.
For many of us on enterprise Linux distributions (e.g., RHEL 9, or Amazon Linux 2) this version is too new.&lt;&#x2F;p&gt;
&lt;p&gt;But fear not, there are ways to achieve the same end results without having to update to an unsupported version of GNU coreutils.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;tl;dr: Use this instead:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;!&#x2F;bin&#x2F;bash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;exec&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; uv run&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;script&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language z-shell&quot;&gt;@&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; &#x2F;&#x2F;&#x2F; script&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; requires-python = &amp;quot;&amp;gt;=3.12&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; dependencies = [&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;   &amp;quot;requests&amp;quot;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; ]&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is a &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Polyglot_(computing)&quot;&gt;Polyglot&lt;&#x2F;a&gt; script, a script or program that can be interpreted by more than a single language.
In this case, the script is valid Bash and Python. Let’s break it down how this works line by line:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;#!&#x2F;bin&#x2F;bash&lt;&#x2F;code&gt;: The standard shebang line for bash. The script is being interpreted by bash from here on.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;&quot;&quot;&lt;&#x2F;code&gt;: An empty string. Strings that follow each other (&lt;code&gt;&quot;&quot; &quot;&quot;&lt;&#x2F;code&gt;) are concatenated in bash.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;&quot;exec&quot; uv run --script &quot;$0&quot; &quot;$@&quot;&lt;&#x2F;code&gt;: This calls the &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;ss64.com&#x2F;bash&#x2F;exec.html&quot;&gt;&lt;code&gt;exec&lt;&#x2F;code&gt; bash builtin&lt;&#x2F;a&gt; which replaces the entire program image with the
one that follows, in our case we invoke &lt;code&gt;uv&lt;&#x2F;code&gt; with the arguments &lt;code&gt;run --script &quot;$0&quot; &quot;$@&quot;&lt;&#x2F;code&gt;. The last two arguments mean we forward the path to the script (&lt;code&gt;$0&lt;&#x2F;code&gt;)
and all arguments (&lt;code&gt;$@&lt;&#x2F;code&gt;) to UV. The call to &lt;code&gt;exec&lt;&#x2F;code&gt; ends the execution within bash; therefore, all lines that follow do not have to be valid bash anymore.&lt;&#x2F;p&gt;
&lt;p&gt;Now our little script is not interpreted as bash anymore, but run as Python. We start from the top again:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;#!&#x2F;bin&#x2F;bash&lt;&#x2F;code&gt;: This is not a shebang anymore. To Python, this is just a comment.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;&quot;&quot;&quot;&lt;&#x2F;code&gt;: It’s not a string anymore, in Python, this is interpreted as a multiline comment; therefore, Python will skip over the entire remaining of the file.
The comments with &lt;code&gt;&#x2F;&#x2F;&#x2F; script&lt;&#x2F;code&gt; are interpreted according to &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;packaging.python.org&#x2F;en&#x2F;latest&#x2F;specifications&#x2F;inline-script-metadata&#x2F;#inline-script-metadata&quot;&gt;Pythons inline script metadata specifications&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;And with this, we have a script that’s both valid bash and python which can be used instead of relying on new versions of &lt;code&gt;&#x2F;usr&#x2F;bin&#x2F;env&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Gerrit: Detached HEAD Workflow</title>
          <pubDate>Sun, 20 Nov 2022 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2022/11/20/gerrit-detached-head-workflow/</link>
          <guid>https://arvid.io/2022/11/20/gerrit-detached-head-workflow/</guid>
          <description xml:base="https://arvid.io/2022/11/20/gerrit-detached-head-workflow/">&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.gerritcodereview.com&#x2F;&quot;&gt;Gerrit&lt;&#x2F;a&gt; is a code hosting system similar to &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&quot;&gt;GitLab&lt;&#x2F;a&gt; or &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&quot;&gt;GitHub&lt;&#x2F;a&gt;, focusing on a better review experience rather than integrating with every other service on the planet and neglecting the core experience of their product.&lt;&#x2F;p&gt;
&lt;p&gt;Since GitLab, GitHub, and their predecessors have been so prevalent in the broader software development community, Gerrit requires a bit of rethinking of interacting with your distributed version control system. Behind the scenes, Gerrit is still using Git, but unlike many other systems, it’s not using a branch-based workflow for submitting changes to the mainline&lt;sup class=&quot;footnote-reference&quot;&gt;&lt;a href=&quot;#1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This blog post aims to introduce an alternative working mode with Git and Gerrit called “Detached HEAD”. But before diving into that, let’s provide some background.&lt;&#x2F;p&gt;
&lt;p&gt;In Git, the &lt;code&gt;HEAD&lt;&#x2F;code&gt; is a pointer that points to the currently checked-out commit or branch. It’s Git’s way of knowing which commit you’re looking at in your local working tree. HEAD is a file that points to the commit.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; cat .git&#x2F;HEAD&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;ref:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; refs&#x2F;heads&#x2F;master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; cat .git&#x2F;refs&#x2F;heads&#x2F;master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;3148fa73f6664f75746477188c7951a495252821&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the example, &lt;code&gt;HEAD&lt;&#x2F;code&gt; is pointing at the &lt;code&gt;ref&#x2F;heads&lt;&#x2F;code&gt; of &lt;code&gt;master&lt;&#x2F;code&gt;. The &lt;code&gt;ref&#x2F;heads&#x2F;master&lt;&#x2F;code&gt; file points to the latest commit on &lt;code&gt;master&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;HEAD&lt;&#x2F;code&gt; can be in multiple states: attached and detached. Typically, you’re working with an attached &lt;code&gt;HEAD&lt;&#x2F;code&gt;. That means your &lt;code&gt;HEAD&lt;&#x2F;code&gt; points to a branch (for example, &lt;code&gt;master&lt;&#x2F;code&gt;). Whenever you’re committing work, the commit is recorded on the current branch &lt;code&gt;HEAD&lt;&#x2F;code&gt; is currently referencing.
A detached &lt;code&gt;HEAD&lt;&#x2F;code&gt; is whenever you haven’t checked out any branch, and all commits you’re making in this state are getting “lost” once you’re checking out a branch (don’t worry, you can recover them).&lt;&#x2F;p&gt;
&lt;p&gt;Many publications erroneously frame the “detached HEAD” state as an error state that one must recover from, highlighting the lack of education about Git as a tool and how to use it effectively.&lt;&#x2F;p&gt;
&lt;p&gt;With that out of the way, let’s get started. First, we’re preparing our working tree:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout master &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; our work is based on the master branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;detach &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; we&amp;#39;re now in a detached `HEAD` state&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We’re now in a detached &lt;code&gt;HEAD&lt;&#x2F;code&gt; state. So you can work as you usually would by creating commits using &lt;code&gt;git commit&lt;&#x2F;code&gt; or &lt;code&gt;git commit --amend&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; In Gerrit, every commit is a change. If you’re pushing multiple commits, Gerrit will create the changes in a chain of dependencies. You can update a change by amending the commit and pushing it. Gerrit will create a new revision automatically.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$ &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; Do some work, and create a README.md&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git add README.md&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git commit&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Once you’re ready to push your changes, you need to rebase your work on the master branch and push it.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git pull&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;rebase&lt;&#x2F;span&gt; &lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout -&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git rebase master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When you were checking out the master branch from your detached HEAD state, you got a scary message that you’re leaving behind commits that are not connected to any branch. That’s the state I mentioned earlier. You can ignore the warning in this context since we are switching back to the commit with &lt;code&gt;git checkout -&lt;&#x2F;code&gt; (similar to how &lt;code&gt;cd -&lt;&#x2F;code&gt; works).&lt;&#x2F;p&gt;
&lt;p&gt;Your change is now rebased and ready to be pushed for code review to Gerrit.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git push origin HEAD:refs&#x2F;for&#x2F;master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Gerrit has created a new change for every commit not on the master branch.&lt;&#x2F;p&gt;
&lt;p&gt;You can now continue working in this detached HEAD state and add further commits or update existing commits.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git add&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;A&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git commit&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git push origin HEAD:refs&#x2F;for&#x2F;master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Gerrit will now create a new change that depends on the change pushed earlier. That’s how you can create dependency chains between submitted changes, allowing you to keep each change as small as necessary.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Congratulations, you should now be ready to start working with Gerrit.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For a more in-depth introduction to Gerrit, I recommend reading the &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gerrit-review.googlesource.com&#x2F;Documentation&#x2F;intro-user.html&quot;&gt;Gerrit User Guide&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;Cheatsheet&quot;&gt;Cheatsheet&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;Starting_a_new_change&quot;&gt;Starting a new change&lt;&#x2F;h3&gt;
&lt;p&gt;This assumes that you pushed your last change to Gerrit. If you didn’t, save your change first (see here).&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git pull&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;rebase&lt;&#x2F;span&gt; &lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;detach&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You can now commit as usual.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;Saving_a_change&quot;&gt;Saving a change&lt;&#x2F;h3&gt;
&lt;p&gt;You can save your current working state by creating a new named branch.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;b&lt;&#x2F;span&gt; your-branch-name&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now you can start working on a new change.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;Pushing_a_change&quot;&gt;Pushing a change&lt;&#x2F;h3&gt;
&lt;p&gt;To push a change to Gerrit, you need to push to &lt;code&gt;refs&#x2F;for&#x2F;&amp;lt;branch&amp;gt;&lt;&#x2F;code&gt;. It would be best if you also rebased your change on the target branch before pushing, see here.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git push origin HEAD:refs&#x2F;for&#x2F;master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;Rebasing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; a change on master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git pull&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;rebase&lt;&#x2F;span&gt; &lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout -&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git rebase master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;Fetching_a_change&quot;&gt;Fetching a change&lt;&#x2F;h3&gt;
&lt;p&gt;To fetch a change:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to the change on Gerrit.&lt;&#x2F;li&gt;
&lt;li&gt;Click the “Download” button on the top right of the list of files in the patchset to open the “Download” overlay.&lt;&#x2F;li&gt;
&lt;li&gt;Copy the “Checkout” line and execute it in your terminal.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It’ll put you into a detached HEAD state, and you don’t have to do anything else. You can start working like you usually would.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;Rebasing_a_change_on_top_of_a_patchset&quot;&gt;Rebasing a change on top of a patchset&lt;&#x2F;h3&gt;
&lt;p&gt;Like fetching a change from Gerrit, copy the “Checkout” line and remove the last &lt;code&gt;&amp;amp;&amp;amp; git checkout FETCH_HEAD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git fetch ssh:&#x2F;&#x2F;username@host:29418&#x2F;myProject refs&#x2F;changes&#x2F;74&#x2F;67374&#x2F;2&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git rebase&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;i&lt;&#x2F;span&gt; FETCH_HEAD&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;Updating_a_change&quot;&gt;Updating a change&lt;&#x2F;h3&gt;
&lt;p&gt;Again, like fetching a change from Gerrit, copy the “Checkout” line.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git fetch ssh:&#x2F;&#x2F;username@host:29418&#x2F;myProject refs&#x2F;changes&#x2F;74&#x2F;67374&#x2F;2&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-logical z-and z-shell&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;git&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; checkout FETCH_HEAD&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$ &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; fix&#x2F;update whatever you need&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git add&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;A&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git commit&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;amend &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; Make sure to only amend, don&amp;#39;t create new commits&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git push origin HEAD:refs&#x2F;for&#x2F;master&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; git checkout - &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; switch back to your old change&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;div class=&quot;footnote-definition&quot; id=&quot;1&quot;&gt;&lt;sup class=&quot;footnote-definition-label&quot;&gt;1&lt;&#x2F;sup&gt;
&lt;p&gt;If you’ve used &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.perforce.com&#x2F;&quot;&gt;Perforce&lt;&#x2F;a&gt; in the past, you might be much more familiar with a branchless workflow.&lt;&#x2F;p&gt;
&lt;&#x2F;div&gt;
</description>
      </item>
      <item>
          <title>Programming Fonts in 2021</title>
          <pubDate>Tue, 30 Nov 2021 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2021/11/30/programming-fonts-in-2021/</link>
          <guid>https://arvid.io/2021/11/30/programming-fonts-in-2021/</guid>
          <description xml:base="https://arvid.io/2021/11/30/programming-fonts-in-2021/">&lt;p&gt;While browsing reddit I’ve came across “&lt;em&gt;JetBrains Mono&lt;&#x2F;em&gt;”, the “new” programming font from JetBrains.&lt;&#x2F;p&gt;
&lt;p&gt;This started, yet another, rabbit hole down the currently available programming fonts.&lt;&#x2F;p&gt;
&lt;p&gt;The current contenders are:&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Minimal Makefile, Maximum Outcome - C++ Edition</title>
          <pubDate>Mon, 11 Mar 2019 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2019/03/11/minimal-makefile-maximum-outcome-c-edition/</link>
          <guid>https://arvid.io/2019/03/11/minimal-makefile-maximum-outcome-c-edition/</guid>
          <description xml:base="https://arvid.io/2019/03/11/minimal-makefile-maximum-outcome-c-edition/">&lt;p&gt;This is an amendment to one of my previous posts  which was building a small &lt;code&gt;Makefile&lt;&#x2F;code&gt; for simple C projects.&lt;&#x2F;p&gt;
&lt;p&gt;Here, I’m presenting essentially the same file, but with added C++ support:&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Top 5 Brand Names That Became Generic Terms</title>
          <pubDate>Wed, 21 Nov 2018 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2018/11/21/top-5-brand-names-that-became-generic-terms/</link>
          <guid>https://arvid.io/2018/11/21/top-5-brand-names-that-became-generic-terms/</guid>
          <description xml:base="https://arvid.io/2018/11/21/top-5-brand-names-that-became-generic-terms/">&lt;p&gt;Many terms we use everyday were once brand names, but since have become generic terms we’re now using to refer to the category of products in general. A majority of these are or were registered trademarks. These are known as &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Generic_trademark&quot;&gt;genericized trademarks&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Better C++ Pseudo Random Number Generator</title>
          <pubDate>Mon, 02 Jul 2018 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2018/07/02/better-cxx-prng/</link>
          <guid>https://arvid.io/2018/07/02/better-cxx-prng/</guid>
          <description xml:base="https://arvid.io/2018/07/02/better-cxx-prng/">&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;arvid.io&#x2F;2018&#x2F;06&#x2F;30&#x2F;on-cxx-random-number-generator-quality&#x2F;&quot;&gt;Yesterday&lt;&#x2F;a&gt; I wrote about the terrible quality of the default pseudo random number generators in the C++ standard library. The article came to the conclusion they’re all around terrible, and should generally be avoided, yet, it didn’t provide any alternatives. Therefore, today I’ll provide you with three very good alternatives to the existing generators in the C++ standard library.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;splitmix&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;xorshift&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;pcg&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;</description>
      </item>
      <item>
          <title>On C++ Random Number Generator Quality</title>
          <pubDate>Sat, 30 Jun 2018 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2018/06/30/on-cxx-random-number-generator-quality/</link>
          <guid>https://arvid.io/2018/06/30/on-cxx-random-number-generator-quality/</guid>
          <description xml:base="https://arvid.io/2018/06/30/on-cxx-random-number-generator-quality/">&lt;p&gt;&lt;strong&gt;tl;dr:&lt;&#x2F;strong&gt; Do not use &lt;code&gt;&amp;lt;random&amp;gt;&lt;&#x2F;code&gt;’s generators. There are plenty good alternatives, like &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;http:&#x2F;&#x2F;www.pcg-random.org&#x2F;download.html&quot;&gt;PCG&lt;&#x2F;a&gt;, SplitMix, truncated Xorshift32*, or Xorshift1024*.&lt;&#x2F;p&gt;
&lt;p&gt;A recent tweet reminded me of the &lt;code&gt;&amp;lt;random&amp;gt;&lt;&#x2F;code&gt; facilities in the C++ standard library. Having just recently studied and implemented a couple random number generators myself, I was curious how they hold up in a modern test.&lt;br &#x2F;&gt;
From the get-go, I knew this is going to end badly, but I gave it a shot anyway.&lt;br &#x2F;&gt;
I build a little test program, to feed into &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;http:&#x2F;&#x2F;pracrand.sourceforge.net&#x2F;&quot;&gt;PractRand&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Intel &amp; AMD Micro-Architecture Extended Instruction Sets</title>
          <pubDate>Sun, 27 May 2018 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2018/05/27/intel-microarchitectures-instruction-sets/</link>
          <guid>https://arvid.io/2018/05/27/intel-microarchitectures-instruction-sets/</guid>
          <description xml:base="https://arvid.io/2018/05/27/intel-microarchitectures-instruction-sets/">&lt;p&gt;The following is a list of architectures where certain instruction sets have been introduced first. The column “instr. set” only lists the &lt;em&gt;introduced&lt;&#x2F;em&gt;, not all instruction sets.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>PDBs on Linux</title>
          <pubDate>Sat, 05 May 2018 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2018/05/05/pdbs-on-linux/</link>
          <guid>https://arvid.io/2018/05/05/pdbs-on-linux/</guid>
          <description xml:base="https://arvid.io/2018/05/05/pdbs-on-linux/">&lt;p&gt;On Windows, debugger symbols aren’t stored side-by-side with the executable data in the same file. They’re stored in a &lt;code&gt;.pdb&lt;&#x2F;code&gt; file (short for “program database”). This is especially great if you distribute your program to end-users, but still want to be able to debug any crashes. Just keep the &lt;code&gt;.pdb&lt;&#x2F;code&gt; file somewhere save, and any crash log you get send can easily translated back into source locations.&lt;&#x2F;p&gt;
&lt;p&gt;On Linux, debug symbols are traditionally stored inside the executable, and stripped (using &lt;code&gt;strip(1)&lt;&#x2F;code&gt;) before distributing. This takes away the possibility to debug any crash, send to you from the stripped executable.&lt;&#x2F;p&gt;
&lt;p&gt;Today I discovered a neat little trick to create something resembling PDBs on Linux, by making use of &lt;code&gt;objcopy(1)&lt;&#x2F;code&gt;. In our example, I already have compiled an executable &lt;code&gt;a.out&lt;&#x2F;code&gt;, which I want to distribute to my users:&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Memory Mapping on Windows (including Benchmark)</title>
          <pubDate>Mon, 02 Apr 2018 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2018/04/02/memory-mapping-on-windows/</link>
          <guid>https://arvid.io/2018/04/02/memory-mapping-on-windows/</guid>
          <description xml:base="https://arvid.io/2018/04/02/memory-mapping-on-windows/">&lt;p&gt;The following tweet sparked my interest to investigate further into the different ways of mapping and unmapping memory on Windows, and trying to find the “best” way:&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Announcing the C++ Tour</title>
          <pubDate>Fri, 08 Dec 2017 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2017/12/08/announcing-the-cpp-tour/</link>
          <guid>https://arvid.io/2017/12/08/announcing-the-cpp-tour/</guid>
          <description xml:base="https://arvid.io/2017/12/08/announcing-the-cpp-tour/">&lt;p&gt;&lt;img src=&quot;&#x2F;content&#x2F;images&#x2F;2017&#x2F;12&#x2F;TourLogo2.png&quot; alt=&quot;C++ Tour Logo&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I’m proud to officially announce the C++ Tour.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Using clang on Windows</title>
          <pubDate>Thu, 03 Aug 2017 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2017/08/03/using-clang-on-windows/</link>
          <guid>https://arvid.io/2017/08/03/using-clang-on-windows/</guid>
          <description xml:base="https://arvid.io/2017/08/03/using-clang-on-windows/">&lt;p&gt;&lt;strong&gt;Update 1:&lt;&#x2F;strong&gt; Visual Studio 2017 works. &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;cpp&#x2F;comments&#x2F;6rg0tw&#x2F;using_clang_on_windows&#x2F;dl500o5&#x2F;&quot;&gt;Thanks to STL.&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;&#x2F;strong&gt; This isn’t about clang&#x2F;C2, clang&#x2F;C2 is Microsoft own fork of clang to work with their backend. This is using clang + llvm.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;tl;dr:&lt;&#x2F;strong&gt; All the source is in this repository: &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Leandros&#x2F;ClangOnWindows&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;Leandros&#x2F;ClangOnWindows&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Is my output going to bash.exe or cmd.exe?</title>
          <pubDate>Sun, 23 Apr 2017 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2017/04/23/is-my-process-running-from-bash-exe-or-cmd-exe/</link>
          <guid>https://arvid.io/2017/04/23/is-my-process-running-from-bash-exe-or-cmd-exe/</guid>
          <description xml:base="https://arvid.io/2017/04/23/is-my-process-running-from-bash-exe-or-cmd-exe/">&lt;p&gt;If you want to color the output of your terminal program in Windows, you might’ve noticed, that running it from different shells reacts differently.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;cmd.exe&lt;&#x2F;code&gt; does not recognize the ANSI escape sequences to change the foreground&#x2F;background color, while &lt;code&gt;bash.exe&lt;&#x2F;code&gt; does not recognize Windows’ &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;windows&#x2F;desktop&#x2F;ms686047(v=vs.85).aspx&quot;&gt;&lt;code&gt;SetConsoleTextAttribute&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. This poses a problem. A way to detect if the output is going to &lt;code&gt;bash.exe&lt;&#x2F;code&gt; or &lt;code&gt;cmd.exe&lt;&#x2F;code&gt; is required.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Stop using #ifdef for configuration</title>
          <pubDate>Sat, 22 Apr 2017 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2017/04/22/stop-using-ifdef-for-configuration/</link>
          <guid>https://arvid.io/2017/04/22/stop-using-ifdef-for-configuration/</guid>
          <description xml:base="https://arvid.io/2017/04/22/stop-using-ifdef-for-configuration/">&lt;p&gt;Using &lt;code&gt;#ifdef&lt;&#x2F;code&gt;’s to configure different conditional compilations is very error prone.&lt;&#x2F;p&gt;
&lt;p&gt;I believe we’ve all had the case where something was compiled, while it shouldn’t have been, due to accidentally creating&#x2F;including a &lt;code&gt;#define&lt;&#x2F;code&gt; of the same name or defining it to 0 while checking with &lt;code&gt;#ifdef&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;While I won’t give you a solution to fix the flawed model of using the preprocessor for conditional inclusion, I’ll give you a solution to make it less error prone:&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>C Wishlist: Inline Functions</title>
          <pubDate>Sat, 11 Feb 2017 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2017/02/11/i-wish-c-had-inline-functions/</link>
          <guid>https://arvid.io/2017/02/11/i-wish-c-had-inline-functions/</guid>
          <description xml:base="https://arvid.io/2017/02/11/i-wish-c-had-inline-functions/">&lt;p&gt;This is the first piece of a series of posts describing a few, very easily solvable, shortcomings of the C language. And proposing a way to fix these.&lt;br &#x2F;&gt;
This is purely done the fact that I’m currently working on a C compiler. While I’ve written a few compilers over the years, none was actually intended to be used in production. This time it’s different!&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>SIMD Instruction Format</title>
          <pubDate>Fri, 09 Dec 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2016/12/09/simd-instruction-format/</link>
          <guid>https://arvid.io/2016/12/09/simd-instruction-format/</guid>
          <description xml:base="https://arvid.io/2016/12/09/simd-instruction-format/">&lt;p&gt;Did you know, that Intel has a naming scheme for their SIMD instructions? Neither did I.&lt;&#x2F;p&gt;
&lt;p&gt;I found, by watching &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;youtu.be&#x2F;w5Z4JlMJ1VQ?t=35m20s&quot;&gt;a CppCon talk by Tim Haines&lt;&#x2F;a&gt;, that&lt;br &#x2F;&gt;
SIMD instruction have a pre-defined scheme which can be used to easily decode the, sometimes, cryptic mnemonics.&lt;br &#x2F;&gt;
To much of my surprise, it’s not mentioned nor explained in any of Intel’s manuals.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Test if a variable is unavailable in GDB</title>
          <pubDate>Sun, 21 Aug 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2016/08/21/test-if-a-variable-is-unavailable-in-gdb/</link>
          <guid>https://arvid.io/2016/08/21/test-if-a-variable-is-unavailable-in-gdb/</guid>
          <description xml:base="https://arvid.io/2016/08/21/test-if-a-variable-is-unavailable-in-gdb/">&lt;p&gt;GDB on macOS can’t display a few of the segment registers, which results in that the respective variables are not available for use. Trying to use them will only print &lt;code&gt;$var is not available&lt;&#x2F;code&gt; and skip the rest of any currently running function.&lt;&#x2F;p&gt;
&lt;p&gt;Merely executing this line&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;python&quot; class=&quot;language-python z-code&quot;&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;z-source z-python&quot;&gt;&lt;span class=&quot;z-meta z-qualified-name z-python&quot;&gt;&lt;span class=&quot;z-meta z-generic-name z-python&quot;&gt;printf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-string z-python&quot;&gt;&lt;span class=&quot;z-string z-quoted z-double z-python&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-python&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-string z-python&quot;&gt;&lt;span class=&quot;z-string z-quoted z-double z-python&quot;&gt; &lt;span class=&quot;z-constant z-other z-placeholder z-python&quot;&gt;%04X&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-string z-end z-python&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;, $&lt;span class=&quot;z-meta z-qualified-name z-python&quot;&gt;&lt;span class=&quot;z-meta z-generic-name z-python&quot;&gt;ds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;without &lt;code&gt;$ds&lt;&#x2F;code&gt; being available would stop executing the whole function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;To lazy to read and just want the solution? Skip to the bottom.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Minimal Makefile, Maximum Outcome</title>
          <pubDate>Mon, 04 Apr 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2016/04/04/minimal-makefile/</link>
          <guid>https://arvid.io/2016/04/04/minimal-makefile/</guid>
          <description xml:base="https://arvid.io/2016/04/04/minimal-makefile/">&lt;p&gt;Makefiles are flexible in many ways, it’s a small language in itself.&lt;br &#x2F;&gt;
As I said in a post &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;arvid.io&#x2F;2016&#x2F;03&#x2F;19&#x2F;generic-makefile&#x2F;&quot;&gt;before&lt;&#x2F;a&gt;, I normally write the same &lt;code&gt;Makefile&lt;&#x2F;code&gt; over and over, even just for compiling a simple project with two or more files. The there proposed &lt;code&gt;Makefile&lt;&#x2F;code&gt;, however, grew quite big during the writing of the post.&lt;&#x2F;p&gt;
&lt;p&gt;Today I want to present you a variant which is tiny, yet compiles your small to medium projects just fine, while still having dependency tracking and incremental compilation. To do this, I’ll make use of some of &lt;code&gt;make&lt;&#x2F;code&gt;s very convenient &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;make&#x2F;manual&#x2F;html_node&#x2F;Implicit-Rules.html&quot;&gt;implicit rules&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>std::sort in C</title>
          <pubDate>Sun, 03 Apr 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2016/04/03/std-sort-in-c/</link>
          <guid>https://arvid.io/2016/04/03/std-sort-in-c/</guid>
          <description xml:base="https://arvid.io/2016/04/03/std-sort-in-c/">&lt;p&gt;As some of you might already know through my Twitter, I’m currently attempting to build an advanced standard library for C, with similar performance and usage characteristics as C++’s STL.&lt;br &#x2F;&gt;
It’s going really well so far, but the sort algorithm of &lt;code&gt;std::sort&lt;&#x2F;code&gt; is giving me headaches.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Generic Makefile</title>
          <pubDate>Sat, 19 Mar 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2016/03/19/generic-makefile/</link>
          <guid>https://arvid.io/2016/03/19/generic-makefile/</guid>
          <description xml:base="https://arvid.io/2016/03/19/generic-makefile/">&lt;p&gt;&lt;strong&gt;Update:&lt;&#x2F;strong&gt; Now also supports C++, see the &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Leandros&#x2F;Generic-Makefile&quot;&gt;Github repository&lt;&#x2F;a&gt;) for the updated file.&lt;&#x2F;p&gt;
&lt;p&gt;In every single project, or even just test, I write the same simple &lt;code&gt;Makefile&lt;&#x2F;code&gt; over and over, by now I can write it without looking up anything. And if I forgot something, I would go through my old projects, to dig up the definition I need.&lt;br &#x2F;&gt;
Today I got fed up with that, and decided to write one completely generic &lt;code&gt;Makefile&lt;&#x2F;code&gt; I can just reuse in all my projects. It only requires a reasonably new make, nothing else.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Debug Messages in no$gmb and BGB</title>
          <pubDate>Sat, 12 Mar 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2016/03/12/debug-messages-in-no-gmb-and-bgb/</link>
          <guid>https://arvid.io/2016/03/12/debug-messages-in-no-gmb-and-bgb/</guid>
          <description xml:base="https://arvid.io/2016/03/12/debug-messages-in-no-gmb-and-bgb/">&lt;p&gt;I’ve recently started working on a little side project, involving Gameboy development. While reading through the docs of BGB, I noticed it supports printing debug messages to a debug console, I, however, couldn’t get it working, since it was using the syntax of the no$gmb assembler. Thanks to the people of #gbdev on EFnet, especially &lt;em&gt;beware&lt;&#x2F;em&gt;, I’ve eventually got it working, and made an rgbds macro out of it.&lt;&#x2F;p&gt;
&lt;p&gt;Without further ado, here is a gist of the it:&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Fixing Slow Vim in Tmux and iTerm2</title>
          <pubDate>Tue, 26 Jan 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2016/01/26/fixing-slow-vim-in-tmux-and-iterm2/</link>
          <guid>https://arvid.io/2016/01/26/fixing-slow-vim-in-tmux-and-iterm2/</guid>
          <description xml:base="https://arvid.io/2016/01/26/fixing-slow-vim-in-tmux-and-iterm2/">&lt;p&gt;I’ve noticed my Vim got horribly slow once I had multiple panes in tmux open.&lt;br &#x2F;&gt;
My initial investigation led to the fact, that tmux is slowing Vim down, and a quick Google search confirmed that.&lt;&#x2F;p&gt;
&lt;p&gt;After removing all plugins in Vim&#x2F;tmux, I dug through the iTerm2 settings and found this:&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>SysInfo - Beautiful System Diagnosis</title>
          <pubDate>Tue, 26 Jan 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2016/01/26/sysinfo-beautifully-system-diagnosis/</link>
          <guid>https://arvid.io/2016/01/26/sysinfo-beautifully-system-diagnosis/</guid>
          <description xml:base="https://arvid.io/2016/01/26/sysinfo-beautifully-system-diagnosis/">&lt;p&gt;&lt;img src=&quot;&#x2F;content&#x2F;images&#x2F;2016&#x2F;03&#x2F;screen1-1.png&quot; alt=&quot;screen&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I’ve recently been reminded of a tool called Archey, it’s used to display system specs in a delightful manner. You often see it in screenshots of some other people desktops of the Arch Linux community.&lt;&#x2F;p&gt;
&lt;p&gt;I missed such a tool on OS X, and that’s why I wrote SysInfo. It’s available on Github.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>About Me</title>
          <pubDate>Fri, 01 Jan 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/about-me/</link>
          <guid>https://arvid.io/about-me/</guid>
          <description xml:base="https://arvid.io/about-me/">&lt;img src=&quot;&#x2F;content&#x2F;images&#x2F;2022&#x2F;09&#x2F;profile.jpg&quot; align=&quot;right&quot; style=&quot;margin: 20px&quot; height=&quot;256&quot; width=&quot;256&quot; loading=&quot;lazy&quot;&gt;
&lt;p&gt;Arvid Gerstmann is an entrepreneur, software engineer, manager, and occasional &lt;a href=&quot;&#x2F;talks&quot;&gt;speaker&lt;&#x2F;a&gt;. He is the founder of &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;ragnarlab.com&quot;&gt;RagnarLab&lt;&#x2F;a&gt;, a digital consulting firm specialized in the &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.rust-lang.org&#x2F;&quot;&gt;Rust programming language&lt;&#x2F;a&gt;. Arvid has previous experience as Head of Software Engineering at &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.zeiss.de&#x2F;vision-care&#x2F;home.html&quot;&gt;ZEISS Vision&lt;&#x2F;a&gt;, Head of Software and Architecture at &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;doxy.me&#x2F;en&#x2F;&quot;&gt;Doxy.me, Inc.&lt;&#x2F;a&gt;, and served as the Chief Technology Officer at Appico.&lt;&#x2F;p&gt;
&lt;p&gt;Holding a degree in electrical engineering, Arvid is a self-taught programmer. He is interested in writing video games, compilers, and other low-level systems and is most fluent in Rust, C, and C++. However, he has professional experience in various technologies (incl. JS, TypeScript, Node.js, AWS, and Azure). Arvid loves solving complex problems and mentoring other engineers.&lt;&#x2F;p&gt;
&lt;p&gt;Arvid loves good espresso and is an avid reader. He usually travels nature with his Mercedes-Benz Marco Polo camper van, preparing for the upcoming hike or climbing the next big mountain with his girlfriend and his adorable Spanish water dog, Charlie. He currently lives in Germany.&lt;&#x2F;p&gt;
&lt;p&gt;Arvid is available for contracting. Visit &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;ragnarlab.com&#x2F;&quot;&gt;ragnarlab.com&lt;&#x2F;a&gt; to learn more.&lt;&#x2F;p&gt;
&lt;p&gt;You can find him on &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;bsky.app&#x2F;profile&#x2F;arvid.io&quot;&gt;BlueSky&lt;&#x2F;a&gt;, &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.linkedin.com&#x2F;in&#x2F;arvidgerstmann&#x2F;&quot;&gt;LinkedIn&lt;&#x2F;a&gt; or &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;leandros&quot;&gt;Github&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Talks</title>
          <pubDate>Fri, 01 Jan 2016 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/talks/</link>
          <guid>https://arvid.io/talks/</guid>
          <description xml:base="https://arvid.io/talks/">&lt;p&gt;This page lists all my recent talks and links to the slides and recording:&lt;&#x2F;p&gt;
&lt;h2 id=&quot;Table_of_Contents&quot;&gt;Table of Contents&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;arvid.io&#x2F;talks&#x2F;#emBO++_2019&quot;&gt;emBO++ 2019&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;arvid.io&#x2F;talks&#x2F;#C++_On_Sea_2019&quot;&gt;C++ On Sea 2019&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;arvid.io&#x2F;talks&#x2F;#Meeting_C++_2018&quot;&gt;Meeting C++ 2018&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;arvid.io&#x2F;talks&#x2F;#CppCon_2018&quot;&gt;CppCon 2018&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;arvid.io&#x2F;talks&#x2F;#Meeting_C++_2017&quot;&gt;Meeting C++ 2017&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;emBO++_2019&quot;&gt;emBO++ 2019&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;Refactor_C++_Using_LibTooling&quot;&gt;Refactor C++ Using LibTooling&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;RefactorCxx.pdf&quot;&gt;Slides&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=rbbCgVQrjWs&quot;&gt;Video&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;C++_On_Sea_2019&quot;&gt;C++ On Sea 2019&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;Building_a_C++_Reflection_System_in_One_Weekend_Using_Clang_and_LLVM&quot;&gt;Building a C++ Reflection System in One Weekend Using Clang and LLVM&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;Reflection2.pdf&quot;&gt;Slides&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;leandros&#x2F;metareflect&quot;&gt;Code&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=XoYVeduK4yI&quot;&gt;Video&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;Meeting_C++_2018&quot;&gt;Meeting C++ 2018&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;Building_a_C++_Reflection_System_in_One_Weekend_Using_Clang_and_LLVM-1&quot;&gt;Building a C++ Reflection System in One Weekend Using Clang and LLVM&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;Reflection2.pdf&quot;&gt;Slides&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;leandros&#x2F;metareflect&quot;&gt;Code&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YhzKDiQe1To&quot;&gt;Video&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;CppCon_2018&quot;&gt;CppCon 2018&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;Building_a_C++_Reflection_System_in_One_Weekend_Using_Clang_and_LLVM-2&quot;&gt;Building a C++ Reflection System in One Weekend Using Clang and LLVM&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;Reflection.pdf&quot;&gt;Slides&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;leandros&#x2F;metareflect&quot;&gt;Code&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;youtu.be&#x2F;DUiUBt-fqEY&quot;&gt;Video&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;Meeting_C++_2017&quot;&gt;Meeting C++ 2017&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;A_Very_Quick_View_Into_a_Compiler_(Lightning_Talk)&quot;&gt;A Very Quick View Into a Compiler (Lightning Talk)&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;CompilerIntro.pdf&quot;&gt;Slides&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;CompilerIntroNotes.pdf&quot;&gt;Notes&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=j0EU1lcQ2js&quot;&gt;Video&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;FASTBuild:_A_Short_Introduction__(Lightning_Talk)&quot;&gt;FASTBuild: A Short Introduction  (Lightning Talk)&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;FASTBuild.pdf&quot;&gt;Slides&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;FASTBuildNotes.pdf&quot;&gt;Notes&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Leandros&#x2F;fastbuild-example&quot;&gt;Github&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=jGz8oMdStNA&quot;&gt;Video&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;The_Case_for_Vendored_Builds_(Lightning_Talk)&quot;&gt;The Case for Vendored Builds (Lightning Talk)&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;VendoredToolchain.pdf&quot;&gt;Slides&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;content&#x2F;static&#x2F;VendoredToolchainNotes.pdf&quot;&gt;Notes&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=pGoECYvby3c&quot;&gt;Video&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
      </item>
      <item>
          <title>Resurrected</title>
          <pubDate>Sat, 30 May 2015 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2015/05/30/resurrected/</link>
          <guid>https://arvid.io/2015/05/30/resurrected/</guid>
          <description xml:base="https://arvid.io/2015/05/30/resurrected/">&lt;p&gt;I’ve resurrected my blog, and put my .io domain to a good use, and set-up a ghost blog.&lt;br &#x2F;&gt;
So far, I’ve always had my personal websites cluttered on many domains, but this came to an end, everything is now on arvid.io.&lt;&#x2F;p&gt;
&lt;p&gt;You can expect new posts in the next few weeks, I already have something prepared.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>Automatically exporting assets from Sketch into Android Studio</title>
          <pubDate>Sat, 03 May 2014 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2014/05/03/automatically-exporting-assets-from-sketch-into-android-studio/</link>
          <guid>https://arvid.io/2014/05/03/automatically-exporting-assets-from-sketch-into-android-studio/</guid>
          <description xml:base="https://arvid.io/2014/05/03/automatically-exporting-assets-from-sketch-into-android-studio/">&lt;p&gt;Matt Zanchelli wrote a &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;http:&#x2F;&#x2F;mdznr.roon.io&#x2F;automatically-exporting-assets-from-sketch-into-xcode&quot;&gt;blog post&lt;&#x2F;a&gt; about automatically exporting assets from Sketch into Xcode, unfortunately this method can only be used with Xcode projects, but fortunately we have Gradle.&lt;&#x2F;p&gt;</description>
      </item>
      <item>
          <title>[Android 4] ActionBar with Tabs example</title>
          <pubDate>Sat, 18 Feb 2012 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://arvid.io/2012/02/18/android-4-actionbar-with-tabs-example/</link>
          <guid>https://arvid.io/2012/02/18/android-4-actionbar-with-tabs-example/</guid>
          <description xml:base="https://arvid.io/2012/02/18/android-4-actionbar-with-tabs-example/">&lt;p&gt;Example Application &amp;amp; Code for ActionBar with Tabs Layout optimized for Android 4.0.&lt;br &#x2F;&gt;
I’am slowly optimizing my apps for Android 4.0 and because there aren’t much Example &#x2F; Resources I thought I publish my own code as example. It is a simple Layout. Code and anything else after break&lt;&#x2F;p&gt;</description>
      </item>
    </channel>
</rss>
