<?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: Eric F 🇺🇦</title>
    <description>The latest articles on DEV Community by Eric F 🇺🇦 (@efdev).</description>
    <link>https://dev.to/efdev</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%2F999353%2F0bdba508-c5c7-404d-9d07-481484c549a8.jpg</url>
      <title>DEV Community: Eric F 🇺🇦</title>
      <link>https://dev.to/efdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/efdev"/>
    <language>en</language>
    <item>
      <title>Create your own memes in Terminal</title>
      <dc:creator>Eric F 🇺🇦</dc:creator>
      <pubDate>Sun, 19 Feb 2023 18:17:56 +0000</pubDate>
      <link>https://dev.to/efdev/create-your-own-memes-in-terminal-4pod</link>
      <guid>https://dev.to/efdev/create-your-own-memes-in-terminal-4pod</guid>
      <description>&lt;p&gt;To create a &lt;em&gt;“meme”&lt;/em&gt;, or just adding text to an image - you don't need an app or an online service. You can do it yourself, in Terminal, using ImageMagick. Here's a short snippet you can use.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Since the command is kind of long, you can save in some file, or make a bash function - or maybe a script.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ImageMagick v6&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;convert &lt;span class="k"&gt;in&lt;/span&gt;.jpg &lt;span class="nt"&gt;-gravity&lt;/span&gt; south &lt;span class="nt"&gt;-font&lt;/span&gt; Impact &lt;span class="nt"&gt;-pointsize&lt;/span&gt; 120 &lt;span class="nt"&gt;-fill&lt;/span&gt; white &lt;span class="nt"&gt;-stroke&lt;/span&gt; black &lt;span class="nt"&gt;-strokewidth&lt;/span&gt; 3 &lt;span class="nt"&gt;-annotate&lt;/span&gt; +0+0 &lt;span class="s1"&gt;'Add text here'&lt;/span&gt; out.jpg

&lt;span class="c"&gt;# ImageMagick v7&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;magick &lt;span class="k"&gt;in&lt;/span&gt;.jpg &lt;span class="nt"&gt;-gravity&lt;/span&gt; south &lt;span class="nt"&gt;-font&lt;/span&gt; Impact &lt;span class="nt"&gt;-pointsize&lt;/span&gt; 120 &lt;span class="nt"&gt;-fill&lt;/span&gt; white &lt;span class="nt"&gt;-stroke&lt;/span&gt; black &lt;span class="nt"&gt;-strokewidth&lt;/span&gt; 3 &lt;span class="nt"&gt;-annotate&lt;/span&gt; +0+0 &lt;span class="s1"&gt;'Add text here'&lt;/span&gt; out.jpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;h4&gt;
  
  
  Text position
&lt;/h4&gt;

&lt;p&gt;For &lt;code&gt;-gravity&lt;/code&gt; you can use your normal: north, south, center, southeast, etc.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h4&gt;
  
  
  Fonts
&lt;/h4&gt;

&lt;p&gt;I used &lt;code&gt;Impact&lt;/code&gt; in the example. It's usally installed. But, if you want to change the font - just use another one from the list of fonts. Most font names are formatted with a dash, like “DevaVu-Sans-Bold”, “NimbusSans-Bold”, etc.&lt;/p&gt;

&lt;p&gt;If you try one and it returns an error - you can get the list of fonts (ie. the font names) using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ImageMagick v6&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;identify &lt;span class="nt"&gt;-list&lt;/span&gt; font

&lt;span class="c"&gt;# ImageMagick v7&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;magick &lt;span class="nt"&gt;-list&lt;/span&gt; font
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get a more readable list, you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;identify &lt;span class="nt"&gt;-list&lt;/span&gt; font | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s1"&gt;'Font'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;h4&gt;
  
  
  Text stroke
&lt;/h4&gt;

&lt;p&gt;The size of the text stroke depends a little on the font, and what you like. 1-3 are good values. I usually go with 2, and sometimes (depending on the font) I use 1 or 3.&lt;/p&gt;

&lt;p&gt;3 is probably closest to what you get at an online meme generator.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h4&gt;
  
  
  Example
&lt;/h4&gt;

