<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Lourenci&#39;s Notes</title>
    <link>https://blog.lourenci.com/</link>
    <description>Recent content on Lourenci&#39;s Notes</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 23 May 2025 11:34:59 +1000</lastBuildDate><atom:link href="https://blog.lourenci.com/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Importing Yubikey&#39;s SSH/GPG key into a new computer</title>
      <link>https://blog.lourenci.com/importing-yubikeys-ssh/gpg-key-into-a-new-computer/</link>
      <pubDate>Fri, 23 May 2025 11:34:59 +1000</pubDate>
      
      <guid>https://blog.lourenci.com/importing-yubikeys-ssh/gpg-key-into-a-new-computer/</guid>
      <description>&lt;h2 id=&#34;importing-the-ssh-key&#34;&gt;Importing the SSH key&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Mac Sequoia&amp;#39;s `openssh` doesn&amp;#39;t support FIDO2 resident keys.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew install openssh
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Import the SSH key from Yubikey into the current path.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ssh-keygen -K
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Move the private key to the ssh default location for keys.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mv id_ecdsa_sk_rk ~/.ssh/id_ecdsa_sk
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;importing-the-gpg-key&#34;&gt;Importing the GPG key&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Mac doesn&amp;#39;t include gpg by default.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew install gnupg
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Create the stub for the secret key in your machine.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gpg --card-status
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Import the GPG key using the public file.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gpg --import key.pub
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Some SQL tips I&#39;ve learned over the last few years</title>
      <link>https://blog.lourenci.com/some-sql-tips-ive-learned-over-the-last-few-years/</link>
      <pubDate>Sun, 27 Apr 2025 10:52:07 +1000</pubDate>
      
      <guid>https://blog.lourenci.com/some-sql-tips-ive-learned-over-the-last-few-years/</guid>
      <description>&lt;p&gt;&amp;hellip;even though I spent part of my career writing SQL queries in corporations.&lt;/p&gt;
&lt;h2 id=&#34;temporary-tables-with-with&#34;&gt;Temporary tables with &lt;code&gt;with&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;with&lt;/code&gt; can be used to create temporary tables that can be used in the main query.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;with&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cities&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;as&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;(&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;select&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;name,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;state&lt;/span&gt;,&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;population&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;from&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;city&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;select&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;from&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cities&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;where&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;population&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#099&#34;&gt;1000000&lt;/span&gt;;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;filter-in-aggregated-columns&#34;&gt;&lt;code&gt;filter&lt;/code&gt; in aggregated columns&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;having&lt;/code&gt; is not the only way to filter aggregated columns. &lt;code&gt;filter&lt;/code&gt; is much simpler and doesn&amp;rsquo;t require creating subqueries for multiple aggregated columns.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;select&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;state&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;,&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;count&lt;/span&gt;(&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;as&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;qty_cities&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;      &lt;/span&gt;,&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;count&lt;/span&gt;(&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;filter&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;(&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;where&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;population&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#099&#34;&gt;1000000&lt;/span&gt;)&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;as&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;qty_big_cities&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bbb&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;from&lt;/span&gt;&lt;span style=&#34;color:#bbb&#34;&gt; &lt;/span&gt;cities&lt;span style=&#34;color:#bbb&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Vim tricks</title>
      <link>https://blog.lourenci.com/vim-tricks/</link>
      <pubDate>Mon, 14 Apr 2025 17:36:14 +1000</pubDate>
      
      <guid>https://blog.lourenci.com/vim-tricks/</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Q&lt;/code&gt; in normal mode to execute the last recorded macro.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;\{-}&lt;/code&gt; as non-greedy regex symbol.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;\_.&lt;/code&gt; to match any character including newline (multi-line).&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;\Vpattern&lt;/code&gt; (very non-magic) to match the pattern literally, only &lt;code&gt;^&lt;/code&gt; and &lt;code&gt;$&lt;/code&gt; will have special meaning.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;\vpattern&lt;/code&gt; (very magic) to match the pattern as a regex.&lt;/li&gt;
&lt;li&gt;Classic negative/positive lookahead/behind (example in very magic):&lt;/li&gt;
&lt;/ul&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;lookbehind&lt;/th&gt;
&lt;th&gt;lookahead&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;positive&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;(atom)@&amp;lt;=&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;(atom)@=&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;negative&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;(atom)@&amp;lt;!&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;(atom)@!&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;\L&lt;/code&gt; (eg.: &lt;code&gt;s/.*/\L&amp;amp;/&lt;/code&gt;) to lowercase the match; use &lt;code&gt;\U&lt;/code&gt; (eg.: &lt;code&gt;s/.*/\U&amp;amp;/&lt;/code&gt;) to uppercase it.&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>How to backup and restore Docker volumes</title>
      <link>https://blog.lourenci.com/how-to-backup-and-restore-docker-volumes/</link>
      <pubDate>Fri, 01 Sep 2023 10:31:52 +1000</pubDate>
      
      <guid>https://blog.lourenci.com/how-to-backup-and-restore-docker-volumes/</guid>
      <description>&lt;p&gt;Recently, I had to update a major version of Debian. 

	&lt;a href=&#34;https://www.debian.org/releases/stable/amd64/release-notes/ch-upgrading.en.html#removing-non-debian-packages&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;One of their &amp;ldquo;before starting updating&amp;rdquo; steps is to remove all non-Debian installed packages&lt;/a&gt;

