<?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>Posts on rooiratel</title><link>https://rooiratel.red/posts/</link><description>Stephan Snyman's personal website</description><language>en-gb</language><generator>Hugo</generator><atom:link href="https://rooiratel.red/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>Redesign 2024</title><link>https://rooiratel.red/posts/redesign-2024/</link><pubDate>Sat, 30 Mar 2024 13:00:00 +0000</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/redesign-2024/</guid><description>Damn, it’s been more than a year since I last posted! When I started this website I used Hugo to build my site. To save time I also used a theme to handle the front-end design of the site. But as time went on, and I started making small changes here and there, I eventually ended up in situations where the theme I was using couldn’t really accommodate the changes I made without some nasty hacks. And then I encountered situations where the theme was outright blocking me from making changes in a way that I wanted them. It was clearly time to remove the theme altogether and do the entire site without relying on a theme.</description><content:encoded><![CDATA[<p>Damn, it&rsquo;s been more than a year since I last posted! When I started this website I used Hugo to build my site. To save time I also used a theme to handle the front-end design of the site. But as time went on, and I started making small changes here and there, I eventually ended up in situations where the theme I was using couldn&rsquo;t really accommodate the changes I made without some nasty hacks. And then I encountered situations where the theme was outright blocking me from making changes in a way that I wanted them. It was clearly time to remove the theme altogether and do the entire site without relying on a theme.</p>
<p>It just so happened that when I started doing the redesign, my life got very busy. I still did little tweaks here and there, but it was not a quick change. I eventually had a free long weekend, and this new look is the result.</p>
<p>I have more free time now, and so I hope to be posting more frequently again. Let&rsquo;s see&hellip;</p>
]]></content:encoded></item><item><title>Easy disk recovery</title><link>https://rooiratel.red/posts/ez-disk-recovery/</link><pubDate>Sun, 12 Mar 2023 20:03:37 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/ez-disk-recovery/</guid><description>I have some really old hard drives in my PC. There was a power failure, and when I booted up my PC again, I instantly heard the click of death. Not a good sign. Also, I couldn’t access the drive at all. I checked dmesg, and yeah, my shitty Seagate HDD was really dead.
Luckily, I had two new and unused 6TB Toshiba hard drives in storage.
Prepare new hard drive I plugged in the new drive and create a new ext4 file system on it.</description><content:encoded><![CDATA[<p>I have some really old hard drives in my PC. There was a power failure, and when I booted up my PC again, I instantly heard the click of death. Not a good sign. Also, I couldn&rsquo;t access the drive at all. I checked <code>dmesg</code>, and yeah, my shitty Seagate HDD was really dead.</p>
<p>Luckily, I had two new and unused 6TB Toshiba hard drives in storage.</p>
<h2 id="prepare-new-hard-drive">Prepare new hard drive</h2>
<p>I plugged in the new drive and create a new ext4 file system on it.</p>
<pre tabindex="0"><code># mkfs.ext4 /dev/sdY
</code></pre><p>Next, I created a directory to mount it.</p>
<pre tabindex="0"><code># mkdir /mnt/cool-name
</code></pre><p>and then mounted it.</p>
<pre tabindex="0"><code># mount /dev/sdY /mnt/cool-name
</code></pre><p>That worked - I could see it, but I couldn&rsquo;t create any files on this file system. The root user was being mean&hellip; Here&rsquo;s how I fixed it:</p>
<pre tabindex="0"><code># chmod o+w /mnt/cool-name
</code></pre><p>Much better.</p>
<h2 id="ddrescue-to-the-rescue">ddrescue to the rescue</h2>
<p>I followed the instructions on the <a href="https://wiki.archlinux.org/title/Disk_cloning">ArchWiki Disk Cloning</a> page.</p>
<p>Well, with one small alteration, it was not clear to me where the rescue.map file was stored, so I explicitly stored it in the /root/ directory.</p>
<p>I first cloned every block that did not have read errors.</p>
<pre tabindex="0"><code># ddrescue --force -n /dev/sdX /dev/sdY /root/rescue.map
</code></pre><p>This took about 5 hours on my 2TB drive. You can pause this with <code>Ctrl+C</code> and then resume later by running the same command again. Using the rescue.map file, it will continue where it left off. I tested this multiple times.</p>
<p>Once that was done, I needed to copy all the faulty blocks.</p>
<pre tabindex="0"><code># ddrescue --force -d -r3 -n /dev/sdX /dev/sdY /root/rescue.map
</code></pre><p>This didn&rsquo;t take long at all for me, since it was comprised of only 0.01% of the remaining blocks.</p>
<p>Finally I ran <code>fsck</code> on the new partition to fix any corruption issues.</p>
<pre tabindex="0"><code># fsck -f /dev/sdY
</code></pre><p>This also didn&rsquo;t take long.</p>
<h2 id="final-touches">Final touches</h2>
<p>Because the old partition was cloned onto the new one, the partition label and various metadata all get applied to the partition on the new hard drive.</p>
<p>To change the label of the new partition without formatting it, I needed to do the following:</p>
<pre tabindex="0"><code>sudo e2label /dev/sdY cool-name
</code></pre><p>where &ldquo;cool-name&rdquo; was the new label for your partition.</p>
<p>Then I resized the file system to fit to the size of the new disk.</p>
<pre tabindex="0"><code>sudo resize2fs /dev/sdY
</code></pre><p>Finally, I added this new partition as an entry on my <code>/etc/fstab</code> config to mount it to <code>/mnt/cool-name</code> on startup. And with that, I was done.</p>
<p><code>ddrescue</code> did a great job, and I got all my files back from a completely useless hard drive that will soon have its platters become intimately familiar with an industrial-strength drill.</p>
]]></content:encoded></item><item><title>Reading "fost" at no cost</title><link>https://rooiratel.red/posts/speedread/</link><pubDate>Sun, 29 Jan 2023 18:44:41 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/speedread/</guid><description>Do you, like me, have too much long-form text to read on your computer and not enough time to read it all? The solution is easier than you think.
There are speed-reading “apps” that can help you to read text in a website at a much faster pace than you would normally do. If I am not mistaken, Spritz was the original one. I don’t use my cellphone much, so an app is useless to me, and Spritz’s solution for PCs is a browser plugin. Maybe it would work for you, but I just don’t like its interface.</description><content:encoded><![CDATA[<p>Do you, like me, have too much long-form text to read on your computer and not enough time to read it all? The solution is easier than you think.</p>
<p>There are speed-reading &ldquo;apps&rdquo; that can help you to read text in a website at a much faster pace than you would normally do. If I am not mistaken, <a href="https://spritz.com/">Spritz</a> was the original one. I don&rsquo;t use my cellphone much, so an app is useless to me, and Spritz&rsquo;s solution for PCs is a browser plugin. Maybe it would work for you, but I just don&rsquo;t like its interface.</p>
<p>I decided to look for alternatives. I needed something that would help me speed-read any text on my PC and do it in a way that didn&rsquo;t irritate me or get in my way ‒ and ideally, it would be something open source as well. I stumbled upon some CLI programs which met my requirements, but how was I going to easily input random text into these without having to put in much effort on my side? I know I sound lazy now, but if I&rsquo;m trying to improve my productivity, then giving myself a bunch of extra work isn&rsquo;t going to help.</p>
<p>The solution was dead simple, and when I realised it I couldn&rsquo;t believe that I hadn&rsquo;t seen something like this before. Just use the clipboard! I&rsquo;ll write a small wrapper script to feed the current content of the clipboard into the speed-reading program, and with a single command I can speed read any text on my computer.</p>
<p>The CLI script I settled on was <a href="https://github.com/pasky/speedread/blob/master/speedread">this simple but elegant Perl script</a>. There&rsquo;s been one commit since 2016, so I&rsquo;ve kept a fork for just in case.</p>
<p>Save this Perl script on your PC as <code>~/bin/speedread</code>.</p>
<p>Now for the wrapper script. Create <code>~/bin/fost</code> with the following contents:</p>
<pre tabindex="0"><code>#!/usr/bin/env bash

# Uncomment the line that is relevant to your display manager:

## xorg:
# content=$(xclip -o)
## wayland:
# content=$(wl-paste -p)

countdown=&#34;10 9 8 7 6 5 4 3 2 1&#34;; combi=&#34;$countdown $content&#34;; echo $combi | speedread -w 300
</code></pre><p>I&rsquo;ve added a countdown ‒ feel free to remove it. The -w 300 flag sets the default reading speed in wpm.</p>
<p>Now give both these scripts execution privileges.</p>
<p>Now you can select any text on your PC, type <code>fost</code> into a terminal, and you are speed reading through whatever you want. And it&rsquo;s all with open source code too!</p>
]]></content:encoded></item><item><title>When being root is not enough</title><link>https://rooiratel.red/posts/when-being-root-is-not-enough/</link><pubDate>Fri, 25 Nov 2022 15:19:31 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/when-being-root-is-not-enough/</guid><description>The other day, when I logged into my server, I realised that I hadn’t upgraded it in a while. Fedora 37 had just been released, so it was a good time for an upgrade. The process went smoothly, but I noticed after rebooting that the Caddy service failed to start. At first I thought that maybe something in the config was no longer compatible with the new version of Caddy. Everything checked out fine. When I manually executed the command in the caddy.service file then the service would start up without any issues.</description><content:encoded><![CDATA[<p>The other day, when I logged into my server, I realised that I hadn&rsquo;t upgraded it in a while. Fedora 37 had just been released, so it was a good time for an upgrade. The process went smoothly, but I noticed after rebooting that the <a href="https://caddyserver.com/">Caddy</a> service failed to start. At first I thought that maybe something in the config was no longer compatible with the new version of Caddy. Everything checked out fine. When I manually executed the command in the caddy.service file then the service would start up without any issues.</p>
<p>That was strange. The Caddyfile is owned by root, the caddy.service file is owned by root, and the service is executed and run as root. So it wasn&rsquo;t a permission issue.</p>
<p>Let&rsquo;s see what systemd has to say for itself.</p>
<p>I ran the command <code>journalctl -u caddy --no-pager | less</code>, and that is when I saw this:</p>
<p><code>caddy[736]: run: reading config file: open /the/path/to/Caddyfile: permission denied</code></p>
<p>So it was a permission issue after all. But how? Is being root not enough?</p>
<p>I furiously started searching the web and eventually stumbled upon <a href="https://stackoverflow.com/questions/51209967/systemd-service-file-failed-to-execute-command-permission-denied">this StackOverflow post</a>, which suggested that SELinux could cause this type of behaviour.</p>
<p>I temporarily disabled SELinux with <code>sudo setenforce Permissive</code> to see if it would fix my issue ‒ and it did. Cool, but why would SELinux cause the issue in the first place? What didn&rsquo;t it like about my caddy.service file?</p>
<p>To find out, I started with the <code>semanage fcontext --list</code> command. This is when I realised that I was storing my Caddyfile in a directory that SELinux didn&rsquo;t approve of. So my final solution was just to move it to a directory that SELinux was happy with. The last thing I needed to do was update the caddy.service file to point to the new location of the Caddyfile and restart the service.</p>
]]></content:encoded></item><item><title>The Unspoken Prerequisite for Learning Vim</title><link>https://rooiratel.red/posts/unspoken-prerequisite-vi/</link><pubDate>Thu, 30 Jun 2022 16:39:58 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/unspoken-prerequisite-vi/</guid><description>When I first heard about Vim, it sounded amazing. I immediately wanted to start learning how to use it. However, my enthusiasm dropped off a cliff when I realised that the learning curve was an equally sheer cliff. Modal editing; HJKL keys for navigation; ESC doesn’t exit the application — this all seemed rather ridiculous to me at the time. I was young and inexperienced, and the commands seemed too unintuitive for me to bother memorising them.</description><content:encoded><![CDATA[<p>When I first heard about Vim, it sounded amazing. I immediately wanted to start learning how to use it. However, my enthusiasm dropped off a cliff when I realised that the learning curve was an equally sheer cliff. Modal editing; HJKL keys for navigation; ESC doesn&rsquo;t exit the application &mdash; this all seemed rather ridiculous to me at the time. I was young and inexperienced, and the commands seemed too unintuitive for me to bother memorising them.</p>
<p>So I gave up, believing I&rsquo;d just have to do without it.</p>
<p>About a year after the fact, in a separate effort to improve my productivity, I decided to teach myself how to touch type. I had seen a colleague copy the contents from a book onto their laptop, typing entire pages as they read them without once looking up. Not that anyone has to do that very often, but I wanted to be able to do that myself. About a month later, I could type at my usual speed but now without looking at the keyboard. And not much later, I could type much faster. This skill has paid off in small but noticeable ways over the years.</p>
<p>Not long after that, I ended up switching jobs, and at the new place, I regularly had to ssh into servers where Vim was the only text editor installed, and installing anything else was just a pain. So I resolved to give Vim one more try, since I was going have to deal with it on a regular basis.</p>
<p>This time around, I managed to get to a surprisingly productive state with Vim in no more than a day. It was as if something had just clicked, and everything just made intuitive sense to me. I was shocked at the stark contrast between my first and second attempts. Giving it some thought, I realised that the only difference was that I had learnt touch typing. The reason everything suddenly made sense to me was because all the commands had been chosen based on what would make sense from a touch-typing perspective. Using the HJKL keys for navigation is the most clear example of this.</p>
<p>It seems rather obvious from a touch-typist&rsquo;s viewpoint. However, having been at that point where I didn&rsquo;t know how to touch type, I can understand that for some people the commands may just seem bizarre, to say the least.</p>
<p>So here is some advice that I have never heard or seen when the topic of Vim comes up: if you are learning Vim and just can&rsquo;t seem to get it, first learn touch typing. It will make all the difference.</p>
]]></content:encoded></item><item><title>Giving Up Caffeine : Part 3</title><link>https://rooiratel.red/posts/giving-up-caffeine-part-3/</link><pubDate>Wed, 07 Jul 2021 10:33:50 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/giving-up-caffeine-part-3/</guid><description>I made it. Three months with no caffeine. Could I go for longer? Yes, I feel that I could totally live without coffee/caffeine — but the thing is, I still really like coffee. This morning I went to a coffee shop and bought a large café latte. It was amazing, but nothing I can’t live without. Going forward, I will continue to drink coffee whenever I want. It would be interesting to see whether or not I will drink as much as I used to.</description><content:encoded><![CDATA[<p>I made it. Three months with no caffeine. Could I go for longer? Yes, I feel that I could totally live without coffee/caffeine &mdash; but the thing is, I still really like coffee. This morning I went to a coffee shop and bought a large café latte. It was amazing, but nothing I can&rsquo;t live without. Going forward, I will continue to drink coffee whenever I want. It would be interesting to see whether or not I will drink as much as I used to.</p>
<p>After three months of no caffeine, having experienced no physiological changes, I can definitively say that giving up caffeine offers me no benefits other than saving a little bit of money.</p>
<p>Coffee relaxes me while also helping me stay awake for longer. And I really enjoy the taste. With no negative side effects, I can&rsquo;t see a reason why I&rsquo;d ever stop drinking coffee.</p>
<p>During my own research in the last 3 months, asking people how it affects them, in the last 3 months I do know that it makes some people anxious or makes them need to go to the bathroom often. But caffeine affects different people in different ways and these have never been issues for me.</p>
<p>In closing, I now have an answer for whenever someone says coffee &ldquo;bad&rdquo; for me.</p>
<h1 id="update">Update</h1>
<p>On the first day, I had about six cups of coffee. Since then I&rsquo;d say I&rsquo;ve been averaging about eight cups a day. So it&rsquo;s sitting at the lower band of my previous rate. It might increase or it might stay the same.</p>
]]></content:encoded></item><item><title>Creating a Cheeky Ouroboros Out of Google APIs</title><link>https://rooiratel.red/posts/google-ouroboros/</link><pubDate>Thu, 01 Jul 2021 18:06:45 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/google-ouroboros/</guid><description>Do you want to know something that fills me with unspeakable joy for very little effort?
Like many others, I loathe being forced to fill in Google reCAPTCHA challenges. They are tedious, exploit people as free workers in order to improve their AI research, and most importantly, they are a terrible way to distinguish humans from bots. However, there is a sneaky way around this Sisyphean nightmare.
Firefox has an add-on called Buster: Captcha Solver for Humans. Here’s what it does: when you receive a reCAPTCHA challenge, it gives you a 3rd option; when you click the Buster button, it requests the vision-impaired reCAPTCHA challenge (audio only). Then, using Google’s own audio recognition API, it solves the reCAPTCHA challenge for you!</description><content:encoded><![CDATA[<p>Do you want to know something that fills me with unspeakable joy for very little effort?</p>
<p>Like many others, I loathe being forced to fill in Google reCAPTCHA challenges. They are tedious, exploit people as free workers in order to improve their AI research, and most importantly, they are a terrible way to distinguish humans from bots. However, there is a sneaky way around this Sisyphean nightmare.</p>
<p>Firefox has an add-on called <a href="https://addons.mozilla.org/en-US/firefox/addon/buster-captcha-solver/">Buster: Captcha Solver for Humans</a>. Here&rsquo;s what it does: when you receive a reCAPTCHA challenge, it gives you a 3rd option; when you click the Buster button, it requests the vision-impaired reCAPTCHA challenge (audio only). Then, using Google&rsquo;s own audio recognition API, it solves the reCAPTCHA challenge for you!</p>
<p>I have been using this add-on for years with a success rate of about 90%. It has saved me so much wasted time &mdash; but, more importantly, it has allowed me to bask in the irony of something as simple as a browser add-on defeating Google&rsquo;s &ldquo;state of the art&rdquo; &ldquo;reverse Turing test&rdquo;.</p>
<p>If you hate solving reCAPTCHA challenges, you know what you have to do.</p>
]]></content:encoded></item><item><title>Giving Up Caffeine : Part 2</title><link>https://rooiratel.red/posts/giving-up-caffeine-part-2/</link><pubDate>Fri, 07 May 2021 20:00:03 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/giving-up-caffeine-part-2/</guid><description>It has been exactly one month since I gave up caffeine.
The day I started, I didn’t experience anything noteworthy. However, for the following two days, I had some intense muscle cramps that made made me think that I had the flu. I probably should have looked this up beforehand, but it turns out that muscle cramps are one of the possible symptoms of caffeine withdrawal.
This didn’t last long though. On the fourth day, I was feeling 100% again and have been since.</description><content:encoded><![CDATA[<p>It has been exactly one month since I gave up caffeine.</p>
<p>The day I started, I didn&rsquo;t experience anything noteworthy. However, for the following two days, I had some intense muscle cramps that made made me think that I had the flu. I probably should have looked this up beforehand, but it turns out that muscle cramps are one of the possible symptoms of caffeine withdrawal.</p>
<p>This didn&rsquo;t last long though. On the fourth day, I was feeling 100% again and have been since.</p>
<p>In terms of the benefits of giving up caffeine, I haven&rsquo;t noticed any improvements in my daily life. I don&rsquo;t think any more or less clearly. I don&rsquo;t concentrate any better or any worse. I don&rsquo;t feel any more or any less jittery or irritable. I don&rsquo;t feel any more or any less anxious.</p>
<p>What I have noticed, though, is that I have been sleeping worse. Moreover, it is noticeably more difficult for me to stay awake after 22:00, whereas before I would not even feel mildly tired even if I was pulling an all-nighter.</p>
<p>I still want to drink coffee, but I don&rsquo;t have any serious cravings. I&rsquo;m surprised by this, because everything I have read has indicated that the more caffeine you typically drink per day, the worse the withdrawal symptoms are. <a href="https://www.researchgate.net/publication/8266257_A_critical_review_of_caffeine_withdrawal_Empirical_validation_of_symptoms_and_signs_incidence_severity_and_associated_features">This</a> study does allow for genetic differences in the experience of withdrawal symptoms. I know my grandfather drank a similar amount of coffee as I do now with no obvious side effects. I don&rsquo;t know if he ever tried to give it up though.</p>
<p>According to the study, symptoms typically last for two to nine days &mdash; considering this, I doubt I&rsquo;ll be experiencing anything new between now and next month. But for good measure, I intend to continue my experiment for two more month as planned.</p>
<p>I&rsquo;ve made it this far. Here&rsquo;s hoping I make it to the end.</p>
]]></content:encoded></item><item><title>One Very Simple Way to Host a Website</title><link>https://rooiratel.red/posts/one-very-simple-way-to-host-a-website/</link><pubDate>Wed, 21 Apr 2021 18:33:46 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/one-very-simple-way-to-host-a-website/</guid><description>I generally enjoy tinkering, and I like to optimise things as much as I can. However, when it came to hosting this website, I found that this habit was actually holding me back. I spent forever deciding which tech stack to use and tried various combinations of things, but I never actually got around to publishing anything. Finally, I decided to just pick something that was simple but that still met all my needs.</description><content:encoded><![CDATA[<p>I generally enjoy tinkering, and I like to optimise things as much as I can. However, when it came to hosting this website, I found that this habit was actually holding me back. I spent forever deciding which tech stack to use and tried various combinations of things, but I never actually got around to publishing anything. Finally, I decided to just pick something that was simple but that still met all my needs.</p>
<h2 id="step-1--static-site-generator">Step 1 : Static Site Generator</h2>
<p>In the beginning, I was debating whether I should build a dynamic or static site. Since this is just a basic website that is mainly comprised of my blog, I realised that there would be no reason for me to have a dynamic site.</p>
<p>Okay &mdash; so there are many static site generators out there. I quickly settled on <a href="https://gohugo.io">Hugo</a>. I didn&rsquo;t benchmark it or anything, but I liked it&rsquo;s simplicity, syntax and speed. Moreover, I especially liked that it has a built-in mini-webserver that you can use to view a draft version of your website on your local machine. I converted the few posts I&rsquo;d written in markdown to a basic site and liked what it looked like.</p>
<h2 id="step-2--hosting-provider">Step 2 : Hosting Provider</h2>
<p>I don&rsquo;t really mind where my website is hosted. The important thing is that the provider is reliable, reasonably priced, and has an easy-to-use interface. I ended up using <a href="https://www.digitalocean.com/">DigitalOcean</a> &mdash; I was familiar with them from small projects in the past, and they offered really good prices for what I needed. Finally, they also met my deal-breaker requirement: supporting IPv6. See my other <a href="/posts/non-tech-reasons-for-ipv6/">post</a> about that.</p>
<h2 id="step-3--domain-name-registrar">Step 3 : Domain Name Registrar</h2>
<p>Nothing special here. I don&rsquo;t think one is particularly better than the other. I ended up using <a href="https://porkbun.com">Porkbun</a>, since they had the best prices for the <code>.tld</code> I wanted to use.</p>
<h2 id="step-4--web-server">Step 4 : Web Server</h2>
<p>I know Apache really well, and I can get around with nginx. But I&rsquo;m so glad I stumbled upon <a href="https://caddyserver.com/">Caddy</a>. It may not scale as well as something like nginx, but it is perfect for a small website. And it has two killer features:</p>
<ol>
<li>It has a <em>very</em> simple config file</li>
<li>It automatically obtains/renews ssl certs for you</li>
</ol>
<p>The first one is great and already had me convinced. However, the second one is just crazy! I am quite capable of setting up a bot to get certs from Let&rsquo;s Encrypt and later renew them. But not having to bother with that and simply letting my webserver do it for me feels futuristic, to say the least.</p>
<h2 id="step-5--web-log-analyser">Step 5 : Web Log Analyser</h2>
<p>I was strongly considering <a href="https://matomo.org/">Matomo</a>, as it&rsquo;s a nice open-source alternative to Google Analytics. Before settling though, I decided to look around and see what other options there were. I quite liked <a href="https://www.goatcounter.com/">GoatCounter</a> as well; but in the end, I settled on <a href="https://goaccess.io/">GoAccess</a> for two simple reasons: I can install it from a regular Linux package manager and didn&rsquo;t need to set up a database.</p>
<h2 id="step-6--putting-it-all-together">Step 6 : Putting It All Together</h2>
<h3 id="nameservers">Nameservers</h3>
<p>After buying your domain name, point the authoritative nameservers on your domain name registrar&rsquo;s website to DigitalOcean&rsquo;s nameservers: <code>ns1.digitalocean.com</code>, <code>ns2.digitalocean.com</code>, and <code>ns3.digitalocean.com</code>.</p>
<h3 id="create-a-digitalocean-droplet">Create a DigitalOcean droplet</h3>
<p>I selected the following options:</p>
<ul>
<li>Latest Fedora Linux distro</li>
<li>Basic plan</li>
<li>Regular Intel CPU with SSD</li>
<li>$5/month option</li>
<li>Datacenter location doesn&rsquo;t matter. Probably choose the one that&rsquo;s geographically located closest to you or your intended audience.</li>
<li>I ticked the IPv6 and Monitoring options (Both are free)</li>
<li>I selected ssh login instead of password login.</li>
</ul>
<p>Finally, I added my ssh key and assigned the droplet to my default project.</p>
<h3 id="dns-records">DNS Records</h3>
<p>Once the droplet was created, I went to the &ldquo;Domains&rdquo; setting for it and added the A, AAAA and NS records. See below:
<picture>
  
  

  

  
    

    <source srcset="/images/dns_records.avif" type="image/avif" >

    
    

    

  

  <figure>
    <img
      src="/images/dns_records.png"
      alt="DNS Records"
      loading="lazy"
      decoding="async"
      width="1212"
      height="866"
    />
	<figcaption></figcaption>
  </figure>
