<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Santiago Zarate</title>
    <description>The latest articles on DEV Community by Santiago Zarate (@foursixnine).</description>
    <link>https://dev.to/foursixnine</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F259682%2F8315ca2e-641f-4743-906a-4296c82a598f.jpeg</url>
      <title>DEV Community: Santiago Zarate</title>
      <link>https://dev.to/foursixnine</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/foursixnine"/>
    <language>en</language>
    <item>
      <title>Extracting postfix journal logs for fun, profit and unbanning</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Thu, 02 Nov 2023 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/extracting-postfix-journal-logs-for-fun-profit-and-unbanning-40em</link>
      <guid>https://dev.to/foursixnine/extracting-postfix-journal-logs-for-fun-profit-and-unbanning-40em</guid>
      <description>&lt;h1&gt;
  
  
  From journal to .json
&lt;/h1&gt;

&lt;p&gt;In order to convert from your journal log to json, so it is easily parseable, &lt;a href="https://jqlang.github.io/jq/"&gt;jq&lt;/a&gt; offers an option that allows you to run a filter, only until the end of the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and
    run the filter just once.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows you to save the file directly, ready to be processed by your favorite tools, here’s what I used:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;journalctl -u postfix.service --since yesterday -g "denied" --output json | jq -s "." &amp;gt; data/log.json&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter Perl
&lt;/h2&gt;

&lt;p&gt;Now, because I’ve been using Perl for &lt;code&gt;${deity}&lt;/code&gt; knows how long (I wrote my first Perl script at the end of the 90’s), naturally, is my language of choice for quick things where my knowledge of &lt;code&gt;bash&lt;/code&gt; isn’t going to cut it:&lt;/p&gt;

&lt;p&gt;First I want to load my file, I’m going to rely on &lt;a href="https://docs.mojolicious.org/Mojo"&gt;Mojo&lt;/a&gt;, specifically &lt;code&gt;Mojo::Collection&lt;/code&gt; and &lt;code&gt;Mojo::JSON&lt;/code&gt; for this as I’m familiar with both, also, if I wan’t to dig a bit into what’s inside my collections, I can always do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use Mojo::Util qw(dumper);

say dumper $collection-&amp;gt;to_array;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But I digress, back to business&lt;/p&gt;

&lt;h3&gt;
  
  
  The real stuff
&lt;/h3&gt;

&lt;p&gt;This piece of code filters for me, what it reads from a file (I’m doing &lt;code&gt;$_= path(shift);&lt;/code&gt; for convenience)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my $file = Mojo::Collection-&amp;gt;new(decode_json($_-&amp;gt;slurp))-&amp;gt;flatten;

// Filter using Mojo::Collection::grep to have a new collection with the data I'm interested in
my $filtered = $file-&amp;gt;grep(sub{ 
        $_-&amp;gt;{MESSAGE} =~ /denied/
    });

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that I have the elements on a single array (of course, if I’m looking at a file over a gigabyte, likely I’d look into putting this inside some sort of database, PostgreSQL for instance, has excellent Json support), it’s time to do something with it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// get anything that looks like a hostname before, and get the ip address
// example: NOQUEUE: reject: RCPT from ns2.pads.ufrj.br[146.164.48.5]: 554 5.7.1 &amp;lt;relaytest@antispam-ufrj.pads.ufrj.br&amp;gt;:
// I want to have ethe IP in a named group so I can later reference it with `$+{'IP'}`
my $regexp = qr{(.*[a-zA-Z0-9-._]+)\[(?&amp;lt;IP&amp;gt;.*)\]&amp;gt;?:.*};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ideally (and for the future) I might want to filter in a different way, and capture different things, but you get the idea however today, we only want to know which ip addresses were rejected while testing our changes in our postfix’s configuration&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$filtered-&amp;gt;each(sub{
        if ($_-&amp;gt;{'MESSAGE'} =~ /$regexp/ ){
            say "bash ./unban ".$+{'IP'};
        } else {
            warn "CANNOT GET IP: ".$_-&amp;gt;{"MESSAGE"};
        }
    });

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I have another script that does the unban, but for now I’m ok with copy&amp;amp;pasting :)&lt;/p&gt;

&lt;p&gt;The full script is at: &lt;a href="https://github.com/foursixnine/stunning-octo-chainsaw/blob/master/postfix-logparser/logparser.pl"&gt;https://github.com/foursixnine/stunning-octo-chainsaw/blob/master/postfix-logparser/logparser.pl&lt;/a&gt; pull requests are welcome, and maybe in the future I move this to its own thing, but for now, that’s all folks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kF7mM2PQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgs.xkcd.com/comics/regular_expressions.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kF7mM2PQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgs.xkcd.com/comics/regular_expressions.png" alt="Regular Expressions" width="600" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Interoperabilidad de Obsidian con Linux, iOS y OSX</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Mon, 18 Apr 2022 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/interoperabilidad-de-obsidian-con-linux-ios-y-osx-36d7</link>
      <guid>https://dev.to/foursixnine/interoperabilidad-de-obsidian-con-linux-ios-y-osx-36d7</guid>
      <description>&lt;p&gt;Hace tiempo en el grupo de Developers Ve en el mundo, preguntaba si alguien había utilizado Obsidian. Considerándome un power user de Evernote, sé lo que necesito, y en los años que llevo buscando una alternativa que funcione en linux, tenia el problema de que muy pocas realmente funcionan bien o siquiera tienen soporte para linux.&lt;/p&gt;