&lt;p&gt;Here's an example adding text 2 times (top and bottom).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;magick &lt;span class="k"&gt;in&lt;/span&gt;.jpg &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-gravity&lt;/span&gt; north &lt;span class="nt"&gt;-font&lt;/span&gt; Impact &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-pointsize&lt;/span&gt; 120 &lt;span class="nt"&gt;-fill&lt;/span&gt; white  &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-stroke&lt;/span&gt; black &lt;span class="nt"&gt;-strokewidth&lt;/span&gt; 3 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-annotate&lt;/span&gt; +0+0 &lt;span class="s1"&gt;'Text at top'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  out1.jpg
&lt;span class="nv"&gt;$ &lt;/span&gt;magick out1.jpg &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-gravity&lt;/span&gt; south &lt;span class="nt"&gt;-font&lt;/span&gt; Impact &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-pointsize&lt;/span&gt; 120 &lt;span class="nt"&gt;-fill&lt;/span&gt; white &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-stroke&lt;/span&gt; black &lt;span class="nt"&gt;-strokewidth&lt;/span&gt; 3 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-annotate&lt;/span&gt; +0+0 &lt;span class="s1"&gt;'Text at bottom'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  out2.jpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Freagjcc1lh63njgd2hoc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Freagjcc1lh63njgd2hoc.jpg" alt="out2.jpg" width="500" height="210"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;It's more fun to spend time in Terminal, than at some online meme generator page. Plus, if you dig deeper into ImageMagick - you can add a lot of other effects as well. This was just a simple example.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;// Happy hacking…&lt;/em&gt; 👍&lt;/p&gt;

&lt;p&gt;· Eric&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>RPM: dynamic macro for %_topdir</title>
      <dc:creator>Eric F 🇺🇦</dc:creator>
      <pubDate>Tue, 31 Jan 2023 15:27:39 +0000</pubDate>
      <link>https://dev.to/efdev/rpm-dynamic-macro-for-topdir-gib</link>
      <guid>https://dev.to/efdev/rpm-dynamic-macro-for-topdir-gib</guid>
      <description>&lt;p&gt;When building RPM packages with &lt;code&gt;rpmbuild&lt;/code&gt; and you run &lt;code&gt;rpmdev-setuptree&lt;/code&gt; to setup the build environment. The default macro for &lt;code&gt;%_topdir&lt;/code&gt; is &lt;code&gt;%{getenv:HOME}/rpmbuild&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you &lt;em&gt;don't&lt;/em&gt; want to use the default location, you can define that with &lt;code&gt;--define&lt;/code&gt; on the command line, or define the macro in &lt;code&gt;~/.rpmmacros&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To use a custom path I've seen suggestions to use &lt;code&gt;$(pwd)&lt;/code&gt; - which is a great way to select current path. However… If you then run &lt;code&gt;rpmdev-setuptree&lt;/code&gt; in your home folder, forgetting about the macro. All folders end up all over your home folder.&lt;/p&gt;

&lt;p&gt;So, here's an example to set a macro in &lt;code&gt;~/.rpmmacros&lt;/code&gt; to make it more dynamic - and to prevent your custom macro to run in HOME.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="c"&gt;# RPM build
# ------------------------------------------
# rpmdev-setuptree:
#   - If run in HOME: use standard folder layout
#     Ex: HOME/rpmbuild
#   - if not: use PWD from current dir
#     Ex1: PWD/rpmbuild,
#     Ex2: $ mkdir project &amp;amp;&amp;amp; cd rpmbuild/project
#          $ rpmdev-setuptree
#          HOME/rpmbuild/project/{SOURCES,SPECS,etc}
#
# This is mainly a protection, to prevent PWD to create
# the folders directly in HOME
#
&lt;/span&gt;%&lt;span class="err"&gt;_&lt;/span&gt;&lt;span class="n"&gt;topdir&lt;/span&gt; %([[ %(&lt;span class="n"&gt;pwd&lt;/span&gt;) == %{&lt;span class="n"&gt;getenv&lt;/span&gt;:&lt;span class="n"&gt;HOME&lt;/span&gt;} ]] &amp;amp;&amp;amp; \
    &lt;span class="n"&gt;echo&lt;/span&gt; %{&lt;span class="n"&gt;getenv&lt;/span&gt;:&lt;span class="n"&gt;HOME&lt;/span&gt;}/&lt;span class="n"&gt;rpmbuild&lt;/span&gt; || &lt;span class="n"&gt;echo&lt;/span&gt; %(&lt;span class="n"&gt;pwd&lt;/span&gt;))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;So, now I can use it in better and more organized way. I put all in &lt;code&gt;.rpm/rpmbuild/&lt;/code&gt;, and all projects can live side-by-side in there.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Example&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; .rpm/rpmbuild/
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;baz &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;baz
&lt;span class="nv"&gt;$ &lt;/span&gt;rpmdev-setuptree
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;X_NOTES &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;touch &lt;/span&gt;X_NOTES/__notes.txt
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ..
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls
&lt;/span&gt;foo bar baz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;This setup works really great for me. The xtra &lt;code&gt;X_NOTES&lt;/code&gt; folder is just something I find useful to keep notes in, backups, original files, logs from failed builds, etc. Whatever you dont want to put in the other folders. Keeping it a bit cleaner.&lt;/p&gt;

&lt;p&gt;Hope you found it useful.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;// Happy hacking…&lt;/em&gt; 👍&lt;/p&gt;

&lt;p&gt;· Eric&lt;/p&gt;