</picture>
</p>
<h3 id="server-setup">Server setup</h3>
<p>ssh into your server and do a quick <code>dnf update</code> to get the system up to date. Then install the packages below:</p>
<ul>
<li><code>goacess</code></li>
<li><code>caddy</code></li>
</ul>
<h4 id="caddy-setup">Caddy setup</h4>
<p>Create a Caddy file. You can store it anywhere, but typically it is located at <code>/etc/caddy/Caddyfile</code></p>
<p>Mine looks something like this:</p>
<pre tabindex="0"><code>www.example.com {
        redir https://example.com{uri}
}

example.com {
        root * /var/www/html
        encode zstd gzip
        file_server
        # 404 path below must be relative to the root dir difined below
        handle_errors {
            @404 {
                expression {http.error.status_code} == 404
            }
            handle @404 {
                rewrite * 404.html
                file_server
            }
        }

        header {
                Strict-Transport-Security &#34;max-age=31536000; includeSubDomains; preload&#34;
                X-Xss-Protection &#34;1; mode=block&#34;
                X-Content-Type-Options &#34;nosniff&#34;
                X-Frame-Options &#34;DENY&#34;
                Content-Security-Policy &#34;upgrade-insecure-requests&#34;
                Referrer-Policy &#34;strict-origin-when-cross-origin&#34;
                Cache-Control &#34;public, max-age=31557600, must-revalidate&#34;
        }

        log {
                output file /var/log/caddy_access.log {
                        # roll_disabled
                        roll_size     5000MiB
                        # roll_keep     &lt;num&gt;
                        # roll_keep_for &lt;days&gt;
                }
        }
}
</code></pre><p>The first section redirects the pointless www subdomain to the correct URL. The second section points to the root directory where your website content will be stored and enables compression. The handle_errors subsection redirects you to the 404.html page if there is an HTTP 404 response. In the header subsection, I enabled some security headers. Finally, in the log subsection, I told Caddy where to store its log file, and I set the log rotation settings.</p>
<p>Now, create a systemd service for running Caddy and enable it. Save it at <code>/etc/systemd/system/caddy.service</code>
Mine looks something like this:</p>
<pre tabindex="0"><code>[Unit]
Description=Caddy web server
Documentation=https://caddyserver.com/docs
After=network.target