&lt;p&gt;Decidí irme por &lt;a href="https://obsidian.md/"&gt;Obsidian&lt;/a&gt;, luego de considerar Notion y otras herramientas principalmente por los plugins, que tiene &lt;a href="https://es.wikipedia.org/wiki/Zettelkasten"&gt;Zettelkasten&lt;/a&gt; como feature, esta pensado con las siguientes otras razones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Es perfecto para &lt;a href="https://es.wikipedia.org/wiki/Zettelkasten"&gt;Zettelkasten&lt;/a&gt; y para construir un segundo cerebro (&lt;a href="https://robingeuens.com/blog/build-a-second-brain-obsidian"&gt;Building a Second Brain&lt;/a&gt;), y tiene un sistema de tags simple, pero poderoso.&lt;/li&gt;
&lt;li&gt;Soporte para Markdown &lt;em&gt;by default&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Los archivos están en mis dispositivos, no en la nube &lt;em&gt;by design&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Puedo elegir alternativas de respaldo, control de versiones y redundancia.&lt;/li&gt;
&lt;li&gt;Soporte para &lt;a href="https://dev.toobsidian://show-plugin?id=obsidian-kanban"&gt;Kanban Boards&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Soporte para &lt;a href="https://github.com/lynchjames/obsidian-day-planner"&gt;Day Planners&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Soporte para &lt;a href="https://dev.toobsidian://show-plugin?id=nldates-obsidian"&gt;Natural Language Dates&lt;/a&gt; para cosas &lt;em&gt;like&lt;/em&gt;: &lt;code&gt;@today&lt;/code&gt;, &lt;code&gt;@tomorrow&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;La interfaz es exactamente lo que me encanta de Sublime que es lo que había estado utilizando para tomar notas, junto a la aplicación de notas del teléfono y notas via el correo.&lt;/li&gt;
&lt;li&gt;Tiene un VIM mode :D.&lt;/li&gt;
&lt;li&gt;El &lt;a href="https://trello.com/b/Psqfqp7I/obsidian-roadmap"&gt;roadmap&lt;/a&gt; promete.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aXn46eoN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://foursixnine.io/blog/linux/tech/espa%25C3%25B1ol/2022/04/18/images/zettelkasten.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aXn46eoN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://foursixnine.io/blog/linux/tech/espa%25C3%25B1ol/2022/04/18/images/zettelkasten.png" alt="" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Revisando varias cosas, y realmente investigando un poco, llegue al siguiente workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logre construir el workflow que hace lo que necesito: 

&lt;ul&gt;
&lt;li&gt;Vault en git en mi VPS, en una instancia propia de gitea, la data es mia.&lt;/li&gt;
&lt;li&gt;En Linux: &lt;/li&gt;
&lt;li&gt;El manejo de las distintas &lt;em&gt;Vaults&lt;/em&gt; (Bóvedas) seria por &lt;strong&gt;git&lt;/strong&gt; directamente. 

&lt;ul&gt;
&lt;li&gt;
&lt;a href="//nextcloud.com"&gt;Nextcloud&lt;/a&gt; como mecanismo de backup redundante en el &lt;a href="https://www.truenas.com/truenas-mini"&gt;NAS&lt;/a&gt; en casa via &lt;em&gt;scsi&lt;/em&gt; en un rpi.&lt;/li&gt;
&lt;li&gt;A mediano, o largo plazo: &lt;/li&gt;
&lt;li&gt;La solución de NAS podría ser FreeNAS, TrueNAS o Synology&lt;/li&gt;
&lt;li&gt;VPS como gateway, utilizando vpn con wireguard para mantener todo en una red privada.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;En &lt;em&gt;OSX&lt;/em&gt;: &lt;/li&gt;
&lt;li&gt;Seria igual que en &lt;em&gt;linux&lt;/em&gt;, por &lt;strong&gt;git&lt;/strong&gt; pero con la diferencia de que las bóvedas estarían alojadas en una carpeta en &lt;em&gt;iCloud&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;La llave ssh con permiso de escritura en el repo seria importada al &lt;em&gt;keystore&lt;/em&gt; (&lt;code&gt;ssh-add -K&lt;/code&gt;), para que no de problemas a la hora de pedir contraseñas.&lt;/li&gt;
&lt;li&gt;Queda pendiente revisar como hacer con las firmas de los commits con GPG, o &lt;em&gt;maybe&lt;/em&gt; usando &lt;a href="https://github.com/github/feedback/discussions/7744"&gt;ssh para firmar commits&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;En &lt;em&gt;IOS&lt;/em&gt;, los vaults se estarían abriendo via &lt;em&gt;iCloud&lt;/em&gt;, dejando por fuera el manejo con git, mientras se agrega el soporte en para &lt;a href="https://github.com/denolehov/obsidian-git/issues/57"&gt;ios/mobile en obsidian-git&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/l0IylOPCNkiqOgMyA/giphy-downsized.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l0IylOPCNkiqOgMyA/giphy-downsized.gif" alt="Conspiracy" width="250" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;En un tiempo revisare este post, y actualizare seguramente a mi nuevo workflow… o hare una vista en retrospectiva de que pudo salir mejor, etc, sin embargo creo que la primera tarea que hare, sera escribir un plugin para poderlo integrar con la creación de posts de este blog, y utilizar el grafo de tags, que por ahora… se ve así:&lt;/p&gt;