. Docker is one of them. Uninstalling Docker is as simple as &lt;code&gt;$ sudo apt-get purge docker&lt;/code&gt; if I was not relying heavily on external volumes.&lt;/p&gt;
&lt;p&gt;But, it turns out backup-ing an external volume is very straightforward:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Backup the output command&amp;#39;s path&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker volume inspect &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;volume&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt; | jq -r &lt;span style=&#34;color:#d14&#34;&gt;&amp;#34;.[].Mountpoint&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# You can use tar for that&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tar czf backup.tar.gz &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;mount-point&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once you have Docker installed again, all you need to do is copy the backup file to the new Docker volume:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Create your new volume&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker volume create &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;volume&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Get the new volume&amp;#39;s path&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker volume inspect &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;volume&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt; | jq -r &lt;span style=&#34;color:#d14&#34;&gt;&amp;#34;.[].Mountpoint&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# You can use tar for that&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tar xf backup.tar.gz --directory&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;={&lt;/span&gt;mount-point&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Creating a partition larger than 2TB on Debian</title>
      <link>https://blog.lourenci.com/creating-a-partition-larger-than-2tb-on-debian/</link>
      <pubDate>Tue, 28 Feb 2023 20:01:10 +1100</pubDate>
      
      <guid>https://blog.lourenci.com/creating-a-partition-larger-than-2tb-on-debian/</guid>
      <description>&lt;p&gt;Debian (&lt;code&gt;fdisk&lt;/code&gt;) doesn&amp;rsquo;t support creating a partition larger than 2TB due to using the MBR partition table. You&amp;rsquo;ll need to use GPT instead:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install parted
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Check the disk you want to format&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo fdisk -l
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Replace /sdx for the disk you want to format&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo parted /dev/sdx
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mklabel gpt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;quit
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo parted -a optimal /dev/sdx mkpart primary &lt;span style=&#34;color:#d14&#34;&gt;&amp;#39;0%&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#d14&#34;&gt;&amp;#39;100%&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now you can format the partition with the file system you want:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo mkfs.ext4 /dev/sdx1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You should be able to replace the &lt;code&gt;mkfs.ext4&lt;/code&gt; command with &lt;code&gt;mkfs.exfat&lt;/code&gt; if you want that file system (see 

	
	&lt;a href=&#34;#which-partition-type-to-choose&#34;&gt;section below&lt;/a&gt;

)&lt;/p&gt;
&lt;h2 id=&#34;which-partition-type-to-choose&#34;&gt;Which partition type to choose?&lt;/h2&gt;
&lt;p&gt;As a rule of thumb:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;ext4&lt;/code&gt; if you plan to use the disk only on linux.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;exFAT&lt;/code&gt; if you plan to share between multiples OS. Linux, Windows and MacOS support it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Debian out-the-box does not support &lt;code&gt;exFAT&lt;/code&gt;. You&amp;rsquo;ll need to install fuse:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install exfat-fuse exfat-utils
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>How to stash only some files?</title>
      <link>https://blog.lourenci.com/how-to-stash-only-some-files/</link>
      <pubDate>Thu, 14 Jul 2022 19:25:51 +1000</pubDate>
      
      <guid>https://blog.lourenci.com/how-to-stash-only-some-files/</guid>
      <description>&lt;p&gt;Since 

	&lt;a href=&#34;https://github.com/git/git/compare/ae900ebd71b58c12356674228ce99e6673da3dec...9e140909f611fff720efc914b7186b8e4ab722cd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Git 2.13&lt;/a&gt;

, we&amp;rsquo;re able to stash only some specific files from your working tree. 🙏🏻&lt;/p&gt;
&lt;p&gt;In order to do that:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git stash &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;--patch&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt; -- &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;files...&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt; &lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# or&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git stash push &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;--patch&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;files...&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Using two-way merge/conflict tool in (n)vim</title>
      <link>https://blog.lourenci.com/using-two-way-merge/conflict-tool-in-nvim/</link>
      <pubDate>Thu, 05 May 2022 20:15:00 +1000</pubDate>
      
      <guid>https://blog.lourenci.com/using-two-way-merge/conflict-tool-in-nvim/</guid>
      <description>&lt;p&gt;I don&amp;rsquo;t like 3-ways merge. For a long time, I&amp;rsquo;ve been using this 

	&lt;a href=&#34;https://github.com/whiteinge/diffconflicts&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;plugin&lt;/a&gt;

 to solve my merge conflicts in a 2-way way.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
	&lt;img src=&#34;./messy-git-conflicts.png&#34; alt=&#34;messy-git-conflicts&#34;&gt;
	
		&lt;figcaption&gt;🤢&lt;/figcaption&gt;
	
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;In a Reddit 

	&lt;a href=&#34;https://www.reddit.com/r/neovim/comments/ug96n9/comment/i72djxv/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;comment&lt;/a&gt;

 today, someone posted that Git has built-in support to 2-ways in (n)vim since 2021 🤯.&lt;/p&gt;
&lt;p&gt;To activate it, first check if your Git version supports it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# (n)vimdiff1 is what you are looking for&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git mergetool --tool-help
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After checking the support, enable it with:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git mergetool --tool&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt;nvimdiff1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git config --global mergetool.hideResolved &lt;span style=&#34;color:#0086b3&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Amazon AWS</title>
      <link>https://blog.lourenci.com/amazon-aws/</link>
      <pubDate>Mon, 02 May 2022 20:30:00 +1000</pubDate>
      
      <guid>https://blog.lourenci.com/amazon-aws/</guid>
      <description>&lt;h2 id=&#34;rds&#34;&gt;RDS&lt;/h2&gt;
&lt;p&gt;It&amp;rsquo;s the amazon service to use a relational database.&lt;/p&gt;
&lt;p&gt;There are lots of databases available for usage: Postgres, aurora…&lt;/p&gt;
&lt;h2 id=&#34;sqs&#34;&gt;SQS&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;S&lt;/strong&gt;imple &lt;strong&gt;Q&lt;/strong&gt;ueue &lt;strong&gt;S&lt;/strong&gt;ervice is used to implement a queue to deliver messages.&lt;/p&gt;
&lt;p&gt;You put a message in the queue, which is available for some service to poll (get) it.&lt;/p&gt;
&lt;p&gt;Note that the message is removed¹ from the queue as soon as some service polls the message. Thus you cannot &amp;ldquo;get&amp;rdquo; this message in multiple services. Note that the queue does not keep the arrival order of the messages, although you can specify that you want to keep this order on the queue creation.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
	&lt;img src=&#34;./sqs.png&#34; alt=&#34;sqs&#34;&gt;
	
		&lt;figcaption&gt;*&lt;/figcaption&gt;
	
&lt;/figure&gt;

¹Technically, the message is not removed from the queue until the consumer deletes it. When the message is polled, AWS hides the message and it will be back again after the visibility time-out times out. It&amp;rsquo;s up to the consumer to delete the message. 

	&lt;a href=&#34;https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#:~:text=When%20Lambda%20receives%20a%20batch%2C%20the%20messages%20stay%20in%20the%20queue%20but%20are%20hidden%20for%20the%20length%20of%20the%20queue%27s%20%20%20%20%20%20%20%20%20%20%20%20visibility%20timeout.%20If%20your%20function%20successfully%20processes%20all%20messages%20in%20the%20batch%2C%20Lambda%20deletes%20%20%20%20%20%20the%20messages%20from%20the%20queue.&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;When consuming it via Lambda, Lambda will automatically delete the message if no error is thrown or returned.&lt;/a&gt;