</description>
      <category>linux</category>
      <category>rpm</category>
      <category>macro</category>
      <category>short</category>
    </item>
    <item>
      <title>One of the real gems with the DNF package manager: aliases</title>
      <dc:creator>Eric F 🇺🇦</dc:creator>
      <pubDate>Wed, 25 Jan 2023 20:57:22 +0000</pubDate>
      <link>https://dev.to/efdev/one-of-the-real-gems-with-the-dnf-package-manager-aliases-327j</link>
      <guid>https://dev.to/efdev/one-of-the-real-gems-with-the-dnf-package-manager-aliases-327j</guid>
      <description>&lt;p&gt;One of the things i &lt;em&gt;really&lt;/em&gt; like about the DNF package manager, is th built-in “alias” system. It's awesome. Because you know how it is, when you have package manager, and a lot of commands to keep track of - we tend to setup a bunch of aliases in our &lt;code&gt;.bash_files&lt;/code&gt;. Like I have a few different ones I then source into my &lt;code&gt;.bashrc&lt;/code&gt; depending on what system I've setup. So, on an Arch system, I have an pacman-file with only aliases for different pacman commands. With Debian I haven a file called ”apt”.&lt;br&gt;
Then I can source them in &lt;code&gt;.bashrc&lt;/code&gt; like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;f &lt;span class="k"&gt;in &lt;/span&gt;aliases functions git pacman&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.bash.d/&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;f&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; ~/.bash.d/&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;f&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;With DNF, there is no need for that. Well, except maybe 1. I do have an alias with: &lt;code&gt;alias sdnf='sudo dnf '&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;But, it's really great, and you can keep your &lt;code&gt;.bash_files&lt;/code&gt; cleaner - and, when exploring what you can do and setup with the alias system - you'll learn a lot about your package manager.&lt;/p&gt;




&lt;p&gt;So, DNF have (by default) already a bunch of pre-defined aliases. Like: &lt;code&gt;in (install), rm (remove), ls (list), se (search), up (upgrade) + more&lt;/code&gt;. If you read the &lt;code&gt;man dnf&lt;/code&gt;, you can see all the ones that are already made.&lt;/p&gt;

&lt;p&gt;And it's really easy to add them your self. Here's how you do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Basic syntax&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;alias &lt;/span&gt;add &amp;lt;&lt;span class="nb"&gt;alias&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;=&lt;/span&gt;&amp;lt;&lt;span class="nb"&gt;command&lt;/span&gt;/replacement&amp;gt;

&lt;span class="c"&gt;# List your added aliases&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;dnf &lt;span class="nb"&gt;alias &lt;/span&gt;list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Examples
&lt;/h3&gt;

&lt;p&gt;Here are a some examples, to show a few.&lt;/p&gt;

&lt;p&gt;In Apt you have “show”, and in DNF it is “info”. So, after using a Debian system during the day, and then later back at home - I sometimes tend to mix them up. Easy to fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;alias &lt;/span&gt;add &lt;span class="nv"&gt;show&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;info
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's already “up” for upgrade, so I've added:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;alias &lt;/span&gt;add &lt;span class="nv"&gt;chup&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;check-update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's already “rm” for remove, so I've added:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;alias &lt;/span&gt;add &lt;span class="nv"&gt;aurm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;autoremove
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here's an example of how you list them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;dnf &lt;span class="nb"&gt;alias &lt;/span&gt;list
Alias &lt;span class="nv"&gt;show&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'info'&lt;/span&gt;
Alias &lt;span class="nv"&gt;aurm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'autoremove'&lt;/span&gt;
Alias &lt;span class="nv"&gt;chup&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'check-update'&lt;/span&gt;
Alias &lt;span class="nv"&gt;h&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'help'&lt;/span&gt;
Alias &lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'info'&lt;/span&gt;
Alias &lt;span class="nv"&gt;yin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'in -y'&lt;/span&gt;
Alias &lt;span class="nv"&gt;yup&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'up -y'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;There is one thing to be aware of though… You can read more about it in the manual, but when using an already defined command/alias - you need to “\backslash” it to prevent an infinite loop.&lt;/p&gt;

&lt;p&gt;Maybe not a good example, but like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;alias &lt;/span&gt;add &lt;span class="nv"&gt;list&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'list installed'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That one needs a backslash, like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;alias &lt;/span&gt;add &lt;span class="nv"&gt;list&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'\list installed'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Well, it's easy, fun, and &lt;em&gt;really&lt;/em&gt; useful, and less clutter in you &lt;code&gt;.bash_files&lt;/code&gt;. Plus, you'll learn more about DNF when exploring all its options.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;// Happy hacking…&lt;/em&gt; ⌨️ 👍&lt;/p&gt;

&lt;p&gt;· Eric&lt;/p&gt;