[Service]
User=root
LimitNOFILE=8192
Environment=STNORESTART=yes
ExecStart=/usr/bin/caddy run -config /etc/caddy/Caddyfile
Restart=on-failure

[Install]
WantedBy=multi-user.target
</code></pre><h4 id="goaccess-setup">GoAccess setup</h4>
<p>Run the following command to generate a report from your Caddy logs : <code>goaccess /var/log/caddy_access.log -o /var/www/html/stats.html --log-format=CADDY --real-time-html --daemonize</code></p>
<p>If you browse to <code>https://example.com/stats.html</code>, you can read the nicely formatted report that GoAccess generated, detailing things like most visited pages, number of visitors, geolocation of visitors, TLS version etc.</p>
<p>You can also tweak these settings (log files, output file, log format etc. and much more) in the <code>goaccess.conf</code> file that is normally located at <code>/etc/goaccess/goacces.conf</code>, but I&rsquo;m happy with the default settings.</p>
<h3 id="actually-put-your-content-online">Actually put your content online</h3>
<p>Once you are happy with how your website is looking on your local machine (using Hugo to preview it), execute the <code>hugo</code> command, and it will generate the final HTML output in the <code>public</code> subdirectory.</p>
<p>Now, you can <code>rsync</code> the output onto your server. And just like that, your website is live!</p>
<p><code>rsync --progress -avzP -e &quot;ssh -i ~/.ssh/your_ssh_key&quot; /path/to/hugo/root/dir/public/ root@example.com:/var/www/html</code></p>
<h2 id="conclusion">Conclusion</h2>
<p>It was a long explanation, but I got this all up and running in, like, 20 minutes. It&rsquo;s really fast and simple. And I&rsquo;ll probably be using this setup for a long time thanks to the very low maintenance requirements.</p>
]]></content:encoded></item><item><title>Giving Up Caffeine : Part 1</title><link>https://rooiratel.red/posts/giving-up-caffeine-part-1/</link><pubDate>Wed, 07 Apr 2021 16:53:34 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/giving-up-caffeine-part-1/</guid><description>Since I was fourteen years old, possibly even before then, I have been drinking on average 8 to 16 cups of coffee a day. Roughly once every waking hour. This is mainly instant coffee, but I also drink “real” coffee whenever available. I am not a coffee snob — because I love it so much, I can’t possibly limit myself to only the “highest quality”. If it’s coffee I’ll drink it, and I will enjoy it.</description><content:encoded><![CDATA[<p>Since I was fourteen years old, possibly even before then, I have been drinking on average 8 to 16 cups of coffee a day. Roughly once every waking hour. This is mainly instant coffee, but I also drink &ldquo;real&rdquo; coffee whenever available. I am not a coffee snob &mdash; because I love it so much, I can&rsquo;t possibly limit myself to only the &ldquo;highest quality&rdquo;. If it&rsquo;s coffee I&rsquo;ll drink it, and I will enjoy it.</p>
<p>But 8 to 16 cups a day sounds like a lot. That can&rsquo;t be good for you, right? If you drink it with sugar, then yeah, that&rsquo;s pretty bad. But I don&rsquo;t drink coffee with sugar. Even so, when I was nineteen years old I started to wonder if I could actually be addicted to coffee&hellip;</p>
<p>So back then, as a mini experiment, I gave up coffee (and tea, which I don&rsquo;t drink often) for seven days. I didn&rsquo;t wean myself off slowly in preparation; I just stopped drinking it from the next day. And to my surprise, there were no withdrawal symptoms throughout the next week. I didn&rsquo;t even get headaches, which many people report to be an effect of giving up coffee. I concluded that I was not addicted &mdash; I just really liked coffee.</p>
<p>So I carried on drinking and never stopped.</p>
<p>Recently, however, I&rsquo;ve been wondering if maybe I didn&rsquo;t run the experiment for long enough. I still don&rsquo;t believe that I am addicted to coffee or to caffeine, but are there maybe some negative physiological effects it has that I won&rsquo;t notice unless I give it up over a longer period? So, starting from today, I am redoing my previous experiment. But this time, it will be over a period of three months. I plan to post an update every month to log any changes that I notice.</p>
<p>I&rsquo;ve had no coffee (nor any other kind of caffeine) today, and so far all is well. No headaches nor cravings&hellip; no improvements either. Let&rsquo;s see if this is still the case in thee months time.</p>
]]></content:encoded></item><item><title>2021 — Year of the Wayland</title><link>https://rooiratel.red/posts/2021-year-of-the-wayland/</link><pubDate>Wed, 24 Mar 2021 18:53:09 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/2021-year-of-the-wayland/</guid><description>Recently, I decided to replace the hard drive that was running my OS. It was getting old, and I don’t want to deal with boot issues if the drive starts failing. I decided that when my new hard drive was delivered, I would not just copy everything from the old one to the new one. It’s a chance for a fresh start — maybe I’ll try a new window manager, and I think it’s about time I switched to Wayland since the xorg devs have largely abandoned that project. I’ve also been hearing cool things about PipeWire, so why not give that a shot as well?</description><content:encoded><![CDATA[<p>Recently, I decided to replace the hard drive that was running my OS. It was getting old, and I don&rsquo;t want to deal with boot issues if the drive starts failing. I decided that when my new hard drive was delivered, I would not just copy everything from the old one to the new one. It&rsquo;s a chance for a fresh start &mdash; maybe I&rsquo;ll try a new window manager, and I think it&rsquo;s about time I switched to Wayland since the xorg devs have largely abandoned that project. I&rsquo;ve also been hearing cool things about PipeWire, so why not give that a shot as well?</p>
<p>So that&rsquo;s exactly what I did, and with some rather pleasant results, which led me to believe that 2021 really is the year of the Wayland desktop.</p>
<h1 id="history">History</h1>
<p>When I first heard about Wayland in about 2011, I really hoped that it would succeed, as I hated dealing with xorg.conf. Version 1.0 was released on 22 October 2012 and was met with many complaints that it couldn&rsquo;t perform basic tasks expected by users. It was also around this time that RebeccaBlackOS, a joke distro, became the first distro to support Wayland officially. [0][1] So Wayland was at least stable enough to be used as a meme but not yet for everyday use.</p>
<p>I waited a little bit longer.</p>
<p>At the end of 2016, Fedora 25 was released with official Wayland support. [2] So it was getting serious. However, I still saw a number of complaints on Hacker News and Reddit about things that sounded like deal-breakers to me.</p>
<p>I waited a little bit longer.</p>
<h1 id="2021">2021</h1>
<p>From 2016 onwards, I saw sporadic posts online by people who used Wayland everyday without any issues. My general impression was that unless you had very specific requirements, it should work for you.</p>
<p>At this point, I wanted to see for myself. I had a chuckle when, the day after I ordered my new hard drive, <a href="http://www.fosskers.ca/en/blog/wayland">this</a> blog post showed up on Hacker News and Reddit; the following day I found <a href="https://shibumi.dev/posts/wayland-in-2021/">this one</a>. It seems many people are switching to Wayland in 2021, which is why I am dubbing it the &ldquo;Year of the Wayland&rdquo;.</p>
<p>Not only that, but I see a lot of activity in the development world for supporting Wayland. Recently, one of the <a href="https://obsproject.com/">OBS Studio</a> devs got it working natively on Wayland.[3] That&rsquo;s great news for streamers. I also see that even XFCE is looking into adding Wayland support soon! [4]</p>
<h1 id="before-vs-after">Before vs After</h1>
<p>The biggest visual change to my setup would be my window manger. I was using <a href="https://github.com/baskerville/bspwm">BSPWM</a> before, but it didn&rsquo;t support Wayland. As far as I could tell, <a href="https://swaywm.org/">Sway</a> was the most mature tiling window manager. It works really well and I&rsquo;ve had zero issues with it so far.</p>
<p>As for <a href="https://pipewire.org/">PipeWire</a> vs PulseAudio, I am blown away by how well PipeWire is working considering how new it is. All I had to do was install the <code>pipewire</code> package and my sound worked out of the box. The only small snag was that some software <em>requires</em> PulseAudio (Firefox for example). But I just installed the <code>pipewire-pulse</code> package, and everything worked perfectly.</p>
<h1 id="software-that-required-some-tweaks">Software That Required Some Tweaks</h1>
<h3 id="browser">Browser</h3>
<p>I only use Firefox as my browser. To get native Wayland support for Firefox, all I had to do was set the following environment variable <code>MOZ_ENABLE_WAYLAND=1</code>. After restarting Firefox, you can confirm that your changes have been applied by going to the <code>about:support</code> page and checking that the value of &ldquo;Window Protocol&rdquo; is &ldquo;wayland&rdquo;.</p>
<p>Even while Firefox was still running through <code>xorg-xwayland</code> it was fast, and I didn&rsquo;t notice any weird behaviour.</p>
<h3 id="music">Music</h3>
<p>I previously used <a href="https://quodlibet.readthedocs.io/en/latest/">quodlibet</a> as my music player. However, for the last few months I&rsquo;ve been trying out <a href="https://tauonmusicbox.rocks/">Tauon Music Box</a>, which I prefer. It&rsquo;s made entirely in <a href="https://www.libsdl.org/">SDL</a>, meaning it also works natively on Wayland.</p>
<p>To get any SDL software to run natively on Wayland, it&rsquo;s as easy as setting the <code>SDL_VIDEODRIVER=wayland</code> environment variable.</p>
<h3 id="gaming">Gaming</h3>
<p>I enjoy gaming, but I would by no means call myself a serious gamer. I almost exclusively play games via Steam, and I thank Valve for all the investment they have put into the Linux ecosystem over the years. (If a studio only publishes their game on a platform that doesn&rsquo;t support Linux, then I guess they don&rsquo;t want my money.)</p>
<p>A lot of Linux games on Steam come bundled with SDL. Some of them make use of the SDL library that is part of the Steam Runtime, others use their own. To get them to work (without interfering with other SDL applications), just add <code>SDL_VIDEODRIVER=x11 %command%</code> to the launch options for the game. This worked on every game I tried.</p>
<p>I noticed that for CS:GO I was getting the same FPS as I was before switching to Wayland.</p>
<p>For DOTA2 (the Vulkan version) the game was getting capped at 60FPS, even with V-sync turned off. There are workarounds for this. I&rsquo;m personally not bothered by it, but if you are, you can read a detailed explanation <a href="https://www.reddit.com/r/linux_gaming/comments/1upn39/sdl2_adds_dynamic_api_magic_to_allow_updating_it/">here</a>. Either way, I&rsquo;m sure valve will update the SDL lib bundled with DOTA2 in the future.</p>
<h1 id="thoughts-so-far">Thoughts So Far</h1>
<p>Wayland works so well I don&rsquo;t even notice it. Most of the software I used before functions fine on Wayland (or via <code>xorg-xwayland</code>); for the software that doesn&rsquo;t work, there are replacements. [7] There are still a few programs that need to run through <code>xorg-xwayland</code>, but it doesn&rsquo;t really make a significant difference.</p>
<p>I can safely say that 2021 is the &ldquo;Year of the Wayland&rdquo; since, for most common use cases, you can use it everyday without a single complaint. As for the remaining edge cases there are plenty of developers who are devoting a lot of their time to addressing those concerns.</p>
<h1 id="references">References</h1>
<pre><code>[0] https://www.ubuntuvibes.com/2012/02/live-os-running-wayland-display-server.html
[1] https://www.phoronix.com/scan.php?page=news_item&amp;px=Wayland-RBOS-2020-Release
[2] https://fossbytes.com/new-features-fedora-25-linux-releasing-november-15/
[3] https://feaneron.com/2021/03/30/obs-studio-on-wayland/
[4] https://wiki.xfce.org/releng/wayland_roadmap
[5] https://www.theregister.com/2020/10/30/x_server_lead_maintainer_declares/
[6] https://www.phoronix.com/scan.php?page=news_item&amp;px=XServer-Abandonware
[7] https://arewewaylandyet.com/
</code></pre>
]]></content:encoded></item><item><title>Convert All Word Documents to .odt</title><link>https://rooiratel.red/posts/convert-all-word-docs-to-odt/</link><pubDate>Sun, 20 Sep 2020 09:38:46 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/convert-all-word-docs-to-odt/</guid><description>This post is not about a quick one-liner script that you can run to convert all Word documents on your PC to .odt files. But if that’s what you are looking for, here you go:
find ./ -type f \( -iname \*.doc -o -iname \*.docx \) -exec libreoffice --headless --convert-to odt {} \;
Just replace the ./ with the directory you want to recursively search in. Also note that this command creates a copy that is converted and does not delete the original document.</description><content:encoded><![CDATA[<p>This post is <strong>not</strong> about a quick one-liner script that you can run to convert all Word documents on your PC to .odt files. But if that&rsquo;s what you are looking for, here you go:</p>
<p><code>find ./ -type f \( -iname \*.doc -o -iname \*.docx \) -exec libreoffice --headless --convert-to odt {} \;</code></p>
<p>Just replace the ./ with the directory you want to recursively search in. Also note that this command creates a copy that is converted and does not delete the original document.</p>
<p>I have dozens of old Word documents on my computer dating back to my childhood days. I finally decided to do a bit of a cleanup and convert them all to .odt so that they are in an open file format that I can trust.</p>
<p>And instead of converting them all in one go using the script above, I decided to do them one by one, and see how well it worked, and to make sure I didn&rsquo;t lose anything.</p>
<p>I started of just seeing how many I had:</p>
<p><code>find ./ -type f \( -iname \*.doc -o -iname \*.docx \) | wc -l</code></p>
<p>Which came to 1996. damn, way more than I thought. Looking through the results (without piping it to wc) I see there are a lot of old school assignments and notes, some programming notes, a lot of music (mainly chord sheets), and finally just some miscellaneous documents.</p>
<p>Most of the documents I no longer needed (like schoolwork) but I converted a lot of them anyway just to see how well it would work. I ended up deleting most of these documents.</p>
<h3 id="what-i-learned">What I learned</h3>
<p>Practically all of the word documents I had were just simple text documents and the occasional image. I had zero problems converting these.</p>
<p>A lot of my school assignments made use of math formulas and tables, and I&rsquo;d say about 99% of them converted without any issue. Not that it mattered because I deleted all my school work afterwards.</p>
<p>What I found interesting after converting a whole bunch of files was that for small files (less than ~20KB) the .odt version was larger than the .docx version. But if the original file was any larger than that, then the file actually got smaller after converting to .odt.</p>
]]></content:encoded></item><item><title>exFAT</title><link>https://rooiratel.red/posts/exfat/</link><pubDate>Sun, 14 Jun 2020 10:59:12 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/exfat/</guid><description>Now that Linux 5.7 has been released containing the new Samsung implementation of their exFAT driver, it is time to format all my removable storage media to exFAT.[0]
Why? Previously, I would always format my external hard drives and memory sticks as NTFS even though I only use Linux. This was because the default FAT32 file system does not support files larger than 4GB (and NTFS does), and also, if I need to share files with people who use Windows or Mac, they can read the NTFS file system. Windows natively, and Linux and Mac via ntfs-3g.[1] This worked OK, but it was annoying having to use a FUSE-based solution that is quite slow.</description><content:encoded><![CDATA[<p>Now that Linux 5.7 has been released containing the new Samsung implementation of their exFAT driver, it is time to format all my removable storage media to exFAT.[0]</p>
<h1 id="why">Why?</h1>
<p>Previously, I would always format my external hard drives and memory sticks as NTFS even though I only use Linux. This was because the default FAT32 file system does not support files larger than 4GB (and NTFS does), and also, if I need to share files with people who use Windows or Mac, they can read the NTFS file system. Windows natively, and Linux and Mac via ntfs-3g.[1] This worked OK, but it was annoying having to use a FUSE-based solution that is quite slow.</p>
<h1 id="how">How?</h1>
<p>Start by installing exfatprogs so that you have what you need to format to exFAT.[2]</p>
<p>On Arch Linux, that&rsquo;s just:</p>
<p><code>sudo pacman -S exfatprogs</code></p>
<p>Next, you need to get a list of disks on your system so that you know which one to format. Personally, I like to list them all, then plug in my intended target, then list again. That way, you know for sure which disk is the removable one - even if it was otherwise obvious. I never take any risks when it comes to formatting drives with data on them.</p>
<p><code>fdisk -l</code></p>
<p>Now that you know which device to use, run the command below. Set your own label and specify the correct drive.</p>
<p><code>sudo mkfs.exfat -n LABEL /dev/sdX</code></p>
<p>Finally, run a check to make sure everything went smoothly.</p>
<p><code>sudo fsck.exfat /dev/sdXn</code></p>
<p>Now, I can use my removable storage devices on any OS and with native kernel drivers!</p>
<h1 id="references">References</h1>
<pre tabindex="0"><code>[0] https://kernelnewbies.org/Linux_5.7#New_exFAT_file_system
[1] https://www.tuxera.com/company/open-source/
[2] https://github.com/exfatprogs/exfatprogs
</code></pre>]]></content:encoded></item><item><title>How to draw a circle in GIMP</title><link>https://rooiratel.red/posts/how-to-make-a-circle-in-gimp/</link><pubDate>Sat, 09 May 2020 11:10:17 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/how-to-make-a-circle-in-gimp/</guid><description>If you’ve ever seen a discussion comparing GIMP with photoshop, invariably someone will mention how it is impossible to draw a simple circle in GIMP. Which is inevitably followed by someone showing some crazy workflow that eventually gets the job done. But actually there is an easy way to draw a circle in GIMP, and it’s been there since the earliest versions of GIMP. I’m getting tired of explaining it each time, so that is why I am writing this blog post, so that I can just share the link from now on.</description><content:encoded><![CDATA[<p>If you&rsquo;ve ever seen a discussion comparing GIMP with photoshop, invariably someone will mention how it is impossible to draw a simple circle in GIMP. Which is inevitably followed by someone showing some crazy workflow that eventually gets the job done.
But actually there is an easy way to draw a circle in GIMP, and it&rsquo;s been there since the earliest versions of GIMP. I&rsquo;m getting tired of explaining it each time, so that is why I am writing this blog post, so that I can just share the link from now on.</p>
<p>Behold gfig:</p>
<p><video controls width="860em" src="/videos/draw-circle-in-gimp.webm"></video></p>
]]></content:encoded></item><item><title>Non-Technical Reasons for Ipv6</title><link>https://rooiratel.red/posts/non-tech-reasons-for-ipv6/</link><pubDate>Mon, 27 May 2019 21:04:59 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/non-tech-reasons-for-ipv6/</guid><description>There are many technical reasons for adopting IPv6. But what about the non-technical reasons?
When I see an ISP, hosting provider, or website that supports IPv6 I think: These guys know what they are doing, they care about quality, and they actually plan for the future.
I’d much rather do business with someone that supports IPv6 because of the above impression.
If I was running my own business that provided network related products or services I’d make IPv6 support required because I don’t want to seem like I’m incompetent/lazy/ignorant.</description><content:encoded><![CDATA[<p>There are many technical reasons for adopting IPv6. But what about the non-technical reasons?</p>
<p>When I see an ISP, hosting provider, or website that supports IPv6 I think: These guys know what they are doing, they care about quality, and they actually plan for the future.</p>
<p>I&rsquo;d much rather do business with someone that supports IPv6 because of the above impression.</p>
<p>If I was running my own business that provided network related products or services I&rsquo;d make IPv6 support required because I don&rsquo;t want to seem like I&rsquo;m incompetent/lazy/ignorant.</p>
<p>In fact, there are many good hosting providers I immediately skipped over when choosing one for this site because they don&rsquo;t support IPv6. So not adopting IPv6 has cost real businesses real money. And yes, I know I&rsquo;m not in the majority. Most people don&rsquo;t care about IPv6, or even know what it is. But those people take advice and recommendations from the people who do.</p>
<p>So why not build a good reputation now, and be ready for widespread IPv6 usage long before you need to? It already gives you an edge over your competition.</p>
]]></content:encoded></item><item><title>Secure disk wipe</title><link>https://rooiratel.red/posts/secure-disk-wipe/</link><pubDate>Wed, 31 Oct 2018 16:22:03 +0200</pubDate><guid isPermaLink="true">https://rooiratel.red/posts/secure-disk-wipe/</guid><description>Secure disk wipe I recently got a new work laptop. Obviously I needed to transfer all my files from the old laptop to the new one. This is a pretty painless process. Normally I just format the disk on the old laptop when I’m done with it and hand it in.
However there are a lot of confidential files and data on my work laptop, and a simple format is not enough to get rid of them. It’s quite easy to recover files from a laptop that have not been deleted securely, and I didn’t want to be held liable if someone were to get hold of the files from my old laptop. I have no guarantees of what the person I hand my laptop to might do with it. It could get stolen, they might be bribed to hand over the hard drive to criminals etc.</description><content:encoded><![CDATA[<h1 id="secure-disk-wipe">Secure disk wipe</h1>
<p>I recently got a new work laptop. Obviously I needed to transfer all my files from the old laptop to the new one. This is a pretty painless process. Normally I just format the disk on the old laptop when I&rsquo;m done with it and hand it in.</p>
<p>However there are a lot of confidential files and data on my work laptop, and a simple format is not enough to get rid of them. It&rsquo;s quite easy to recover files from a laptop that have not been deleted securely, and I didn&rsquo;t want to be held liable if someone were to get hold of the files from my old laptop. I have no guarantees of what the person I hand my laptop to might do with it. It could get stolen, they might be bribed to hand over the hard drive to criminals etc.</p>
<p>So what should I do? Luckily Linux has a useful program called <code>shred</code> which will overwrite a file with garbage multiple times before it deletes it. This is a great solution, but it&rsquo;s rather tedious to run <code>shred</code> manually on multiple files on my hardrive.</p>
<p>My final solution was to use a combination of <code>find</code> and <code>shred</code> to recursively delete all the files and directories from a given directory. In this case, my <code>/home/</code> directory.</p>
<p>Here is the command:</p>
<p><code>find /home/rooiratel/ -type f -exec shred -u -v {} \;</code></p>
<p>Where <code>/home/rooiratel/</code> is the root directory of where you want to start deleting from.</p>
<p>Another useful task this does is to rename each file to a series of 0&rsquo;s before deleting it. I still need to figure out how to do this for directories.</p>
<p>Here is a screenshot of this command in action:</p>
<p><picture>
  
  

  

  
    

    <source srcset="/images/find_shred.avif" type="image/avif" >

    
    

    

  

  <figure>
    <img
      src="/images/find_shred.png"
      alt="screenshot"
      loading="lazy"
      decoding="async"
      width="485"
      height="981"
    />
	<figcaption></figcaption>
  </figure>
</picture>
</p>
<p>You can set the number of times you want <code>shred</code> to overwrite your files with the -n flag. The default is 3, but depending on how paranoid you are or how much time you have, you can set it as high as you like.</p>
<p>Once all of this is done you can format your hard drive as usual and hand in the device. Even if it gets stolen, or handed to a compromised employee, you won&rsquo;t have to worry that you have inadvertently leaked confidential company files/data.</p>
]]></content:encoded></item></channel></rss>