&lt;/p&gt;
&lt;h2 id=&#34;sns&#34;&gt;SNS&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;S&lt;/strong&gt;imple &lt;strong&gt;N&lt;/strong&gt;otification &lt;strong&gt;S&lt;/strong&gt;ervice is a service from Amazon used implement a notification system.&lt;/p&gt;
&lt;p&gt;The SNS is like an implementation of a PubSub. You put a message into the SNS Topic, and the SNS will notify all the systems listening to this topic.&lt;/p&gt;
&lt;p&gt;The SNS retries to deliver the message whenever it fails to be delivered (this is configured, and by default, to this date, it&amp;rsquo;s three). When the number of retries is exhausted, the SNS will either discard the message or sends it to a dead-letter queue (DLQ)&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
	&lt;img src=&#34;./sns.png&#34; alt=&#34;sns&#34;&gt;
	
		&lt;figcaption&gt;*&lt;/figcaption&gt;
	
&lt;/figure&gt;
&lt;/p&gt;
&lt;h2 id=&#34;dynamodb&#34;&gt;DynamoDB&lt;/h2&gt;
&lt;h3 id=&#34;dynamodb-streams&#34;&gt;DynamoDB Streams&lt;/h3&gt;
&lt;p&gt;Unlike a queue, a &lt;strong&gt;stream&lt;/strong&gt; is a persistent data structure. &lt;strong&gt;Streams&lt;/strong&gt; buffer messages from the producers in an append-only file to be read by the consumers. Consumers can read the stream multiple times, and they need to know which messages they have already read or want to read.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;DynamoDB&lt;/code&gt; streams are used to capture changes in the &lt;code&gt;DynamoDB&lt;/code&gt; tables. You can use it as a trigger to a &lt;code&gt;lambda&lt;/code&gt;. The &lt;code&gt;lambda&lt;/code&gt; polls the stream for changes four times for seconds, and by default, it keeps retrying the batch until it processes it successfully or the batch expires.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
	&lt;img src=&#34;dynamodb-streams.png&#34; alt=&#34;DynamoDB streams&#34;&gt;
	
&lt;/figure&gt;
&lt;/p&gt;
&lt;h2 id=&#34;vpc&#34;&gt;VPC&lt;/h2&gt;
&lt;p&gt;Logical isolated network.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
	&lt;img src=&#34;./vpc.png&#34; alt=&#34;vpc&#34;&gt;
	
&lt;/figure&gt;
￼&lt;/p&gt;
&lt;h3 id=&#34;nat-gateway&#34;&gt;NAT Gateway&lt;/h3&gt;
&lt;p&gt;It allows a &lt;strong&gt;VPC&lt;/strong&gt; network to connect to external devices. NAT could be either:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Public&lt;/strong&gt;: to allow the VPC to access the public internet.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Public NAT does not allow unsolicited inbound requests.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Private&lt;/strong&gt;: to allow the VPC to access other VPCs.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;*&lt;/strong&gt;: I got it from the internet, and I don&amp;rsquo;t remember the source. Sorry for that. Just give a hint if it&amp;rsquo;s yours, and I&amp;rsquo;ll update the refs.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Your computer has two clocks</title>
      <link>https://blog.lourenci.com/your-computer-has-two-clocks/</link>
      <pubDate>Fri, 29 Apr 2022 20:12:00 +0000</pubDate>
      
      <guid>https://blog.lourenci.com/your-computer-has-two-clocks/</guid>
      <description>&lt;p&gt;You may not realise this, but your computer has a battery inside it only to get your computer clock running. Back in the 90s, when the rechargeable (lithium-ion) battery was not cheap, we used to disassemble our computers to replace their clock battery when the computer could not keep the clock &amp;ldquo;on time&amp;rdquo; anymore. Yeah, your computer clock is a &amp;ldquo;thing&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Like your old wall-clock, it’s impossible to get the computer ones ticking at the precise time. Your OS tries its best to put it in sync, bringing a more accurate time from the internet (NTP servers), but it is its best after all.&lt;/p&gt;
&lt;h2 id=&#34;ntp-servers&#34;&gt;NTP Servers&lt;/h2&gt;
&lt;p&gt;Once in a while your OS goes to the internet to prevent your computer&amp;rsquo;s clock from falling (much) behind or ahead of time. Those servers are called NTP servers.&lt;/p&gt;
&lt;p&gt;NTP servers are explicitly designed to tell other computers the &amp;ldquo;right&amp;rdquo; time. They, generally, have specific timer devices attached to them, like atomic clocks and GPS receivers. The communication your computer does with them is over a particular protocol called &lt;strong&gt;N&lt;/strong&gt;etwork &lt;strong&gt;T&lt;/strong&gt;ime &lt;strong&gt;P&lt;/strong&gt;rotocol.&lt;/p&gt;
&lt;p&gt;When your computer tries to reach an NTP server to its clock, other things have to be taken into account:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Your computer could take several seconds to talk to the server, so this &amp;ldquo;delay&amp;rdquo; (latency) should be considered.&lt;/li&gt;
&lt;li&gt;The server can potentially have the wrong time, like your computer.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;NTP protocol is designed with specific algorithms to solve those (and more) issues.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
	&lt;img src=&#34;Pasted%20image%2020220428200328.png&#34; alt=&#34;NTP servers&#34;&gt;
	
		&lt;figcaption&gt;NTP servers trying to get the most accurate time&lt;/figcaption&gt;
	
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;With that in mind, your OS provides you with two different clocks: the real-time clock and the monotonic clock.&lt;/p&gt;
&lt;h2 id=&#34;real-time-clock&#34;&gt;Real-time clock&lt;/h2&gt;
&lt;p&gt;The real-time clock is that one you stare at your computer when you are hungry and eagerly waiting for noon to have your lunch. When your computer clock gets out of sync, and the OS detects that through the NTP servers, the clock will be adjusted automatically.&lt;/p&gt;
&lt;p&gt;Note that your clock could be ahead (or behind) of that time returned by the NTP server. The OS will adjust your computer clock accordingly.&lt;/p&gt;
&lt;h2 id=&#34;monotonic-clock&#34;&gt;Monotonic clock&lt;/h2&gt;
&lt;p&gt;This is the clock that led me to write this post in the first place. I had no idea of this concept until I came across recently on it in the excellent book 

	&lt;a href=&#34;https://www.goodreads.com/book/show/23463279-designing-data-intensive-applications&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Designing Data-Intensive Applications&lt;/a&gt;

 by Martin Kleppmann.&lt;/p&gt;