&lt;p&gt;![[images/blog_tag_cloud.png]]&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to test things with openQA without running your own instance</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Fri, 18 Jun 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/how-to-test-things-with-openqa-without-running-your-own-instance-4hck</link>
      <guid>https://dev.to/foursixnine/how-to-test-things-with-openqa-without-running-your-own-instance-4hck</guid>
      <description>&lt;h1&gt;
  
  
  Wait what?
&lt;/h1&gt;

&lt;p&gt;Yes, there are couple of ways for you, the user, the contributor, the amazing human being who wants to improve the software that is used by millions, to write automated tests and have bots doing all the work for you, once you’ve signed a binding contract with the blood of an unicorn, and have obtained api keys for our public &lt;a href="https://openqa.opensuse.org"&gt;https://openqa.opensuse.org&lt;/a&gt; instance.&lt;/p&gt;

&lt;p&gt;For now I will leave out the details on how to get those, but will rather point you to the #factory irc channel (or dischord), where you can get in touch with current admins, whom will be able to guide you better in the process.&lt;/p&gt;

&lt;h2&gt;
  
  
  I have the keys
&lt;/h2&gt;

&lt;p&gt;You should get operator keys and they would look like this (more or less):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[openqa.opensuse.org]
key = 45ABCEB4562ACB04
secret = 4BA0003086C4CB95

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i.giphy.com/media/uIGHPjEfdc0Ni/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/uIGHPjEfdc0Ni/giphy.gif" alt="Multipass" width="500" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Now let’s do this
&lt;/h2&gt;

&lt;p&gt;I will assume that you’re using openSUSE Tumbleweed, instructions are similar for Leap, but if you’re looking for something more esoteric, check the&lt;a href="https://open.qa/docs/#bootstrapping"&gt;bootstraping guide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bring up a terminal or your favorite package manager, and install &lt;code&gt;openQA-client&lt;/code&gt;, it will pull almost everything you will need&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;zypper in openQA-client

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we’re here, we’ve gotta clone the git repo from the tests being ran in openqa.opensuse.org, to do that let’s go to a directory; let’s call it Skynet and create it in our user’s home. My user’s home is &lt;code&gt;/home/foursixnine&lt;/code&gt; \o/ and use &lt;code&gt;git&lt;/code&gt; to clone the test repository: &lt;code&gt;https://github.com/os-autoinst/os-autoinst-distri-opensuse/&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd $HOME
mkdir Skynet
cd Skynet
git clone https://github.com/os-autoinst/os-autoinst-distri-opensuse/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now since we already cloned the test distribution, and also got the openQA client installed, all there is to do is:&lt;/p&gt;

&lt;p&gt;1 - Hacking &amp;amp; Commiting 2 - Scheduling a test run&lt;/p&gt;

&lt;p&gt;At this point we can do #1 fairly easy, but #2 needs a bit of a push (no pun intended), this is where we will need the API keys that we requested, in the beginning.&lt;/p&gt;

&lt;p&gt;We will rely for now, on &lt;code&gt;openqa-clone-custom-git-refspec&lt;/code&gt; which reads configuration parameters from “$OPENQA_CONFIG/client.conf”, “~/.config/openqa/client.conf” and “/etc/openqa/client.conf” (you can run openqa-cli –help to get more detailed info on this), for now open up your favorite editor and let’s create the directories and files we’ll need&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir ~/.config/openqa
$EDITOR ~/.config/openqa/client.conf

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And paste the API keys you already have, you you will be able to post and create jobs on the public instance!&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s get hacking
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/115BJle6N2Av0A/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/115BJle6N2Av0A/giphy.gif" alt="Hacker!" width="320" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This part is pretty straightforward once you’ve looked at $HOME/Skynet/os-autoinst-distri-opensuse.&lt;/p&gt;