</description>
      <category>programming</category>
      <category>discuss</category>
      <category>simulationgames</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Encrypting files with #Vim</title>
      <dc:creator>Eric F 🇺🇦</dc:creator>
      <pubDate>Thu, 19 Jan 2023 05:11:33 +0000</pubDate>
      <link>https://dev.to/efdev/encrypting-files-with-vim-ch4</link>
      <guid>https://dev.to/efdev/encrypting-files-with-vim-ch4</guid>
      <description>&lt;p&gt;One of the easiest way to encrypt a file, is to use Vim. Here are two ways on how to set it up, and use it.&lt;/p&gt;




&lt;h3&gt;
  
  
  Setup
&lt;/h3&gt;

&lt;p&gt;First, it could be good to check if your version actually is built with crypt support:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;vim &lt;span class="nt"&gt;--version&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; +crypt
+cryptv            +lispindent        +quickfix          +wildmenu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then you can check if there's a default value set with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="nb"&gt;cm&lt;/span&gt;?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;There are 3 cryptmethods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VimCrypt~01: &lt;code&gt;zip&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;VimCrypt~02: &lt;code&gt;blowfish&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;VimCrypt~03: &lt;code&gt;blowfish2&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You should use &lt;code&gt;blowfish2&lt;/code&gt;, which is the strongest one.&lt;/p&gt;

&lt;p&gt;So, to setup Vim for encryption, all you need is to set the &lt;code&gt;cryptmethod (cm)&lt;/code&gt;. In your &lt;code&gt;.vimrc&lt;/code&gt;, you add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="c"&gt;" cryptmethod&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="nb"&gt;cm&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;blowfish2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To use it… Just pass the &lt;code&gt;-x&lt;/code&gt; option when creating the file. You'll be asked to enter a password, twice - and then you're in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;vim &lt;span class="nt"&gt;-x&lt;/span&gt; &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Using a separate file
&lt;/h3&gt;

&lt;p&gt;To take it another step, you can use a separate file to work with. In that way you can keep your normal settings in &lt;code&gt;.vimrc&lt;/code&gt; - which may include all kinds of viminfo, swap files, backups, etc.&lt;/p&gt;

&lt;p&gt;That's maybe not what you want when working with encrypted files. So, to keep the tracks down - create a new file: &lt;code&gt;~/.vim/vimencrypt&lt;/code&gt;, and then add this to the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="c"&gt;"&lt;/span&gt;
&lt;span class="c"&gt;" ~/.vim/vimencrypt&lt;/span&gt;
&lt;span class="c"&gt;"&lt;/span&gt;
&lt;span class="c"&gt;"&lt;/span&gt;
&lt;span class="c"&gt;" Usage:&lt;/span&gt;
&lt;span class="c"&gt;"   $ vim -u ~/.vim/vimencrypt -x &amp;lt;file&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;"&lt;/span&gt;
&lt;span class="c"&gt;" Or add an alias:&lt;/span&gt;
&lt;span class="c"&gt;"   alias vimx='vim -u ~/.vim/vimencrypt -x '&lt;/span&gt;
&lt;span class="c"&gt;"&lt;/span&gt;
&lt;span class="c"&gt;"   $ vimx &amp;lt;file&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;source&lt;/span&gt; &lt;span class="p"&gt;~&lt;/span&gt;&lt;span class="sr"&gt;/.vim/&lt;/span&gt;vimrc

&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="nb"&gt;cm&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;blowfish2

&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="nb"&gt;viminfo&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="nb"&gt;nobackup&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="k"&gt;noswapfile&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="nb"&gt;nowritebackup&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;small&gt;&lt;em&gt;You may need to adjust the path to where &lt;strong&gt;your&lt;/strong&gt; &lt;code&gt;.vimrc&lt;/code&gt; file is.&lt;/em&gt;&lt;/small&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;In that way you encrypt your files without using: viminfo, no backup file, no swap, etc. And it sources your standard &lt;code&gt;.vimrc&lt;/code&gt;, so you will have your normal environment.&lt;/p&gt;




&lt;h3&gt;
  
  
  Usage:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;vim &lt;span class="nt"&gt;-u&lt;/span&gt; ~/.vim/vimencrypt &lt;span class="nt"&gt;-x&lt;/span&gt; &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;If you don't like the xtra typing… Add an alias:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;vimx&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'vim -u ~/.vim/vimencrypt -x '&lt;/span&gt;

&lt;span class="c"&gt;# and use it with:&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;vimx &amp;lt;file&amp;gt;

&lt;span class="c"&gt;# Example&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;vimx testfile.txt

&lt;span class="c"&gt;#  Result&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;testfile.txt
VimCrypt~03!���4����k
����u&lt;span class="s2"&gt;"E&amp;gt;*�1�~vh���ΊIA(7��@Y�Qj�9l��O
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;To read more about it, use the help:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;h&lt;/span&gt; &lt;span class="nb"&gt;cm&lt;/span&gt;

