<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>d3af90d</title>
    <link>https://deafgod.xyz/</link>
    <description>Recent content on d3af90d</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>deafgod@proton.me (d3af90d)</managingEditor>
    <webMaster>deafgod@proton.me (d3af90d)</webMaster>
    <copyright>d3af90d</copyright>
    <lastBuildDate>Fri, 06 Dec 2024 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://deafgod.xyz/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Tricks</title>
      <link>https://deafgod.xyz/tricks/</link>
      <pubDate>Fri, 06 Dec 2024 00:00:00 +0000</pubDate><author>deafgod@proton.me (d3af90d)</author>
      <guid>https://deafgod.xyz/tricks/</guid>
      <description>&lt;hr&gt;&#xA;&lt;!-- toc --&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#vim-motions-in-bash-shell&#34;&gt;vim motions in bash shell&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#minify-images-disk-usage-with-cli&#34;&gt;minify images disk usage with CLI&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;#create-table-of-contents-in-markdown-files-the-easy-way&#34;&gt;create table of contents in markdown files (the easy way)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;!-- tocstop --&gt;&#xA;&lt;hr&gt;&#xA;&lt;h4 id=&#34;vim-motions-in-bash-shell&#34;&gt;vim motions in bash shell&lt;/h4&gt;&#xA;&lt;p&gt;If you want vim motions in your bash CLI, put this in your &lt;code&gt;$HOME/.inputrc&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;set&lt;/span&gt; editing-mode vi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;set&lt;/span&gt; show-mode-in-prompt on&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;set&lt;/span&gt; vi-ins-mode-string &lt;span class=&#34;se&#34;&gt;\1\e&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;6&lt;/span&gt; q&lt;span class=&#34;se&#34;&gt;\2&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34;&gt;4&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;set&lt;/span&gt; vi-cmd-mode-string &lt;span class=&#34;se&#34;&gt;\1\e&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;2&lt;/span&gt; q&lt;span class=&#34;se&#34;&gt;\2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now you can enter vim Normal mode with &lt;code&gt;ESC&lt;/code&gt; or &lt;code&gt;CTRL+[&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When in Normal mode in bash, if you press &lt;code&gt;v&lt;/code&gt; the command in the current line gets opened in a vim buffer!&#xA;This is very useful for editing long commands in the comfort of the editor.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<hr>