&lt;p&gt;For this round, let’s say we want to also test chrome, in incognito mode. By looking at chrome’s help we know that the &lt;code&gt;--incognito&lt;/code&gt; is a thing&lt;/p&gt;

&lt;p&gt;So let’s go to where all the tests are, edit, commit and push our changes&lt;/p&gt;

&lt;p&gt;Remember to set up your fork, however if you want to make your life easier use &lt;code&gt;hub&lt;/code&gt; you can find it in the repos too!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd $HOME/Skynet/os-autoinst-distri-opensuse
vim tests/x11/chrome.pm
git commit -m "Message goes here" tests/x11/chrome.pm
git push $REMOTE
openqa-clone-custom-git-refspec \
 https://github.com/foursixnine/os-autoinst-distri-opensuse/tree/test_incognito_in_chrome \
 https://openqa.opensuse.org/tests/1792294 \
 SCHEDULE=tests/installation/bootloader_start,tests/boot/boot_to_desktop,tests/console/consoletest_setup,tests/x11/chrome \
 BUILD=0 \
 TEST=openQA-WORKSHOP-ALL-CAPS

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the end you will end up with an URL &lt;a href="https://openqa.opensuse.org/t1793764"&gt;https://openqa.opensuse.org/t1793764&lt;/a&gt;, and you will get emails from travis if something is going wrong&lt;/p&gt;

&lt;p&gt;&lt;a href="https://asciinema.org/a/EplIHYg4UYHKh1MW2q553sPth"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bVyxNPEz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://asciinema.org/a/EplIHYg4UYHKh1MW2q553sPth.svg" alt="asciicast" width="800" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>qualityassurance</category>
      <category>qa</category>
      <category>contributing</category>
      <category>testing</category>
    </item>
    <item>
      <title>How to edit stuff that you've already commited to git? (And squash as a bonus)</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Tue, 04 May 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/how-to-edit-stuff-that-you-ve-already-commited-to-git-and-squash-as-a-bonus-4dik</link>
      <guid>https://dev.to/foursixnine/how-to-edit-stuff-that-you-ve-already-commited-to-git-and-squash-as-a-bonus-4dik</guid>
      <description>&lt;p&gt;So, you’re in the middle of a review, and have couple of commits but one of the comments is asking you to modify a line that belongs to second to last, or even the first commit in your list, and you’re not willing to do:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git commit -m "Add fixes from the review" $file&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Or you simply don’t know, and have no idea what &lt;code&gt;squash&lt;/code&gt; or &lt;code&gt;rebase&lt;/code&gt; means?, well I won’t explain rebase today, but I will explain &lt;code&gt;rebase&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/O8FdP4NKLFKcU/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/O8FdP4NKLFKcU/giphy.gif" alt="DON'T PANIC" width="500" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See how I do it, and also how do I screw up!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://asciinema.org/a/bUdcrFZRRAzCHQk2EyG7ru9mA"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W83725qK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://asciinema.org/a/bUdcrFZRRAzCHQk2EyG7ru9mA.svg" alt="asciicast" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It all boils down to making sure that you &lt;strong&gt;trust&lt;/strong&gt; git, and hope that things are small enough so that if you lose the stash, you can always rewrite it.&lt;/p&gt;

&lt;p&gt;So in the end, for me it was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git fetch origin
git rebase -i origin/master # if your branch is not clean, git will complain and stop
git stash # because my branch was not clean, and my desired change was already done
git rebase -i origin/master # now, let's do a rebase
# edit desired commits, for this add the edit (or an e) before the commit
# save and quit vim ([esc]+[:][x] or [esc]+[:][w][q], or your editor, if you're using something else
git stash pop # because I already had my change
$HACK # if you get conflicts or if you want to modify more
      # be careful here, if you rewrite history too much
      # you will end up in Back to the Future II
      # Luckly you can do git rebase --abort
git commit --amend $files #(alternatively, git add $files first then git commit --amend
git rebase --continue
git push -f # I think you will need to add remote+branch, git will remind you
# go on with your life

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Note: A squash is gonna put all of the commits together, just make sure that there’s an order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pick COMMIT1&lt;/li&gt;
&lt;li&gt;pick COMMIT2&lt;/li&gt;
&lt;li&gt;squash COMMIT3 # (Git will combine this commit, with the one above iir, so COMMIT2+COMMIT3 and git will ask you for a new commit message)&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Perl binaries are mismatched - the revenge of the lazy person</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Tue, 09 Feb 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/perl-binaries-are-mismatched-the-revenge-of-the-lazy-person-3p9l</link>
      <guid>https://dev.to/foursixnine/perl-binaries-are-mismatched-the-revenge-of-the-lazy-person-3p9l</guid>
      <description>&lt;h1&gt;
  
  
  The uninvited eldrich terror
&lt;/h1&gt;