&lt;span class="c"&gt;" or if you want it in a seaparate tab&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;tab&lt;/span&gt; &lt;span class="k"&gt;h&lt;/span&gt; &lt;span class="nb"&gt;cm&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;em&gt;// Happy hacking…&lt;/em&gt; 👍&lt;/p&gt;

&lt;p&gt;· Eric&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>Adding a swapfile in #Linux</title>
      <dc:creator>Eric F 🇺🇦</dc:creator>
      <pubDate>Fri, 13 Jan 2023 06:43:53 +0000</pubDate>
      <link>https://dev.to/efdev/adding-a-swapfile-in-linux-533n</link>
      <guid>https://dev.to/efdev/adding-a-swapfile-in-linux-533n</guid>
      <description>&lt;p&gt;I usually go with a swapfile instead of a swap partition. So, during installation I don't create that partition, and instead I add the swapfile later.&lt;/p&gt;

&lt;p&gt;So, here's how I do it.&lt;/p&gt;

&lt;p&gt;First, I do everything as &lt;code&gt;su&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~&lt;span class="nv"&gt;$ &lt;/span&gt;su -
Password:
~# 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Create the directory and the swapfile. I prefer the path &lt;code&gt;/var/vm/&lt;/code&gt;. Others may prefer &lt;code&gt;/var/swap/&lt;/code&gt;. To create the swapfile - you can use &lt;code&gt;dd&lt;/code&gt;, or &lt;code&gt;fallocate&lt;/code&gt; if you prefer that one. I use &lt;code&gt;dd&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The size of the swapfile may vary on your needs. I usually go with quite a big one, so in case I want to hibernate - there will be enough room. So, on an old laptop with 3G of RAM - I'll go with 4G.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~# &lt;span class="nb"&gt;mkdir&lt;/span&gt; /var/vm &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /var/vm
vm# &lt;span class="nb"&gt;dd &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/dev/zero &lt;span class="nv"&gt;of&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;./swapfile0 &lt;span class="nv"&gt;bs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1M &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4096 &lt;span class="nv"&gt;status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;progress 
4237295616 bytes &lt;span class="o"&gt;(&lt;/span&gt;4,2 GB, 3,9 GiB&lt;span class="o"&gt;)&lt;/span&gt; copied, 45 s, 94,2 MB/s
4096+0 records &lt;span class="k"&gt;in
&lt;/span&gt;4096+0 records out
4294967296 bytes &lt;span class="o"&gt;(&lt;/span&gt;4,3 GB, 4,0 GiB&lt;span class="o"&gt;)&lt;/span&gt; copied, 45,6187 s, 94,1 MB/s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;And set the permissions to 600:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vm# &lt;span class="nb"&gt;chmod &lt;/span&gt;600 swapfile0
vm# &lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; swapfile0
total 4194304
&lt;span class="nt"&gt;-rw-------&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; 1 root root 4294967296  5 jan 03.14 swapfile0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Then make it an actual swapfile, turn the swap on, and check the status.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vm# mkswap swapfile0
Setting up swapspace version 1, size &lt;span class="o"&gt;=&lt;/span&gt; 4 GiB &lt;span class="o"&gt;(&lt;/span&gt;4294963200 bytes&lt;span class="o"&gt;)&lt;/span&gt;
no label, &lt;span class="nv"&gt;UUID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;unique &lt;span class="nb"&gt;hash &lt;/span&gt;string&amp;gt;
vm# swapon swapfile0
vm# swapon &lt;span class="nt"&gt;-s&lt;/span&gt;
Filename            Type        Size    Used    Priority
/var/vm/swapfile0   file        4194300 0       &lt;span class="nt"&gt;-2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;To make it mount on boot, we need to add it to &lt;code&gt;/etc/fstab&lt;/code&gt;. So, with your favorite editor (eg. vim, vi, nano, etc)…&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vm# vim /etc/fstab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;And add these lines to 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;# Swapfile0
/var/vm/swapfile0   none    swap    defaults    0 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Using the &lt;code&gt;free&lt;/code&gt; command will get you information on how much swap you have and are using.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;free &lt;span class="nt"&gt;-h&lt;/span&gt;
              total        used        free      shared  buff/cache   available
Mem:          2,9Gi       1,3Gi       493Mi       140Mi       1,1Gi       1,3Gi
Swap:         4,0Gi       132Mi       3,9Gi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  SELinux
&lt;/h2&gt;