<!-- toc -->
<ul>
<li><a href="#vim-motions-in-bash-shell">vim motions in bash shell</a></li>
<li><a href="#minify-images-disk-usage-with-cli">minify images disk usage with CLI</a></li>
<li><a href="#create-table-of-contents-in-markdown-files-the-easy-way">create table of contents in markdown files (the easy way)</a></li>
</ul>
<!-- tocstop -->
<hr>
<h4 id="vim-motions-in-bash-shell">vim motions in bash shell</h4>
<p>If you want vim motions in your bash CLI, put this in your <code>$HOME/.inputrc</code>:</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="ln">1</span><span class="cl"><span class="nb">set</span> editing-mode vi
</span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="nb">set</span> show-mode-in-prompt on
</span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="nb">set</span> vi-ins-mode-string <span class="se">\1\e</span><span class="o">[</span><span class="m">6</span> q<span class="se">\2</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl"><span class="nb">set</span> vi-cmd-mode-string <span class="se">\1\e</span><span class="o">[</span><span class="m">2</span> q<span class="se">\2</span></span></span></code></pre></div><p>Now you can enter vim Normal mode with <code>ESC</code> or <code>CTRL+[</code>.</p>
<p>When in Normal mode in bash, if you press <code>v</code> the command in the current line gets opened in a vim buffer!
This is very useful for editing long commands in the comfort of the editor.</p>
<hr>
<h4 id="minify-images-disk-usage-with-cli-for-web-upload">minify images disk usage with CLI for web upload</h4>





<pre tabindex="0"><code>magick image.png image.webp
cwebp -q 40 image.webp -o image-smaller.webp</code></pre><hr>
<h4 id="create-table-of-contents-in-markdown-files-the-easy-way">create table of contents in markdown files (the easy way)</h4>
<ul>
<li>Download <a href="https://github.com/jonschlinkert/markdown-toc">markdown-toc</a></li>
<li>Insert <code>!-- toc --&gt;</code> where you want the table of content in your file.</li>
<li>Run <code>markdown-toc -i filename.md</code> to create the table of content.</li>
</ul>
<p>In vim, run <code>:!markdown-toc -i &quot;%&quot;</code> using a keybinding like <code>leader-t</code> and your good to go.</p>
<p>I sometimes like to insert emojis at the start of headers (if you don&rsquo;t approove it, you are too old 😙) and then make a toc with above mentioned method.</p>
<p>Problem is that when the markdown is rendered on Github, the emoji is part of the link gets underlined with the usual blue link bar.</p>
<p>I don&rsquo;t like it.</p>
<p>So I made a sed command that formats the toc as I like and saved it in a script called <code>t4g</code>.
I just select the lines in visual mode and run <code>:!t4g</code>.</p>
<p>I also needed one that formats the toc for Obsidian: <code>t4o</code>.</p>
<p>Here the <code>sed</code> commands:</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="ln">1</span><span class="cl"><span class="c1"># t4g (*t*oc*4g*ithub)</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl">sed <span class="s1">&#39;s:\[\([^ ]*\) \(.*\)\](#[^-]*-\(.*\)):\1 \[\2\](#-\3):&#39;</span></span></span></code></pre></div>




<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="ln">1</span><span class="cl"><span class="c1"># t4o (*t*oc*4o*bsidian)</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl">sed <span class="s1">&#39;s:\[\([^ ]*\) \(.*\)\](#[^-]*-\(.*\)):\1 \[\2\](#-\3):&#39;</span></span></span></code></pre></div><p>Given this toc:</p>





<pre tabindex="0"><code>- [😃 Smiling](#%F0%9F%98%83-smiling)
- [😻 Lovely cat](#%F0%9F%98%BB-lovely-cat)
  * [😅 Grinning subheader](#%F0%9F%98%85-grinning-subheader)</code></pre><p>The scripts transform it like this:</p>





<pre tabindex="0"><code># t4g
- 😃 [Smiling](#-smiling)
- 😻 [Lovely cat](#-lovely-cat)
  * 😅 [Grinning subheader](#-grinning-subheader)

# t4o
- [[#😃 Smiling]]
- [[#😻 Lovely cat]]
  * [[#😅 Grinning subheader]]</code></pre><hr>
]]></content:encoded>
    </item>
    <item>
      <title>Setting up a system-wide Wireguard DNS server</title>
      <link>https://deafgod.xyz/blog/vpn-dns/</link>
      <pubDate>Fri, 06 Dec 2024 00:00:00 +0000</pubDate><author>deafgod@proton.me (d3af90d)</author>
      <guid>https://deafgod.xyz/blog/vpn-dns/</guid>
      <description>&lt;p&gt;I wanted the DNS located in my Wireguard VPN to be the default one for my systems.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;NetworkManager&lt;/code&gt; is managing my DNS at the moment.&lt;/p&gt;&#xA;&lt;p&gt;I am using Arch Linux and I haven&amp;rsquo;t changed this configuration since install, so I guess this is the default config.&#xA;I need to disable that.&lt;/p&gt;&#xA;&lt;p&gt;Disable &lt;code&gt;NetworkManager&lt;/code&gt; DNS management:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# /etc/NetworkManager/NetworkManager.conf&#xA;[main]&#xA;dns=none&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart &lt;code&gt;NetworkManager&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;systemctl restart NetworkManager&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I wanted &lt;code&gt;systemd-resolved&lt;/code&gt; to manage my DNS servers.&lt;/p&gt;&#xA;&lt;p&gt;Add this in &lt;code&gt;/etc/systemd/resolved.conf&lt;/code&gt; to have &lt;a href=&#34;https://quad9.net/&#34;&gt;quad9&lt;/a&gt; servers as defaults:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I wanted the DNS located in my Wireguard VPN to be the default one for my systems.</p>
<p><code>NetworkManager</code> is managing my DNS at the moment.</p>
<p>I am using Arch Linux and I haven&rsquo;t changed this configuration since install, so I guess this is the default config.
I need to disable that.</p>
<p>Disable <code>NetworkManager</code> DNS management:</p>





<pre tabindex="0"><code># /etc/NetworkManager/NetworkManager.conf
[main]
dns=none</code></pre><p>Restart <code>NetworkManager</code>:</p>





<pre tabindex="0"><code>systemctl restart NetworkManager</code></pre><p>I wanted <code>systemd-resolved</code> to manage my DNS servers.</p>
<p>Add this in <code>/etc/systemd/resolved.conf</code> to have <a href="https://quad9.net/">quad9</a> servers as defaults:</p>





<pre tabindex="0"><code>DNS=9.9.9.9
FallbackDNS=149.112.112.112#dns.quad9.net 2620:fe::9#dns.quad9.net</code></pre><p>Restart <code>systemd-resolved</code>:</p>





<pre tabindex="0"><code>systemctl restart systemd-resolved</code></pre><p>Finally I set some wireguard VPN <code>PostUp</code> and <code>PostDown</code> directives for editing and restoring my <code>/etc/resolv.conf</code> file when I use my VPN.
This is my wireguard conf:</p>





<pre tabindex="0"><code>[Interface]
Address = &lt;ip address for vpn interface&gt;
PrivateKey = &lt;priv key&gt;
DNS = &lt;ip address of vpn dns&gt;
PostUp = echo &#39;nameserver &lt;vpn dns ip address&gt;&#39; &gt; /etc/resolv.conf
PostUp = resolvectl dns %i &lt;vpn dns ip address&gt;
PostUp = resolvectl domain %i &#34;~.&#34;
PostUp = resolvectl default-route %i
PreDown = systemctl restart systemd-resolved
PreDown = resolvectl revert %i

[Peer]
PublicKey = &lt;pubkey&gt;
Endpoint = &lt;dns server ip or domain&gt;
AllowedIPs = &lt;allowed ip for the vpn&gt;</code></pre><p>All programs seem to use the right DNS now.</p>
<p>Hope it stays that way.</p>
]]></content:encoded>
    </item>
    <item>
      <title>deSEC saved the day when GoDaddy ruined it</title>
      <link>https://deafgod.xyz/blog/desec/</link>
      <pubDate>Mon, 03 Jun 2024 22:30:20 +0200</pubDate><author>deafgod@proton.me (d3af90d)</author>
      <guid>https://deafgod.xyz/blog/desec/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m hosting the &lt;code&gt;deafgod.xyz&lt;/code&gt; domain on &lt;em&gt;GoDaddy&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;I don&amp;rsquo;t actually know why I chose GoDaddy since I&amp;rsquo;ve always read complaints about their services.&lt;/p&gt;&#xA;&lt;p&gt;Well, better than my old registrar.&lt;/p&gt;&#xA;&lt;p&gt;For my old domain I used &lt;em&gt;Epik&lt;/em&gt; but after &lt;a href=&#34;https://en.wikipedia.org/wiki/2021_Epik_data_breach&#34;&gt;EpikFail&lt;/a&gt; I decided to drop it.&lt;/p&gt;&#xA;&lt;p&gt;Did I download the leak to check if my personal information were in it? 🤔&#xA;I don&amp;rsquo;t remember.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;Since this machine has a dynamic public IP, I wanted a script that changes my DNS records when the public IP changes.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I&rsquo;m hosting the <code>deafgod.xyz</code> domain on <em>GoDaddy</em>.</p>
<hr>
<p>I don&rsquo;t actually know why I chose GoDaddy since I&rsquo;ve always read complaints about their services.</p>
<p>Well, better than my old registrar.</p>
<p>For my old domain I used <em>Epik</em> but after <a href="https://en.wikipedia.org/wiki/2021_Epik_data_breach">EpikFail</a> I decided to drop it.</p>
<p>Did I download the leak to check if my personal information were in it? 🤔
I don&rsquo;t remember.</p>
<hr>
<p>Since this machine has a dynamic public IP, I wanted a script that changes my DNS records when the public IP changes.</p>
<p>The first time the public IP changed and I edited the DNS records by hand, I already had enough 🙈</p>
<p>I knew that GoDaddy had an API, but after creating the tokens and setting up everything, I discovered that they disabled the API for customers with less than 50 domains 🥲</p>
<p>In the last few weeks I checked various services but none of them satisfied me.</p>
<p>I didn&rsquo;t want to register another domain with some dynDNS registrar and pay for it.
I couldn&rsquo;t host my own DNS server on a machine with a static public IP because I would need to pay that too.</p>
<p>But during my research a redditor saved the day:
<img src="./desec.webp" alt="Reddit Answer"></p>
<p>As <a href="https://desec.io">deSEC</a> describes itself:</p>
<blockquote>
<p>deSEC is a free DNS hosting service, designed <strong>with security in mind</strong>.<br>
Running on <strong>open-source</strong> software and supported by SSE, deSEC is <strong>free for everyone to use</strong>.</p>
</blockquote>
<p>What? OpenSource and backed by a german organization?</p>
<p>It MUST be good!</p>
<p>You don&rsquo;t need to buy a domain from them, you can just let their nameservers manage your domains.</p>
<p>I quickly made an account on deSEC, deleted all my DNS records from GoDaddy and set NS records pointing to deSEC servers.</p>





<pre tabindex="0"><code>$ dig +short NS deafgod.xyz
ns2.desec.org.
ns1.desec.io.</code></pre><p><strong>They ask only for an e-mail and that&rsquo;s it!</strong></p>
<p>No KYC stuff!</p>
<p>They have both a web UI and a free API and the <a href="https://github.com/desec-io/desec-stack">whole stack</a> is on github.</p>
<p>Long story short:</p>
<ul>
<li>Made a script</li>
<li><code>crontab -e</code> a <code>*/10 * * * * /root/bin/ddns &gt;&gt; /root/bin/ddns.log 2&gt;&amp;1</code></li>
<li><code>crontab -l</code> to check everything was good</li>
</ul>
<p>I have dynamic DNS now.</p>
<p>Open source, free and hackable.</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="ln"> 1</span><span class="cl"><span class="cp">#!/usr/bin/bash
</span></span></span><span class="line"><span class="ln"> 2</span><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="ln"> 3</span><span class="cl"><span class="nv">REAL_IP</span><span class="o">=</span><span class="sb">`</span>curl --silent https://checkipv4.dedyn.io/<span class="sb">`</span> <span class="o">||</span> <span class="nb">exit</span>
</span></span><span class="line"><span class="ln"> 4</span><span class="cl"><span class="nv">DNS_IP</span><span class="o">=</span><span class="sb">`</span>dig +short A deafgod.xyz @ns1.desec.io<span class="sb">`</span> <span class="o">||</span> <span class="nb">exit</span>
</span></span><span class="line"><span class="ln"> 5</span><span class="cl">
</span></span><span class="line"><span class="ln"> 6</span><span class="cl"><span class="k">if</span> <span class="o">[[</span> <span class="s2">&#34;</span><span class="nv">$REAL_IP</span><span class="s2">&#34;</span> !<span class="o">=</span> <span class="s2">&#34;</span><span class="nv">$DNS_IP</span><span class="s2">&#34;</span> <span class="o">]]</span><span class="p">;</span> <span class="k">then</span>
</span></span><span class="line"><span class="ln"> 7</span><span class="cl">  <span class="nb">echo</span> <span class="s2">&#34;</span><span class="k">$(</span>date<span class="k">)</span><span class="s2"> - IP: </span><span class="si">${</span><span class="nv">REAL_IP</span><span class="si">}</span><span class="s2"> - DNS: </span><span class="si">${</span><span class="nv">DNS_IP</span><span class="si">}</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="ln"> 8</span><span class="cl">  curl --silent --ipv4 https://update.dedyn.io/?hostname<span class="o">=</span>deafgod.xyz <span class="se">\
</span></span></span><span class="line"><span class="ln"> 9</span><span class="cl"><span class="se"></span>  --header <span class="s2">&#34;Authorization: Token &lt;secret&gt;&#34;</span>
</span></span><span class="line"><span class="ln">10</span><span class="cl"><span class="k">fi</span></span></span></code></pre></div><p>The records updated with the API have a TTL of 60.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