&lt;p&gt;This clock is a relative time since some base date that you get from your OS. The most popular is the Epoch one: number of seconds since 1 January 1970 (UTC).&lt;/p&gt;
&lt;p&gt;When your OS detects through the NTP servers that its clock is ahead (or behind), the OS will not adjust its clock jumping directly to that time but, instead, it will start to adapt its pace slower/faster to get it in sync with the more accurate date. This clock is guaranteed to never get back in time.&lt;/p&gt;
&lt;h2 id=&#34;why-is-this-important&#34;&gt;Why is this important?&lt;/h2&gt;
&lt;p&gt;Your code should never rely on clocks, let alone the real-time ones! The problem is even worst in a distributed system when multiple machines are involved where each one has its concept of &amp;ldquo;now&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt;: clocks are not stable and precise. The real-time clock can even go back in time.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Cleaning up not-used Docker images/containers/volumes</title>
      <link>https://blog.lourenci.com/cleaning-up-not-used-docker-images/containers/volumes/</link>
      <pubDate>Wed, 27 Apr 2022 18:10:06 +1000</pubDate>
      
      <guid>https://blog.lourenci.com/cleaning-up-not-used-docker-images/containers/volumes/</guid>
      <description>&lt;p&gt;Docker has a built-in command to prune all the dangling (not-used) Docker images/containers/volumes:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker system prune --volumes
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>How to remove a Brew package and all its dependencies?</title>
      <link>https://blog.lourenci.com/how-to-remove-a-brew-package-and-all-its-dependencies/</link>
      <pubDate>Thu, 14 Oct 2021 08:47:14 -0300</pubDate>
      
      <guid>https://blog.lourenci.com/how-to-remove-a-brew-package-and-all-its-dependencies/</guid>
      <description>&lt;p&gt;TIL You can use the &lt;code&gt;autoremove&lt;/code&gt; command to remove the leftovers from a package previously installed by brew.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;List all the installed packages:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew leaves
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Remove an installed package:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew uninstall &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;package&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Remove all the leftovers from an uninstalled package:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew autoremove
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When executing this command, pay attention to &lt;code&gt;stdout&lt;/code&gt;. Brew does not clear some (config) files left from the &lt;code&gt;autoremove&lt;/code&gt; command and it warnings you about that.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>What is the difference between a Component and a PureComponent?</title>
      <link>https://blog.lourenci.com/what-is-the-difference-between-a-component-and-a-purecomponent/</link>
      <pubDate>Mon, 05 Aug 2019 20:50:00 +0000</pubDate>
      
      <guid>https://blog.lourenci.com/what-is-the-difference-between-a-component-and-a-purecomponent/</guid>
      <description>&lt;p&gt;In the class components land, you can define a component either by extending it from &lt;code&gt;React.Component&lt;/code&gt; or from &lt;code&gt;React.PureComponent&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Whatever component you use, when it changes its state or it receives a new prop from its parent, React will call the &lt;code&gt;render&lt;/code&gt; lifecycle method of the component and of the all children of the component, the famous VDOM (kind of DOM in memory) will be generated and React will compare the generated VDOM to the previous generated VDOM (render phase), if any changes are detected React will apply them to the real DOM (commit phase). It&amp;rsquo;s much cheaper and faster to deal with the VDOM than to the real DOM, that&amp;rsquo;s the magic behind the &amp;ldquo;modern&amp;rdquo; front-end libs to be very fast.&lt;/p&gt;