&lt;p&gt;To make sure it works fine with SELinux, we need to set the correct context to the file: &lt;code&gt;'swap_t'&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~# semanage fcontext &lt;span class="nt"&gt;-a&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; swapfile_t &lt;span class="s1"&gt;'/var/vm/swapfile0'&lt;/span&gt;
~# restorecon /var/vm/swapfile0 
~# &lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-lZ&lt;/span&gt; /var/vm/
total 4194304
&lt;span class="nt"&gt;-rw-------&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; 1 root root unconfined_u:object_r:swapfile_t:s0 4294967296  5 jan 03.17 swapfile0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Tuning
&lt;/h2&gt;

&lt;p&gt;To tune the cache so it doesn't swap too much, you can add these settings to &lt;code&gt;sysctl.conf&lt;/code&gt;. In some systems/distros, you can add them directly there. In others you make an xtra file that will be sourced.&lt;/p&gt;

&lt;p&gt;On my Rocky Linux system, I use an xtra file, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~# vim /etc/sysctl.d/90-swappiness.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Then add this content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="c"&gt;#
# /etc/sysctl.d/90-swappiness.conf
#
# Description:
#     sysctl.conf settings for swap
#
&lt;/span&gt;
&lt;span class="n"&gt;vm&lt;/span&gt;.&lt;span class="n"&gt;swappiness&lt;/span&gt;=&lt;span class="m"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;vm&lt;/span&gt;.&lt;span class="n"&gt;vfs_cache_pressure&lt;/span&gt;=&lt;span class="m"&gt;40&lt;/span&gt;

&lt;span class="n"&gt;vm&lt;/span&gt;.&lt;span class="n"&gt;dirty_background_ratio&lt;/span&gt;=&lt;span class="m"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;vm&lt;/span&gt;.&lt;span class="n"&gt;dirty_ratio&lt;/span&gt;=&lt;span class="m"&gt;15&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Now all is good. :)&lt;/p&gt;




&lt;p&gt;&lt;em&gt;// Happy hacking… 👍&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;· Eric&lt;/p&gt;

</description>
      <category>rockylinux</category>
      <category>linux</category>
      <category>swap</category>
      <category>howto</category>
    </item>
    <item>
      <title>Stop Chromium from asking about default browser</title>
      <dc:creator>Eric F 🇺🇦</dc:creator>
      <pubDate>Sun, 08 Jan 2023 22:35:59 +0000</pubDate>
      <link>https://dev.to/efdev/stop-chromium-from-asking-about-default-browser-3a3g</link>
      <guid>https://dev.to/efdev/stop-chromium-from-asking-about-default-browser-3a3g</guid>
      <description>&lt;p&gt;I have to admit, I'm not a huge Chrom* fan - but still need it from time to time. So, I have it installed. It comes with a few annoyances though… One is it keeps asking about not being the default browser. I use Firefox, of course. :) So, here's a quick-tip on how to disable that.&lt;/p&gt;




&lt;p&gt;After searching around a little bit and found the great startup parameter &lt;code&gt;-no-default-browser-check&lt;/code&gt;. So, to use it… Let's not mess with the original file. It might be overwritten on any update.&lt;/p&gt;

&lt;p&gt;Copy the original file into &lt;code&gt;~/.local/&lt;/code&gt; instead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.local/share/applications
&lt;span class="nb"&gt;cp&lt;/span&gt; /usr/share/applications/chromium-browser.desktop &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can open the file in your favorite editor, and then there are 3 places to edit.&lt;/p&gt;

&lt;p&gt;I also cut out all the optional translation lines - just keeping the default and swedish. So, the file looks like this after my edits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;Desktop Entry]
&lt;span class="nv"&gt;Version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1.0
&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Chromium
&lt;span class="nv"&gt;Comment&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Access the Internet
Comment[sv]&lt;span class="o"&gt;=&lt;/span&gt;Surfa på Internet
&lt;span class="nv"&gt;GenericName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Web Browser
GenericName[sv]&lt;span class="o"&gt;=&lt;/span&gt;Webbläsare
&lt;span class="nv"&gt;Exec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/bin/chromium-browser &lt;span class="nt"&gt;-no-default-browser-check&lt;/span&gt; %U
&lt;span class="nv"&gt;Terminal&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false
&lt;/span&gt;X-MultipleArgs&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false
&lt;/span&gt;&lt;span class="nv"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Application
&lt;span class="nv"&gt;Icon&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;chromium-browser
&lt;span class="nv"&gt;Categories&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Network&lt;span class="p"&gt;;&lt;/span&gt;WebBrowser&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;MimeType&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;application/pdf&lt;span class="p"&gt;;&lt;/span&gt;application/rdf+xml&lt;span class="p"&gt;;&lt;/span&gt;application/rss+xml&lt;span class="p"&gt;;&lt;/span&gt;application/xhtml+xml&lt;span class="p"&gt;;&lt;/span&gt;application/xhtml_xml&lt;span class="p"&gt;;&lt;/span&gt;application/xml&lt;span class="p"&gt;;&lt;/span&gt;image/gif&lt;span class="p"&gt;;&lt;/span&gt;image/jpeg&lt;span class="p"&gt;;&lt;/span&gt;image/png&lt;span class="p"&gt;;&lt;/span&gt;image/webp&lt;span class="p"&gt;;&lt;/span&gt;text/html&lt;span class="p"&gt;;&lt;/span&gt;text/xml&lt;span class="p"&gt;;&lt;/span&gt;x-scheme-handler/http&lt;span class="p"&gt;;&lt;/span&gt;x-scheme-handler/https&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;StartupWMClass&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Chromium-browser
&lt;span class="nv"&gt;Keywords&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;web&lt;span class="p"&gt;;&lt;/span&gt;browser&lt;span class="p"&gt;;&lt;/span&gt;internet&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;Actions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;new-window&lt;span class="p"&gt;;&lt;/span&gt;new-private-window&lt;span class="p"&gt;;&lt;/span&gt;