&lt;p&gt;You use &lt;a href="https://metacpan.org/pod/local::lib"&gt;local::lib&lt;/a&gt;, and the pain unfolds: A shell is started, and you find a dreaded:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cwd.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xdb80080)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i.giphy.com/media/CiJGnsh7wWXv2/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/CiJGnsh7wWXv2/giphy.gif" alt="Pennywise, because I could not find the right gif, from the Uninvited, of Sabrina's netflix"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Which means: that the module (Cwd in this case) is not compatible (Because it’s an &lt;a href="http://modernperlbooks.com/mt/2009/05/perl-5-and-binary-compatibility.html"&gt;XS module&lt;/a&gt;) with your current version of perl, installed on your system: Likely it was compiled for a previous version, leadin to those &lt;a href="https://rt.perl.org/Public/Bug/Display.html?id=133440"&gt;binaries mismatching&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Don’t panic!
&lt;/h2&gt;

&lt;p&gt;I &lt;a href="///blog/2019/01/21/perl-binaries-are-mismatched.html"&gt;wrote about this&lt;/a&gt; however, I left out how to get to the point where you have already an usable Perl again?&lt;/p&gt;

&lt;h2&gt;
  
  
  The light
&lt;/h2&gt;

&lt;p&gt;Instead of downloading local::lib from git as I used to do… this time I decided to do it on a much simpler way: use &lt;code&gt;perl-local-lib&lt;/code&gt; from my distribution, and let it do the magic, I mean that’s why I run &lt;a href="https://get.opensuse.org"&gt;openSUSE Tumbleweed&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; $ rm -rf perl5-old || echo "First time eh?"
 $ mv perl5 perl5-old
 $ perl-migrate-modules --from ~/perl5-old/lib/perl5 /usr/bin/perl
 $ perl -MCPAN -Mlocal::lib -e 'CPAN::install(App::cpanminus)'
 $ cpanm App::MigrateModules
 $ perl-migrate-modules --from ~/perl5-old/lib/perl5 /usr/bin/perl

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Et voilà, ma chérie!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" alt="It's alive!"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Cron do not send me empty emails</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Tue, 26 Jan 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/cron-do-not-send-me-empty-emails-1hlm</link>
      <guid>https://dev.to/foursixnine/cron-do-not-send-me-empty-emails-1hlm</guid>
      <description>&lt;p&gt;Just in case, if you’ve ever wondered how to stop &lt;code&gt;cron&lt;/code&gt; from sending empty emails, a quick look at &lt;code&gt;man mail&lt;/code&gt; will give you the answer you’re looking for (if you know what you’re searching for):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    -E

    If an outgoing message does not contain any text in its first or only message part, do not send it but discard it silently,
    effectively setting the skipemptybody variable at program startup. This is useful for sending messages from scripts started 
    by cron(8).

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I got this after visiting couple of forums, and some threads at stack exchange, however &lt;a href="https://stackoverflow.com/a/14656511"&gt;this one&lt;/a&gt; nailed it&lt;/p&gt;

&lt;p&gt;So all you need to do is, fire up that &lt;code&gt;crontab -e&lt;/code&gt; and make your script run every five minutes, without fear of the noise&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*/5 * * * * /usr/local/bin/only-talk-if-there-are-errors-script |&amp;amp; mail -E -r $(hostname)@opensuse.org -s "[CRON][monitoring] foo bar $(date --iso-8601='minutes')" do-not-spam-me@example.com

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Et voilà, ma chérie!&lt;/em&gt; &lt;a href="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" alt="It's alive!"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Quick and dirty ipmitool tutorial</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Tue, 19 Jan 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/quick-and-dirty-ipmitool-tutorial-1945</link>
      <guid>https://dev.to/foursixnine/quick-and-dirty-ipmitool-tutorial-1945</guid>
      <description>&lt;h1&gt;
  
  
  Because I always forget
&lt;/h1&gt;

&lt;h2&gt;
  
  
  To reboot a SUPERMICRO server:
&lt;/h2&gt;

&lt;p&gt;Just remember that the default user/password might still be ADMIN/ADMIN :)&lt;/p&gt;

&lt;p&gt;ipmitool -I lanplus -H $HOST -U USER -P PASSWORD power cycle&lt;/p&gt;

&lt;h2&gt;
  
  
  To connect to the serial console
&lt;/h2&gt;

&lt;p&gt;ipmitool -I lanplus -H $HOST -U USER -P PASSWORD sol activate&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Ext4 filesystem has no space left on device? You liar!</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Tue, 15 Sep 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/ext4-filesystem-has-no-space-left-on-device-you-liar-48k7</link>
      <guid>https://dev.to/foursixnine/ext4-filesystem-has-no-space-left-on-device-you-liar-48k7</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0YZGoe0C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgs.xkcd.com/comics/disk_usage.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0YZGoe0C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgs.xkcd.com/comics/disk_usage.png" alt="Disk usage" width="523" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, you wake up one day, and find that one of your programs, starts to complainig about “No space left on device”:&lt;/p&gt;