&lt;p&gt;Even React doing a lot of work under the hood to keep this process fast, the &lt;code&gt;render&lt;/code&gt; method is the most expensive &amp;ldquo;routine&amp;rdquo; in it. We should avoid it whenever it&amp;rsquo;s possible.&lt;/p&gt;
&lt;h2 id=&#34;shouldcomponentupdate-lifecycle-method&#34;&gt;&lt;code&gt;shouldComponentUpdate&lt;/code&gt; lifecycle method&lt;/h2&gt;
&lt;p&gt;Just before to call the &lt;code&gt;render&lt;/code&gt; method, React will call the &lt;code&gt;shouldComponentUpdate&lt;/code&gt; lifecycle method passing the &lt;code&gt;prevProps&lt;/code&gt; and the &lt;code&gt;prevState&lt;/code&gt; as parameters. You can use this hook to prevent your component to be rendered. If you return &lt;code&gt;false&lt;/code&gt; on it, React will not perform the render, thus it will not call the &lt;code&gt;render&lt;/code&gt; lifecycle method. The &lt;code&gt;&amp;lt;Counter /&amp;gt;&lt;/code&gt; below will never be shown updated:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;class&lt;/span&gt; Counter &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;extends&lt;/span&gt; React.Component {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  constructor (props) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;super&lt;/span&gt;(props)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;this&lt;/span&gt;.state &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt; { value&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#099&#34;&gt;0&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  shouldComponentUpdate (_prevProps, _prevState) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#998;font-style:italic&#34;&gt;// This will make the render to never be called.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  render () {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;return&lt;/span&gt; (
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#000080&#34;&gt;div&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;&lt;span style=&#34;color:#000080&#34;&gt;span&lt;/span&gt;&amp;gt;{&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;this&lt;/span&gt;.state.value}&amp;lt;/&lt;span style=&#34;color:#000080&#34;&gt;span&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;&lt;span style=&#34;color:#000080&#34;&gt;button&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          &lt;span style=&#34;color:#008080&#34;&gt;type&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#d14&#34;&gt;&amp;#39;button&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          &lt;span style=&#34;color:#008080&#34;&gt;onClick&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt;{() =&amp;gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;this&lt;/span&gt;.setState(({ value }) =&amp;gt; ({ value&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; value &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#099&#34;&gt;1&lt;/span&gt; }))}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          Increment
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;/&lt;span style=&#34;color:#000080&#34;&gt;button&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/&lt;span style=&#34;color:#000080&#34;&gt;div&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    )
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;where-does-the-purecomponent-differ-from-the-component&#34;&gt;Where does the &lt;code&gt;PureComponent&lt;/code&gt; differ from the &lt;code&gt;Component&lt;/code&gt;?&lt;/h2&gt;
&lt;p&gt;When a component receives a new value for the prop or for the state, React will call the &lt;code&gt;render&lt;/code&gt; method even when the change is to the same value.&lt;/p&gt;
&lt;p&gt;With that in mind, 

	&lt;a href=&#34;https://github.com/facebook/react/blob/0c1ec049f8832d1c27f876844666fda393036800/packages/react-reconciler/src/ReactFiberClassComponent.js#L297-L301&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;the &lt;code&gt;PureComponent&lt;/code&gt; has an implementation of the &lt;code&gt;shouldComponentUpdate&lt;/code&gt; hook that performs a shallow comparison between the &lt;code&gt;prevProps&lt;/code&gt; with the new &lt;code&gt;props&lt;/code&gt; and the &lt;code&gt;prevState&lt;/code&gt; with the new &lt;code&gt;state&lt;/code&gt;&lt;/a&gt;

. When the change is to the same values, the React &lt;code&gt;shouldComponentUpdate&lt;/code&gt; implementation will return &lt;code&gt;false&lt;/code&gt; preventing the &lt;code&gt;render&lt;/code&gt; method to be called.&lt;/p&gt;
&lt;p&gt;To demonstrate that, I made the component below that keeps a state for a value and it renders two components to show this value: one through the &lt;code&gt;PureComponent&lt;/code&gt; and another with the &lt;code&gt;Component&lt;/code&gt;. When the button is clicked, the state is changed to the same value. Every time the &lt;code&gt;render&lt;/code&gt; is called on these components, a log appears in the console to show their updates. Click on the button and look at the console.&lt;/p&gt;
&lt;!-- raw HTML omitted --&gt;
&lt;p&gt;A shallow comparison is about to not be deep in some array or object comparison. If an object has others objects inside it, this inner objects will not be compared. Furthermore, objects (including arrays and functions) are compared by their references and primitives values by their values. 

	&lt;a href=&#34;https://github.com/facebook/react/blob/42794557ca44a8c05c71aab698d44d1294236538/packages/shared/shallowEqual.js&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;You can see the &lt;code&gt;shallow&lt;/code&gt; code on React&amp;rsquo;s github&lt;/a&gt;

.&lt;/p&gt;
&lt;p&gt;The use of the &lt;code&gt;PureComponent&lt;/code&gt; is a good strategy to get a better performance on your project.&lt;/p&gt;
&lt;h2 id=&#34;leveraging-the-purecomponent&#34;&gt;Leveraging the &lt;code&gt;PureComponent&lt;/code&gt;&lt;/h2&gt;
&lt;h3 id=&#34;dont-mutate&#34;&gt;Don&amp;rsquo;t mutate&lt;/h3&gt;
&lt;p&gt;You shouldn&amp;rsquo;t mutate any parent&amp;rsquo;s object that you pass through a prop to its &lt;code&gt;pure&lt;/code&gt; children, once they will perform a shallow comparison before to call the &lt;code&gt;render&lt;/code&gt;, your UI children won&amp;rsquo;t get updated.&lt;/p&gt;
&lt;h3 id=&#34;try-to-bind-functions-in-constructor-whenever-its-possible&#34;&gt;Try to bind functions in constructor whenever it&amp;rsquo;s possible&lt;/h3&gt;
&lt;p&gt;Every time the &lt;code&gt;render&lt;/code&gt; of the parent of this &lt;code&gt;PureComponent&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#000080&#34;&gt;PureCounter&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008080&#34;&gt;fn&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt;{&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;this&lt;/span&gt;.callback.bind(&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;this&lt;/span&gt;, &lt;span style=&#34;color:#d14&#34;&gt;&amp;#39;arg&amp;#39;&lt;/span&gt;)}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008080&#34;&gt;value&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt;{&lt;span style=&#34;color:#099&#34;&gt;1&lt;/span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;is called, a new function will be created and the &lt;code&gt;shouldComponentUpdate&lt;/code&gt; will fail. This happens with arrow functions too.&lt;/p&gt;
&lt;p&gt;In order to avoid that, you could pass the handle as one prop and its argument as another prop. Something like that:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;// this.callback is binded in constructor.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;&lt;/span&gt;&amp;lt;&lt;span style=&#34;color:#000080&#34;&gt;PureCounter&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008080&#34;&gt;fn&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt;{&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;this&lt;/span&gt;.callback}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008080&#34;&gt;fnArg&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#d14&#34;&gt;&amp;#39;arg&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008080&#34;&gt;value&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt;{&lt;span style=&#34;color:#099&#34;&gt;1&lt;/span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;// PureCounter/index.js
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;&lt;/span&gt;onClick () {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;this&lt;/span&gt;.props.fn(&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;this&lt;/span&gt;.props.fnArg)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;what-about-the-functional-components&#34;&gt;What about the functional components?&lt;/h2&gt;
&lt;p&gt;Now after one year that Hooks are around, you have been asking yourself: what is the functional component way for &lt;code&gt;PureComponent&lt;/code&gt;?&lt;/p&gt;
&lt;h3 id=&#34;reactmemo&#34;&gt;&lt;code&gt;React.memo&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;React.memo&lt;/code&gt; is a high order component that receives a component and returns you another component. This new component will be able to do a shallow comparison on its props then the rerender will not take place if nothing has changed.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;const&lt;/span&gt; MyCleverComponent &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt; React.memo(&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;function&lt;/span&gt; MyComponent(props) {})
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that &lt;code&gt;React.memo&lt;/code&gt; doesn&amp;rsquo;t prevent a rerender from a state change, whereas the &lt;code&gt;PureComponent&lt;/code&gt; does, but you can also use &amp;ldquo;memo&amp;rdquo; on its children too.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>How to update the Jest&#39;s jsdom to the latest version</title>
      <link>https://blog.lourenci.com/how-to-update-the-jests-jsdom-to-the-latest-version/</link>
      <pubDate>Mon, 29 Jul 2019 11:12:00 +0000</pubDate>
      
      <guid>https://blog.lourenci.com/how-to-update-the-jests-jsdom-to-the-latest-version/</guid>
      <description>&lt;p&gt;Jest comes with jsdom to mount your components. When you mount your component with render libs like &lt;code&gt;@testing-library&lt;/code&gt; or &lt;code&gt;enzyme&lt;/code&gt;, this component will be mounted on jsdom.&lt;/p&gt;
&lt;p&gt;

	&lt;a href=&#34;https://github.com/jsdom/jsdom&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;jsdom&lt;/a&gt;

 is a JavaScript implementation of a &amp;ldquo;browser&amp;rdquo;. It tries to implement both DOM and HTML standards capabilities to make sure you&amp;rsquo;ll be able to mount and test your components in memory like it was running in a browser.&lt;/p&gt;
&lt;p&gt;Like your browser, you need to keep jsdom up-to-date to get the last implementations of it.&lt;/p&gt;
&lt;p&gt;Unfortunately, Jest@24 comes with jsdom&amp;rsquo;s 11 version for compatibility reasons:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: Jest comes with JSDOM@11 by default. Due to JSDOM 12 and newer dropping support for Node 6, Jest is unable to upgrade for the time being.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;At the time of writing this, jsdom is already on 15 version. There are lots of new features over the version 11.&lt;/p&gt;
&lt;p&gt;For install the most recent version, all you have to do is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install the most recent jsdom environment:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;yarn add jest-environment-jsdom-fifteen --dev
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Configure Jest to use it. In in your &lt;code&gt;jest.config.js&lt;/code&gt;:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  testEnvironment&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#d14&#34;&gt;&amp;#39;jest-environment-jsdom-fifteen&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>How to wrap long lines when writing markdown on Vim</title>
      <link>https://blog.lourenci.com/how-to-wrap-long-lines-when-writing-markdown-on-vim/</link>
      <pubDate>Sun, 21 Jul 2019 14:17:00 +0000</pubDate>
      
      <guid>https://blog.lourenci.com/how-to-wrap-long-lines-when-writing-markdown-on-vim/</guid>
      <description>&lt;p&gt;If you have Vim optimized for coding, probably you&amp;rsquo;ll have some problem for writing on it. The first one that comes out for me as soon as I started to writing markdown files in Vim was the word wrap question, any sentence comes longer easily and you can&amp;rsquo;t read it anymore if you have set Vim to not wrap your code.&lt;/p&gt;
&lt;p&gt;If you want to configure your Vim to wrap long lines only in markdown files, all you have to do is to create a &lt;code&gt;ftplugin&lt;/code&gt; for markdown files:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-vim&#34; data-lang=&#34;vim&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;&amp;#34; after/ftplugin/markdown.vim&lt;/span&gt;&lt;span style=&#34;color:#a61717;background-color:#e3d2d2&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a61717;background-color:#e3d2d2&#34;&gt;&lt;/span&gt;setlocal wrap&lt;span style=&#34;color:#a61717;background-color:#e3d2d2&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>My Favorite Vim Plugins</title>
      <link>https://blog.lourenci.com/my-favorite-vim-plugins/</link>
      <pubDate>Tue, 16 Jul 2019 23:22:03 +0000</pubDate>
      
      <guid>https://blog.lourenci.com/my-favorite-vim-plugins/</guid>
      <description>&lt;p&gt;It had been a long time using a heavy IDE from the JetBrains family (e.g. PhpStorm, Rubymine) and I wanted to switch to something more light and as keyboard oriented as JetBrains&amp;rsquo; IDEs. I tried VSCode, but the lack of essential shortcuts (e.g. navigate through the tree files) was the last straw for me. So, I decided to adventure in the Vim world.&lt;/p&gt;
&lt;p&gt;I started in the Vim world without any Vim bootstrap generator, I wanted to start by the Vim way and going to include some plugins as needed.
I knew I&amp;rsquo;ll end up with a lot of plugins, but I really wanted to miss a feature in Vim before to include it through a plugin. I think this is the best way to really understand and learn Vim.&lt;/p&gt;
&lt;p&gt;Now, after a year of daily usage of Vim for Web development (JS and Ruby primarily), I really end up with a list of plugins and I want to share with you some of my favorite ones and how I use them in my development routine.&lt;/p&gt;
&lt;p&gt;You can see the full list on my 

	&lt;a href=&#34;https://github.com/lourenci/dotfiles/blob/master/vim/vim.symlink/plugin/plugins.vim&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;github&lt;/a&gt;

.
None of them change the way the Vim works (there is only one exception), I try very hard to avoid these kind of plugins (e.g. vim-targets adds a very nice list of text objects, but some of them, changes the behaviour of the existing ones).&lt;/p&gt;
&lt;p&gt;The below list isn&amp;rsquo;t in any particular order.&lt;/p&gt;
&lt;h3 id=&#34;junegunnfzfvimhttpsgithubcomjunegunnfzfvim&#34;&gt;

	&lt;a href=&#34;https://github.com/junegunn/fzf.vim&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;junegunn/fzf.vim&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;For those who don&amp;rsquo;t know what fzf is, it&amp;rsquo;s a command-line fuzzy where basically you can pass any list to it and it will filter (using fuzzy) that list while you typing.&lt;/p&gt;
&lt;p&gt;This plugin provides a lot of &amp;ldquo;lists&amp;rdquo; to send to fzf.&lt;/p&gt;
&lt;p&gt;I use some of those &amp;ldquo;lists&amp;rdquo; mapped in my Vim:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:fzf&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A list of every file in your project.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:GFiles?&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A list of every git dirty file in your project.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:BTags&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A list of every buffer&amp;rsquo;s tags.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:History&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The MRU (most recent used) files.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:Buffers&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All the buffers opened.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:Ag&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In file project-wide search.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:Filetypes&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A list of all file types supported by Vim.&lt;/p&gt;
&lt;h3 id=&#34;tpopevim-surroundhttpsgithubcomtpopevim-surround&#34;&gt;

	&lt;a href=&#34;https://github.com/tpope/vim-surround&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;tpope/vim-surround&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;Tim Pope is famous by your Vim plugins. There are a lot of plugins out there made by him. Any vimmer probably use some of them.&lt;/p&gt;
&lt;p&gt;Surround is a plugin that adds some operators to Vim to work with text objects. If you don&amp;rsquo;t know what text objects are, 

	&lt;a href=&#34;https://blog.carbonfive.com/2011/10/17/vim-text-objects-the-definitive-guide/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;I recommend you to read about it&lt;/a&gt;

.&lt;/p&gt;
&lt;p&gt;In a nutshell, with Surround, you can &amp;ldquo;surround&amp;rdquo; any text with &lt;code&gt;()&lt;/code&gt; or &lt;code&gt;[]&lt;/code&gt; or &lt;code&gt;{}&lt;/code&gt; (or a lot more) with some keystrokes.&lt;/p&gt;
&lt;h3 id=&#34;michaeljsmithvim-indent-objecthttpsgithubcommichaeljsmithvim-indent-object&#34;&gt;

	&lt;a href=&#34;https://github.com/michaeljsmith/vim-indent-object&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;michaeljsmith/vim-indent-object&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;This one add a text object by the indentation of your code/text. You can delete, change, select, do any action with a block of code with some keystrokes.&lt;/p&gt;
&lt;h3 id=&#34;tpopevim-fugitivehttpsgithubcomtpopevim-fugitive&#34;&gt;

	&lt;a href=&#34;https://github.com/tpope/vim-fugitive&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;tpope/vim-fugitive&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;Another must have by Tim Pope. Fugitive is a plugin that allows you to work with git in Vim. You can execute basically any git command in Vim. In my daily usage, I use only a few commands though:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:Gread&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is the same to &lt;code&gt;git checkout [file]&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:Gwrite&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is the same to &lt;code&gt;git add [file]&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:Gdiff&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It opens a vim-diff with the buffer changes relative to the HEAD.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:Gblame&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To blame your coworker.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:Ggrep&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In file project-wide search. It&amp;rsquo;s faster than &lt;code&gt;vimgrep&lt;/code&gt;. I use it over fzf&amp;rsquo;s &lt;code&gt;Ag&lt;/code&gt; when I want to populate a quickfix list and work on this list.&lt;/p&gt;
&lt;h3 id=&#34;mbbillundotreehttpsgithubcommbbillundotree&#34;&gt;

	&lt;a href=&#34;https://github.com/mbbill/undotree&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;mbbill/undotree&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;Any change to the buffer file is kept by the Vim, you can view it with the &lt;code&gt;:undolist&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;Undotree gives you a tree view with the buffer changes where you can navigate through them.&lt;/p&gt;
&lt;p&gt;I really recommend you to set the persistent undo: all the changes are always kept by the Vim, even when you close it.
You can activate the persistent undo in your dotfile:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vimscript&#34; data-lang=&#34;vimscript&#34;&gt;set undodir=~/.vim/undo/
set undofile
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;junegunnvim-peekaboohttpsgithubcomjunegunnvim-peekaboo&#34;&gt;

	&lt;a href=&#34;https://github.com/junegunn/vim-peekaboo&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;junegunn/vim-peekaboo&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;Vim has a concept of registers. Basically, when you copy a text that text goes to a fixed register. You can copy a text to a specific register and use it after accessing that register. A macro goes to a register. The last search goes to another register&amp;hellip;&lt;/p&gt;
&lt;p&gt;When you press a key that waits for a register, Peekaboo will automatically open an unobtrusive splitted window with all registers and its content.&lt;/p&gt;
&lt;h3 id=&#34;janko-mvim-testhttpsgithubcomjankovim-test&#34;&gt;

	&lt;a href=&#34;https://github.com/janko/vim-test/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;janko-m/vim-test&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;I make a lot of tests in my day. With vim-test, I can go to a specified spec&amp;rsquo;s context and run it with the &lt;code&gt;:TestNearest&lt;/code&gt; command. Vim-test will automatically detect my test IDE and run only that context on that IDE. It&amp;rsquo;s beautiful.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve some commands mapped in my Vim:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:TestNearest&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It runs the context where your cursor is over.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:TestFile&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It runs the entire test file.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:TestLast&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It runs the last executed test.&lt;/p&gt;
&lt;p&gt;This is very useful, you can run a specific context and goes to the code to make that context to be green. You can run the last test without head over to it, directly in the code.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:TestVisit&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It heads your over to the last executed test.&lt;/p&gt;
&lt;h3 id=&#34;nelstromvim-visual-star-searchhttpsgithubcomnelstromvim-visual-star-search&#34;&gt;

	&lt;a href=&#34;https://github.com/nelstrom/vim-visual-star-search&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;nelstrom/vim-visual-star-search&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;I said earlier that I don&amp;rsquo;t like plugins that change the Vim way, its behaviour of working. This plugin is the exception.&lt;/p&gt;
&lt;p&gt;I can&amp;rsquo;t understand why the Vim doesn&amp;rsquo;t do this by default. When you visual select a text and press the &lt;code&gt;*&lt;/code&gt; (or &lt;code&gt;#&lt;/code&gt;), Vim&amp;rsquo;ll search for the word where the cursor is over. With this plugin, you change the Vim behaviour to find by the entire selected text.&lt;/p&gt;
&lt;h3 id=&#34;neoclidecocnvimhttpsgithubcomneoclidecocnvim&#34;&gt;

	&lt;a href=&#34;https://github.com/neoclide/coc.nvim&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;neoclide/coc.nvim&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;Coc is the best auto complete for Vim out there. First, it simple works: easy to install it and easy to update it. Second, it has full LSP support. Third, it&amp;rsquo;s very extensible.&lt;/p&gt;
&lt;p&gt;The source for the auto complete is powered by the extensions that you have to install in Coc. I&amp;rsquo;ve removed a few plugins with these extensions. I don&amp;rsquo;t need more Ale. I don&amp;rsquo;t need more vim-gitgutter&amp;hellip;&lt;/p&gt;
&lt;p&gt;Some commands I&amp;rsquo;ve mapped in my Vim:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;Plug&amp;gt;(coc-rename)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It renames a method or a var. As Coc has support to LSP, it can rename even when the var is on another buffer.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;Plug&amp;gt;(coc-definition)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It goes to the method definition wherever it&amp;rsquo;s.&lt;/p&gt;
&lt;p&gt;Some extensions that I use:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;coc-tsserver&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;IntelliSense for JavaScript and Typescript.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;coc-eslint&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It runs eslint on buffer file and can run &lt;code&gt;--fix&lt;/code&gt; on it on save.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;coc-html&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For html.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;coc-solargraph&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For ruby.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;coc-git&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It substitutes the vim-gitgutter and add some git capabilities that support vim-fugitive.
With some mapped commands, I can diff a chunk, I can undo a chunk, I can see the git history of a buffer file and diff it with the local, I can go to the next or previous change&amp;hellip;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;coc-tabnine&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For tabnine.


	&lt;a href=&#34;https://tabnine.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;TabNine&lt;/a&gt;

 is a kind of IntelliSense with AI. It doesn&amp;rsquo;t complete only methods or vars, It completes all the expression. It&amp;rsquo;s very hard to live without it once you get the hang of it.&lt;/p&gt;
&lt;h3 id=&#34;bonus-github-colorschemehttpsgithubcomcormacrelfvim-colors-github&#34;&gt;BONUS: 

	&lt;a href=&#34;https://github.com/cormacrelf/vim-colors-github&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Github colorscheme&lt;/a&gt;

&lt;/h3&gt;
&lt;p&gt;Don&amp;rsquo;t judge me, I use light theme. I think it&amp;rsquo;s less stressful for my eyes because I can use it with less display brightness than dark themes and it reduces the light reflection on my screen.&lt;/p&gt;
&lt;p&gt;I think that a colorscheme must have a nice soft fold color and it has to take care of the diff colors. I have to see the diff and immediately spot what is going on in my code. This colorscheme has these very well implemented.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Debian installation and first steps</title>
      <link>https://blog.lourenci.com/debian-installation-and-first-steps/</link>
      <pubDate>Wed, 10 May 2017 00:00:00 +1100</pubDate>
      
      <guid>https://blog.lourenci.com/debian-installation-and-first-steps/</guid>
      <description>&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;
&lt;p&gt;Debian doesn&amp;rsquo;t come with non-free firmwares, so it might be necessary to install them. There is a link for the firmwares in Debian&amp;rsquo;s downloads page (page with the &lt;code&gt;.iso&lt;/code&gt; files).&lt;/p&gt;
&lt;p&gt;You can use the same USB with the bootable Debian for those firmwares: after restoring the Debian&amp;rsquo;s ISO into a USB, you can create a new partition with &lt;code&gt;fdisk /dev/sdb&lt;/code&gt; and change it to &lt;code&gt;FAT16&lt;/code&gt; with &lt;code&gt;mkdosfs /dev/sdbX&lt;/code&gt;.
Those firmwares have to be unpacked to &lt;code&gt;/firmware&lt;/code&gt; path in the new USB partition.&lt;/p&gt;
&lt;p&gt;Another much more straightforward way to do it, it&amp;rsquo;s to download the already built ISO image with the non-free 

	&lt;a href=&#34;https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;firmwares&lt;/a&gt;

.&lt;/p&gt;
&lt;h3 id=&#34;before-installing&#34;&gt;Before installing&lt;/h3&gt;
&lt;p&gt;Don&amp;rsquo;t forget to ensure the &lt;code&gt;.iso&lt;/code&gt; you downloaded is not tampered with by any third party. As Debian includes the signatures in the same folder you got the &lt;code&gt;iso&lt;/code&gt;, you can easily check this via &lt;code&gt;gpg&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Check the integrity of the file containing the SHASUM (you may need to import the keys from Debian&amp;#39;s keyserver)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gpg --verify SHA512SUMS.sign SHA512SUMS
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Get the shasum of the downloaded iso&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;shasum -a &lt;span style=&#34;color:#099&#34;&gt;512&lt;/span&gt; file.iso
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#998;font-style:italic&#34;&gt;# Check if the shasum generated by Debian matches with the `iso` one&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cat SHA512SUMS
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;first-steps&#34;&gt;First steps&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Comment &lt;code&gt;deb cd-rom:&lt;/code&gt; repos in &lt;code&gt;/etc/apt/sources.list&lt;/code&gt; file (you may need superuser permissions &lt;code&gt;su&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install and configure sudo (not necessary if you left the root password empty on installation).&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;su&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apt-get update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apt-get install sudo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;usermod -a -G sudo your_user&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Restart&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Depending on how old your &lt;code&gt;.iso&lt;/code&gt; are, you may want to upgrade the Debian:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get upgrade
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get dist-upgrade
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;some-extras&#34;&gt;Some extras&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install the Microsoft fonts.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;echo &#39;deb http://ftp.us.debian.org/debian jessie main contrib&#39; &amp;gt;&amp;gt; /etc/apt/sources.list&lt;/code&gt; (not necessary in some mirrors: US, for example)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo apt-get install ttf-mscorefonts-installer&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Rearrange window buttons (close, minimize&amp;hellip;) to the left.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gsettings set org.gnome.desktop.wm.preferences button-layout &amp;quot;close,minimize,maximize:&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Show only applications from the current workspace in Alt+Tab.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gsettings set org.gnome.shell.app-switcher current-workspace-only true&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Disable alt+f1 shortcut key.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gsettings set org.gnome.desktop.wm.keybindings panel-main-menu &amp;quot;[]&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install some excellent extensions from 

	&lt;a href=&#34;https://extensions.gnome.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Gnome Extensions&lt;/a&gt;

:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Frippery move clock&lt;/strong&gt;: it moves the centered clock to the right of the gnome bar.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lock keys&lt;/strong&gt;: useful for keyboards that don&amp;rsquo;t have a status LED for Caps lock and Num lock keys.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No topleft hot corner&lt;/strong&gt;: it prevents the default gnome&amp;rsquo;s behaviour from showing up in the activity view when the mouse points in the window&amp;rsquo;s top left corner.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Panel osd&lt;/strong&gt;: to customize the notification&amp;rsquo;s position on the screen.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Random Walls&lt;/strong&gt;: it changes the wallpaper and lock screen image automatically and randomly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Topicons plus&lt;/strong&gt;: changes the tray icons to the top.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Workspace indicator&lt;/strong&gt;: shows the active workspace.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Docker integration&lt;/strong&gt;: hides &lt;em&gt;veth&lt;/em&gt; networks from gnome interface.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ESC to close overview from applications list&lt;/strong&gt;: when in the overview screen, close it without show the application list.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dash to Dock&lt;/strong&gt;: A mac dock style for Linux.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Workspace Isolated Dash&lt;/strong&gt;: Isolate each workspace as if it was the only workspace.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install a beautiful theme for Gnome:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo apt install numix-gtk-theme numix-icon-theme&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;updating-git&#34;&gt;Updating git&lt;/h3&gt;
&lt;p&gt;There is a git-core team ppa for Debian, for install the latest version of git: 

	&lt;a href=&#34;https://launchpad.net/~git-core&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Git-core PPA&lt;/a&gt;

.&lt;/p&gt;
&lt;p&gt;You have to add the PGP key available on the site. The key can be exported to a file and added to Debian with the &lt;code&gt;sudo apt-key add&lt;/code&gt; command.&lt;/p&gt;
&lt;h3 id=&#34;printing-in-an-hp&#34;&gt;Printing in an HP&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Install the printer drivers:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo apt-get update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo apt-get install cups hplip&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Configure the printer through the hp plugin:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo hp-setup -i&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h2&gt;
&lt;h3 id=&#34;brazilian-accentuation-in-american-keyboards&#34;&gt;Brazilian accentuation in American keyboards&lt;/h3&gt;
&lt;p&gt;You must use &lt;code&gt;English (US, international with dead keys)&lt;/code&gt;.&lt;/p&gt;
&lt;h4 id=&#34;ć-instead-of-ç&#34;&gt;Ć instead of Ç&lt;/h4&gt;
&lt;p&gt;You need to put &lt;code&gt;GTK_IM_MODULE=cedilla&lt;/code&gt; in &lt;code&gt;/etc/environment&lt;/code&gt; file. After that, logout and login again.&lt;/p&gt;
&lt;h3 id=&#34;creating-a-partition-with-more-than-2tb&#34;&gt;Creating a partition with more than 2TB&lt;/h3&gt;
&lt;p&gt;Please, head over to 

	
	&lt;a href=&#34;https://blog.lourenci.com/creating-a-partition-larger-than-2tb-on-debian&#34;&gt;this post&lt;/a&gt;

.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