X-Desktop-File-Install-Version&lt;span class="o"&gt;=&lt;/span&gt;0.23

&lt;span class="o"&gt;[&lt;/span&gt;Desktop Action new-window]
&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Open a New Window
Name[en-US]&lt;span class="o"&gt;=&lt;/span&gt;New Window
Name[sv-SE]&lt;span class="o"&gt;=&lt;/span&gt;Nytt fönster
&lt;span class="nv"&gt;Exec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;chromium-browser &lt;span class="nt"&gt;-no-default-browser-check&lt;/span&gt; %U

&lt;span class="o"&gt;[&lt;/span&gt;Desktop Action new-private-window]
&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Open a New Private Window
Name[en-US]&lt;span class="o"&gt;=&lt;/span&gt;New Private Window
Name[sv-SE]&lt;span class="o"&gt;=&lt;/span&gt;Nytt privat fönster
&lt;span class="nv"&gt;Exec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;chromium-browser &lt;span class="nt"&gt;-no-default-browser-check&lt;/span&gt; &lt;span class="nt"&gt;--incognito&lt;/span&gt; %U
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Now, you can also checkout this great post by &lt;a class="mentioned-user" href="https://dev.to/rahedmir"&gt;@rahedmir&lt;/a&gt; on “&lt;a href="https://dev.to/rahedmir/how-to-fix-google-chrome-chromium-asks-for-password-to-unlock-keyring-in-linux-1dl0"&gt;How to Fix Google Chrome/Chromium asks for password to unlock keyring in Linux&lt;/a&gt;”, to make it stop asking about the keyring.&lt;/p&gt;

&lt;p&gt;If you want that one to? Edit your changes above, and use them together as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-no-default-browser-check --password-store=basic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;No more bugging about not being the default browser. 🤞 Hope you found it useful.👍&lt;/p&gt;

&lt;p&gt;· Eric&lt;/p&gt;

</description>
      <category>chromium</category>
      <category>chrome</category>
      <category>linux</category>
      <category>firefox</category>
    </item>
    <item>
      <title>Bash: clearing the scrollback</title>
      <dc:creator>Eric F 🇺🇦</dc:creator>
      <pubDate>Sat, 07 Jan 2023 09:47:11 +0000</pubDate>
      <link>https://dev.to/efdev/bash-clearing-the-scrollback-1gb5</link>
      <guid>https://dev.to/efdev/bash-clearing-the-scrollback-1gb5</guid>
      <description>&lt;p&gt;So, clearing the screen in Terminal may be the most trivial thing to do - you type &lt;code&gt;clear&lt;/code&gt; or use the keyboard shortcut &lt;code&gt;Ctrl-L&lt;/code&gt;. And then of course you can/will setup some alias to make it easier.&lt;/p&gt;

&lt;p&gt;But, I wanted to do a better setup, to also clear the scrollback. Basically when you type &lt;code&gt;clear&lt;/code&gt;, it'll only push it out of screen, leaving you with a blank screen - but you can still scroll back to the previous output.&lt;/p&gt;

&lt;p&gt;Now, there are several ways to do that, and everyone has their own way and habits. This is what I use.&lt;/p&gt;




&lt;p&gt;First, there are some distros and other OS's that already do this by default. OS X/macOS will clear the scrollback with its keyboard shortcut, and Debian had that already fixed with their &lt;code&gt;Ctrl-L&lt;/code&gt;. But, not all have that - and just the &lt;code&gt;screen&lt;/code&gt; command definitely doesn't clear it.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Aliases
&lt;/h3&gt;

&lt;p&gt;First you can always have a few handy aliases, like &lt;code&gt;c&lt;/code&gt; &amp;amp; &lt;code&gt;k&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;c&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'clear'&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;k&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"printf '&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;033c'"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The alias &lt;code&gt;k&lt;/code&gt; will clear the scrollback.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Keyboard shortcut
&lt;/h3&gt;