&lt;p&gt;Next thing (Obviously, duh?) is to see what happened, so you fire up &lt;code&gt;du -h /tmp&lt;/code&gt; right?:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ du -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/zkvm1-root 6.2G 4.6G 1.3G 79% /

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i.giphy.com/media/SVgKToBLI6S6DUye1Y/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/SVgKToBLI6S6DUye1Y/giphy.gif" alt="Well, yes, but no, ok? ok, ok!" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wait, what? there’s space there! How can it be? In all my years of experience (+15!), I’ve never seen such thing!&lt;/p&gt;

&lt;p&gt;Gods must be crazy!? or is it a 2020 thing?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/VcWnY3R6YWVtC/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/VcWnY3R6YWVtC/giphy.gif" alt="I disagree with you" width="418" height="240"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ touch /tmp
touch: cannot touch ‘/tmp/test’: No space left on device

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i.giphy.com/media/ToMjGpJ1lQiQarAftaU/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/ToMjGpJ1lQiQarAftaU/giphy.gif" alt="Wait, what? not even a small empty file?" width="500" height="269"&gt;&lt;/a&gt; &lt;a href="https://i.giphy.com/media/XdIOEZTt6dL7zTYWIo/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/XdIOEZTt6dL7zTYWIo/giphy.gif" alt="Ok..." width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After shamelessly googling/duckducking/searching, I ended up at &lt;a href="https://blog.merovius.de/2013/10/20/ext4-mysterious-no-space-left-on.htmlbut"&gt;https://blog.merovius.de/2013/10/20/ext4-mysterious-no-space-left-on.htmlbut&lt;/a&gt; alas, that was not my problem, although… perhaps too many files?, let’s check with &lt;code&gt;du -i&lt;/code&gt; this time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ du -i /tmp
`Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/zkvm1-root 417792 417792 0 100% /

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i.giphy.com/media/xT1R9Up1IZR6AtWdKE/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xT1R9Up1IZR6AtWdKE/giphy.gif" alt="Of course!" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because I’m super smart &lt;del&gt;I’m not&lt;/del&gt; , I now &lt;strong&gt;know&lt;/strong&gt; where my problem is, too many files!, time to start fixing this…&lt;/p&gt;

&lt;p&gt;After few minutes of deleting files, moving things around, bind mounting things, I landed with the actual root cause:&lt;/p&gt;

&lt;p&gt;Tons of messages waiting in &lt;a href="https://www.ibm.com/support/pages/varspoolclientmqueue-keeps-filling-and-causes-var-filesystem-usage-exceeded-threshold"&gt;/var/spool/clientmqueue&lt;/a&gt; to be processed,I decided to delete some, after all, I don’t care about this system’s mails… so &lt;code&gt;find /var/spool/clientmqueue -type f -delete&lt;/code&gt; does the job, and allows me to have tab completion again! YAY!.&lt;/p&gt;

&lt;p&gt;However, because deleting files blindly is never a good solution, I ended up in the link from above, the solution was quite simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ systemctl enable --now sendmail

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i.giphy.com/media/W35DnRbN4oDHIAApdk/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/W35DnRbN4oDHIAApdk/giphy.gif" alt="Smart idea!" width="480" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After a while, &lt;code&gt;root&lt;/code&gt; user started to receive system mail, and I could delete them afterwards :)&lt;/p&gt;

&lt;p&gt;In the end, very simple solution (In my case!) rather than formatting or transfering all the data to a second drive, formatting &amp;amp; playing with inode size and stuff…&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/zkvm1-root 417792 92955 324837 23% /

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Et voilà, ma chérie!&lt;/em&gt; &lt;a href="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" alt="It's alive!" width="480" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a very long post, just to say:&lt;/p&gt;

&lt;p&gt;ext4 no space left on device can mean: You have no space left, or you don’t have more room to store your files.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Using python virtualenv inside vscode</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Sun, 14 Jun 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/using-python-virtualenv-inside-vscode-1d24</link>
      <guid>https://dev.to/foursixnine/using-python-virtualenv-inside-vscode-1d24</guid>
      <description>&lt;h2&gt;
  
  
  Quick and dirty
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install python3-virtualenvwrapper (via pip or via package manager)&lt;/li&gt;
&lt;li&gt;Export a workon directory: &lt;code&gt;export WORKON_HOME=/home/foursixnine/Projects/python-virtualenv&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;source virtualenvwrapper&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;foursixnine@deimos:~/Projects&amp;gt; source virtualenvwrapper    
virtualenvwrapper.user_scripts creating /home/foursixnine/Projects/python-virtualenv/premkproject
...
virtualenvwrapper.user_scripts creating /home/foursixnine/Projects/python-virtualenv/get_env_details

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;mkvirtualenv newenv
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;foursixnine@deimos:~/Projects&amp;gt; mkvirtualenv newenv
created virtual environment CPython3.8.3.final.0-64 in 115ms
  creator CPython3Posix(dest=/home/foursixnine/Projects/python-virtualenv/newenv, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/home/foursixnine/.local/share/virtualenv/seed-app-data/v1.0.1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
virtualenvwrapper.user_scripts creating /home/foursixnine/Projects/python-virtualenv/newenv/bin/predeactivate
...
virtualenvwrapper.user_scripts creating /home/foursixnine/Projects/python-virtualenv/newenv/bin/get_env_details

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;By this point, you’re already inside &lt;code&gt;newenv&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(newenv) foursixnine@deimos:~/Projects&amp;gt; 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You can create multiple virtual environments and switch among them using &lt;code&gt;workon $env&lt;/code&gt; so long as you have sourced &lt;code&gt;virtualenvwrapper&lt;/code&gt; and your &lt;code&gt;$WORKON_HOME&lt;/code&gt; is properly defined.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real business
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Now, if you want to use vscode, remember that you will need to define properly &lt;code&gt;python.PythonPath&lt;/code&gt; for your workspace/project (I’m new to this, don’t hang me in a public square ok?), in this case, my env is called linkedinlearningaiml
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "python.pythonPath": "/home/foursixnine/Projects/python-virtualenv/linkedinlearningaiml/bin/python"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now your python code will be executed within the context of your virtual environment, so you can get down to serious (or not at all) python development, without screweing up your host or polluting the dependencies and stuff.&lt;/p&gt;

&lt;p&gt;PS: Since wanted to be able to run standalone python files, I also needed to change a bit my launch.json (Maybe this is not needed?)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "cwd": "${fileDirname}"
        }
    ]
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And off you go, how to use python virtualenv inside vscode&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Et voilà, ma chérie!&lt;/em&gt; &lt;a href="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" alt="It's alive!" width="480" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Looking for exceptions with awk</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Thu, 21 May 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/looking-for-exceptions-with-awk-14lk</link>
      <guid>https://dev.to/foursixnine/looking-for-exceptions-with-awk-14lk</guid>
      <description>&lt;p&gt;Sometimes you just need to search using awk or want to use plain bash to search for an exception in a log file, it’shard to go into google, stack overflow, duck duck go, or any other place to do a search, and find nothing, or at leasta solution that fits your needs.&lt;/p&gt;

&lt;p&gt;In my case, I wanted to know where a package was generating a conflict &lt;a href="https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/10259/files#diff-141f4b5a48eaecb0c631a0de23e41a51R503"&gt;for a friend&lt;/a&gt;, and ended up scratching my head,because I didn’t want to write yet another domain specific function to use on the test framework of openQA, and I’mvery stubborn, I ended up with the following solution&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;journalctl -k | awk 'BEGIN {print "Error - ",NR; group=0}
/ACPI BIOS Error \(bug\)/,/ACPI Error: AE_NOT_FOUND/{ print group"|", 
    $0; if ($0 ~ /ACPI Error: AE_NOT_FOUND,/ ){ print "EOL"; group++ }; 
}'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is short for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define &lt;code&gt;$START_PATTERN as /ACPI BIOS Error \(bug\)/,&lt;/code&gt; and &lt;code&gt;$END_PATTERN as /ACPI Error: AE_NOT_FOUND/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Look for &lt;code&gt;$START_PATTERN&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Look for &lt;code&gt;$END_PATTERN&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If you find &lt;code&gt;$END_PATTERN&lt;/code&gt; add an &lt;code&gt;EOL&lt;/code&gt; marker (that is not needed, since the group variable will be incremented)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And there you go: How to search for exceptions in logs, of course it could be more complicated, because you can have nestedcases and whatnot, but for now, this does exactly what I need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EOL
10| May 20 12:38:36 deimos kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.LPCB.HEC.CHRG], AE_NOT_FOUND (20200110/psargs-330)
10| May 20 12:38:36 deimos kernel: ACPI Error: Aborting method \PNOT due to previous error (AE_NOT_FOUND) (20200110/psparse-529)
10| May 20 12:38:36 deimos kernel: ACPI Error: Aborting method \_SB.AC._PSR due to previous error (AE_NOT_FOUND) (20200110/psparse-529)
10| May 20 12:38:36 deimos kernel: ACPI Error: AE_NOT_FOUND, Error reading AC Adapter state (20200110/ac-115)
EOL
11| May 20 12:39:12 deimos kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.LPCB.HEC.CHRG], AE_NOT_FOUND (20200110/psargs-330)
11| May 20 12:39:12 deimos kernel: ACPI Error: Aborting method \PNOT due to previous error (AE_NOT_FOUND) (20200110/psparse-529)
11| May 20 12:39:12 deimos kernel: ACPI Error: Aborting method \_SB.AC._PSR due to previous error (AE_NOT_FOUND) (20200110/psparse-529)
11| May 20 12:39:12 deimos kernel: ACPI Error: AE_NOT_FOUND, Error reading AC Adapter state (20200110/ac-115)
EOL
12| May 20 13:37:41 deimos kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.LPCB.HEC.CHRG], AE_NOT_FOUND (20200110/psargs-330)
12| May 20 13:37:41 deimos kernel: ACPI Error: Aborting method \PNOT due to previous error (AE_NOT_FOUND) (20200110/psparse-529)
12| May 20 13:37:41 deimos kernel: ACPI Error: Aborting method \_SB.AC._PSR due to previous error (AE_NOT_FOUND) (20200110/psparse-529)
12| May 20 13:37:41 deimos kernel: ACPI Error: AE_NOT_FOUND, Error reading AC Adapter state (20200110/ac-115)
EOL

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So I could later write some code that looks per string, separates the string using the pipe &lt;code&gt;|&lt;/code&gt; discards the group id, and adds that record to an arrayof arrays or hashes: &lt;code&gt;[{group: id, errors: [error string .. error string] ]&lt;/code&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>bash</category>
      <category>parsing</category>
      <category>logs</category>
    </item>
    <item>
      <title>How to import a gpg key on zypper (openSUSE)</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Thu, 07 May 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/how-to-import-a-gpg-key-on-zypper-opensuse-59hm</link>
      <guid>https://dev.to/foursixnine/how-to-import-a-gpg-key-on-zypper-opensuse-59hm</guid>
      <description>&lt;p&gt;For some odd reason, I couldn’t find quickly (2 mins in the manpage and some others on DuckDuckGo) a way to import aGPG key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/L3pfVwbsJbrk4/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/L3pfVwbsJbrk4/giphy.gif" alt="" width="500" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just because one of the repos gives this ugly message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Repository vscode does not define additional 'gpgkey=' URLs.
Warning: File 'repomd.xml' from repository 'vscode' is signed with an unknown key 'EB3E94ADBE1229CF'.

    Note: Signing data enables the recipient to verify that no modifications occurred after the data
    were signed. Accepting data with no, wrong or unknown signature can lead to a corrupted system
    and in extreme cases even to a system compromise.

    Note: File 'repomd.xml' is the repositories master index file. It ensures the integrity of the
    whole repo.

    Warning: We can't verify that no one meddled with this file, so it might not be trustworthy
    anymore! You should not continue unless you know it's safe.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I know you can use &lt;code&gt;zypper ar --gpg-auto-import-keys&lt;/code&gt;, but I didn’t do it when I added it (and I’m too lazy to remove the repo and add it again, just to see if it works)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rpm --import https://packages.microsoft.com/keys/microsoft.asc
zypper ref

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Roundcube smtp (250) authentication failed</title>
      <dc:creator>Santiago Zarate</dc:creator>
      <pubDate>Fri, 27 Sep 2019 00:00:00 +0000</pubDate>
      <link>https://dev.to/foursixnine/roundcube-smtp-250-authentication-failed-3jdi</link>
      <guid>https://dev.to/foursixnine/roundcube-smtp-250-authentication-failed-3jdi</guid>
      <description>&lt;p&gt;So, say you find yourself, somehow having the following error in the roundcube logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[27-Sep-2019 12:44:48 +0000]: &amp;lt;f930f680&amp;gt; PHP Error: SMTP server does not support authentication (POST /?_task=mail&amp;amp;_unlock=loading1569588324419&amp;amp;_framed=1&amp;amp;_lang=es&amp;amp;_action=send)
[27-Sep-2019 12:44:48 +0000]: &amp;lt;f930f680&amp;gt; SMTP Error: Authentication failure: SMTP server does not support authentication (Code: ) in /roundcube/program/lib/Roundcube/rcube.php on line 1674 (POST /correo/?_task=mail&amp;amp;_unlock=loading 1569588324419&amp;amp;_framed=1&amp;amp;_lang=es&amp;amp;_action=send)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You have tried everything, but still can’t seem to be able to send email from roundcube, you keep getting this annoying “SMTP (250) authentication failed” notification, every time you click “Send”.&lt;/p&gt;

&lt;p&gt;Well… Make sure that your server is connecting to the right place. It took me a while to realize that roundcube was trying to connect to localhost, but somehow the authentication mechanism stopped working (it was before upgrading).&lt;/p&gt;

&lt;p&gt;Since I don’t really want to debug too much today (it’s friday after all), and because my configuration/use case is over ssl/tls, the solution to the probem was simply:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$config['smtp_server'] = 'tls://services.host.co';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Et voilà, ma chérie!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xT5LMDi8H2A1FtLlpC/giphy.gif" alt="It's alive!" width="480" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>smtp</category>
      <category>dovecot</category>
      <category>roundcube</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