&lt;p&gt;If your keyboard shortcut doesn't clear the scrollback you can map it with a &lt;code&gt;bind&lt;/code&gt; (readline) command. I've seen serveral examples using that. But, one caveat is that whatever command you put in that bind line - it'll end up in the history. So, we have to be creative. :)&lt;/p&gt;

&lt;p&gt;Bash have 2 different commands to clear the screen: &lt;code&gt;clear-display (M-C-l)&lt;/code&gt; and &lt;code&gt;clear-screen (C-l)&lt;/code&gt; (see &lt;a href="https://www.gnu.org/software/bash/manual/bash.html#index-clear_002ddisplay-_0028M_002dC_002dl_0029" rel="noopener noreferrer"&gt;Ref manual&lt;/a&gt;). The shortcut &lt;code&gt;Ctrl-L&lt;/code&gt; uses &lt;code&gt;clear-screen&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I was looking through the list of builtins in my Bash version, and it didn't have &lt;code&gt;clear-display&lt;/code&gt;. Maybe it's gone, because normally - using &lt;code&gt;Ctrl-Alt-L&lt;/code&gt; is the shortcut to lock the (computer) screen, and you'll need to login again. But, that's the command we want.&lt;/p&gt;

&lt;p&gt;So, here's the code. You can use this in your &lt;code&gt;.bashrc&lt;/code&gt; or &lt;code&gt;/etc/bashrc&lt;/code&gt; (or where you want to keep your Bash stuff):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Mimic readline's "clear-display (M-C-l)" behaviour,&lt;/span&gt;
&lt;span class="c"&gt;# and bind it to C-l (ie. replacing: "clear-screen (C-l)")&lt;/span&gt;
&lt;span class="k"&gt;function &lt;/span&gt;clear-display&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;033c"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;history&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;history &lt;/span&gt;1&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;bind&lt;/span&gt; &lt;span class="s1"&gt;'"\C-l": "\C-e\C-uclear-display\C-m\C-y"'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok, so what the code does. It will bind &lt;code&gt;Ctrl-L (\C-l)&lt;/code&gt; to first go to the end of the line (&lt;code&gt;\C-e&lt;/code&gt;) and cut it to the beginning of the line (&lt;code&gt;\C-u&lt;/code&gt;). Then run the function &lt;code&gt;clear-display()&lt;/code&gt;, make a new line (&lt;code&gt;\C-m&lt;/code&gt;), and then paste in what was cut out (&lt;code&gt;\C-y&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;When I was looking at other examples, they used &lt;code&gt;\C-a\C-k&lt;/code&gt; - which is the opposite way. Go to the beginning and cut it from there. I found that way didn't work when pasting it back.&lt;/p&gt;

&lt;p&gt;Since everything run by bind will end up in Bash's history… we add &lt;code&gt;history -d $(history 1)&lt;/code&gt; to clear it out.&lt;/p&gt;

&lt;p&gt;Well, that's it.&lt;/p&gt;




&lt;p&gt;This is maybe a bit overkill, but “old habits” and “muscle memory” are two difficult things to escape. ^_^&lt;/p&gt;

&lt;p&gt;&lt;em&gt;// Happy Hacking…&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;· Eric&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>documentation</category>
    </item>
    <item>
      <title>A few notes…</title>
      <dc:creator>Eric F 🇺🇦</dc:creator>
      <pubDate>Sat, 31 Dec 2022 03:39:55 +0000</pubDate>
      <link>https://dev.to/efdev/a-few-notes-3b7l</link>
      <guid>https://dev.to/efdev/a-few-notes-3b7l</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;efdev &lt;span class="nt"&gt;--now&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, I guess some kind of intro post could nice and useful. I actually have (had) a blog I could write on, &lt;em&gt;but…&lt;/em&gt; I hit a few road bumps a couple of years ago, including my computer broke down,  plus a lot of other s****y things (I won't go into here). And my computer broke down in the middle of switching blog tools. I was going to move from Octopress to Pelican. Hopefully, in a couple of three months or so, I'll be able to fix all that again.&lt;/p&gt;

&lt;p&gt;Meanwhile… Still need a place to express myself, or write stuff I need to post of share. Been looking at “dev.to” for a long time, and it seems like a great place to be, and to write som stuff at.&lt;/p&gt;

&lt;p&gt;I guess when my site/blog is up and running again - I'll use this space to write shorter stuff. Like quick-tips, short notes, &amp;amp;/or maybe as compliment to a tweet. I don't know. We'll see.&lt;/p&gt;




&lt;p&gt;Since it's the last day of the year…&lt;/p&gt;

&lt;p&gt;“Happy New 2023” to you all.🎆🥂 Let's hope next year will be a good one.🤞👍&lt;/p&gt;

&lt;p&gt;· Eric&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
  </channel>
</rss>
