<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[This and that]]></title><description><![CDATA[Just a blog.]]></description><link>https://martinvanbeurden.nl/blog/</link><image><url>https://martinvanbeurden.nl/blog/favicon.png</url><title>This and that</title><link>https://martinvanbeurden.nl/blog/</link></image><generator>Ghost 4.48</generator><lastBuildDate>Fri, 17 Apr 2026 13:10:56 GMT</lastBuildDate><atom:link href="https://martinvanbeurden.nl/blog/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[From ColorNote to Joplin: A PowerShell Script to Export My Notes]]></title><description><![CDATA[<p>I&apos;ve used the ColorNote app on Android for many years, but I recently decided it was time to move to another notes app. I quickly hit a wall: there was no easy way to move all my notes. I could share them one by one and copy them</p>]]></description><link>https://martinvanbeurden.nl/blog/from-colornote-to-joplin-a-powershell-script-to-export-my-notes/</link><guid isPermaLink="false">68e2820347a5a200011d24e2</guid><category><![CDATA[Powershell]]></category><category><![CDATA[Android]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sun, 05 Oct 2025 15:17:00 GMT</pubDate><content:encoded><![CDATA[<p>I&apos;ve used the ColorNote app on Android for many years, but I recently decided it was time to move to another notes app. I quickly hit a wall: there was no easy way to move all my notes. I could share them one by one and copy them over, but with hundreds of notes, that wasn&apos;t a realistic option.</p><p>I searched online and found a <a href="https://github.com/olejorgenb/ColorNote-backup-decryptor">Java tool</a> that could decrypt the ColorNote backup file. However, I didn&apos;t want to install Java just for this one task, and I saw that people were complaining about having to manually clean up the output afterwards.</p><p>So, I decided to rewrite it as a PowerShell script. With a little help from the Gemini code assistant, and after many iterations, I created a script that worked perfectly for my needs.</p><p>The script decrypts the backup and can export all your notes into a clean JSON file and, optionally and more usefully, a Joplin Export (JEX) file. As a bonus, I found it even correctly imported notes that were still in my ColorNote trashcan into the Joplin trashcan. Many other Note apps can import JEX files as well.</p><h3 id="how-to-use-it">How to Use It</h3><p>First, get a backup file of your notes from ColorNote. Go to Settings -&gt; Backup and tap on the latest backup there, select Send and send it to disk or send it to yourself with one of the other apps, whatever you prefer.</p><p>Then clone the repository from GitHub to get the script:</p><pre><code class="language-bash">git clone https://github.com/chadoe/Decrypt-ColorNoteBackup.git
</code></pre><p>Then, open a PowerShell 7 terminal, navigate into the directory, and run the script. The script will prompt you for your password (if you don&apos;t have one, just press Enter).</p><p>Here is the example command:</p><pre><code class="language-powershell">.\Decrypt-ColorNoteBackup.ps1 -InputFile .\my_backup.db -OutputFile .\decrypted_notes.json -JexOutputFile .\colornote_export.jex
</code></pre><p>Then simply import the JEX file in Joplin or any other Notes app that supports importing JEX files. Or alternatively process the JSON output file that contains all notes further into another format.</p><p>If you&apos;re in the same boat, hopefully, it can save you some time.</p><p><strong>Get the script on GitHub: <a href="https://github.com/chadoe/Decrypt-ColorNoteBackup">https://github.com/chadoe/Decrypt-ColorNoteBackup</a></strong></p>]]></content:encoded></item><item><title><![CDATA[Chassis Intruded! Fatal Error … System halted]]></title><description><![CDATA[<p>If you&apos;re randomly and repeatedly getting a BIOS error when booting an aging PC saying </p><blockquote>Chassis Intruded! Fatal Error &#x2026; System halted </blockquote><p>but you never set it up for chassis intrusion dectection, just replace the (usually) CR2032 cmos battery on the mainboard. Big chance it is close to</p>]]></description><link>https://martinvanbeurden.nl/blog/chassis-intruded-fatal-error-system-halted/</link><guid isPermaLink="false">5fe5cdd2e8415700010c116f</guid><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Fri, 25 Dec 2020 22:54:00 GMT</pubDate><content:encoded><![CDATA[<p>If you&apos;re randomly and repeatedly getting a BIOS error when booting an aging PC saying </p><blockquote>Chassis Intruded! Fatal Error &#x2026; System halted </blockquote><p>but you never set it up for chassis intrusion dectection, just replace the (usually) CR2032 cmos battery on the mainboard. Big chance it is close to being completely drained and causing this error.</p>]]></content:encoded></item><item><title><![CDATA[Using FFmpeg as a custom converter in foobar2000]]></title><description><![CDATA[<p>foobar2000 has quite a few converters available by default but FFmpeg is not one of them. If you want to use FFmpeg as a converter you can add a new output format preset. To get there just right click on any song in foobar2000, Convert and choose the three dots.</p>]]></description><link>https://martinvanbeurden.nl/blog/using-ffmpeg-as-a-custom-converter-in-foobar2000/</link><guid isPermaLink="false">5f7a013b56e5ac0001999efd</guid><category><![CDATA[Windows]]></category><category><![CDATA[How-to]]></category><category><![CDATA[foobar2000]]></category><category><![CDATA[FFmpeg]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sun, 04 Oct 2020 17:30:43 GMT</pubDate><content:encoded><![CDATA[<p>foobar2000 has quite a few converters available by default but FFmpeg is not one of them. If you want to use FFmpeg as a converter you can add a new output format preset. To get there just right click on any song in foobar2000, Convert and choose the three dots.</p><p>In this example the converter will use FFmpeg to convert to AAC with the FDK encoder set to variable bitrate mode 5 (best quality).</p><!--kg-card-begin: markdown--><p>Set Encoder to Custom, Encoder file to ffmpeg.exe (posibly with complete path to the executable), extension to whatever extension you want the output files(s) to have and set parameters to <code>-i pipe:0 -y -c:a libfdk_aac -vbr 5 %d</code> where <code>-c:a libfdk_aac -vbr 5</code> depends on what codec and settings for that codec you want to use.</p>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card"><img src="https://martinvanbeurden.nl/blog/content/images/2020/10/foobar2000-convert-ffmpeg-settings.png" class="kg-image" alt loading="lazy"></figure><!--kg-card-begin: markdown--><p>The <code>-i pipe:0</code> part of the parameters tells FFmpeg to use stdin as input, which is where foobar pipes it output to.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Bitlocker autounlock error 0x80070017]]></title><description><![CDATA[<p>So I recently cloned my windows system to a bigger ssd, reenabled bitlocker then tried to enable autounlock on a second data drive but it gave me the following error</p><blockquote>ERROR: An error occurred (code 0x80070017):<br>Data error (cyclic redundancy check).</blockquote><p>Must be something wrong with the drive right? Chkdsk.</p>]]></description><link>https://martinvanbeurden.nl/blog/bitlocker-autounlock-error-0x80070017/</link><guid isPermaLink="false">5cb2f1545245df0001fdb50b</guid><category><![CDATA[Windows]]></category><category><![CDATA[Bitlocker]]></category><category><![CDATA[How-to]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sun, 14 Apr 2019 09:31:40 GMT</pubDate><content:encoded><![CDATA[<p>So I recently cloned my windows system to a bigger ssd, reenabled bitlocker then tried to enable autounlock on a second data drive but it gave me the following error</p><blockquote>ERROR: An error occurred (code 0x80070017):<br>Data error (cyclic redundancy check).</blockquote><p>Must be something wrong with the drive right? Chkdsk... nope the drive is fine. </p><p>Turns out you need to remove the existing autounlock keys first that migrated from the previous system drive but are no longer valid for the newly bitlockered system. So open an adminitrative powershell or command prompt and run</p><blockquote>manage-bde -autounlock -clearallkeys C:</blockquote><p>Optionally remove all the old external key(s) from the data drive</p><blockquote>manage-bde -protectors -delete -type externalkey F:</blockquote><p>F: being the data drive. Or remove specific external keys by listing them first</p><blockquote>manage-bde -protectors -get -type externalkey F:</blockquote><p>Then deleting the ones you don&apos;t need anymore by it&apos;s id value</p><blockquote>manage-bde -protectors -delete -id &quot;{DBB1A11E-9F5C-41B8-BD79-8A60E27F6369}&quot; F:</blockquote><p>After that you can enable auto unlock on the data drive without error.</p>]]></content:encoded></item><item><title><![CDATA[Getting a file hash in powershell]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>To get the MD5 hash of a file run the following command in powershell:</p>
<pre><code>get-filehash -algorithm md5 &lt;filename&gt;
</code></pre>
<p>Similarly, to get the SHA1 hash run:</p>
<pre><code>get-filehash -algorithm sha1 &lt;filename&gt;
</code></pre>
<p>If you just need the hash value output:</p>
<pre><code>(get-filehash -algorithm md5 &lt;filename&gt;).Hash
</code></pre>
<!--kg-card-end: markdown-->]]></description><link>https://martinvanbeurden.nl/blog/getting-a-file-hash-in-powershell/</link><guid isPermaLink="false">598c26a393078100014edf09</guid><category><![CDATA[Windows]]></category><category><![CDATA[Powershell]]></category><category><![CDATA[Hash]]></category><category><![CDATA[MD5]]></category><category><![CDATA[SHA1]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sat, 26 Mar 2016 22:35:32 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>To get the MD5 hash of a file run the following command in powershell:</p>
<pre><code>get-filehash -algorithm md5 &lt;filename&gt;
</code></pre>
<p>Similarly, to get the SHA1 hash run:</p>
<pre><code>get-filehash -algorithm sha1 &lt;filename&gt;
</code></pre>
<p>If you just need the hash value output:</p>
<pre><code>(get-filehash -algorithm md5 &lt;filename&gt;).Hash
</code></pre>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Parsing docker (1.8) volume info]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>Volume inspect information was changed in Docker version 1.8 from a &quot;Volumes&quot; list to a new &quot;Mounts&quot; array. See my <a href="https://martinvanbeurden.nl/blog/parsing-docker-volume-info/">previous volume parsing post</a> for parsing on Docker &lt;=1.7</p>
<h3 id="gettingalistofvolumepaths">Getting a list of volume paths</h3>
<p>The <code>Mounts</code> section, if you do <code>docker inspect</code></p>]]></description><link>https://martinvanbeurden.nl/blog/parsing-docker-1-8-volume-info/</link><guid isPermaLink="false">598c26a393078100014edf08</guid><category><![CDATA[Linux]]></category><category><![CDATA[Docker]]></category><category><![CDATA[Bash]]></category><category><![CDATA[Golang]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Mon, 24 Aug 2015 22:11:46 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>Volume inspect information was changed in Docker version 1.8 from a &quot;Volumes&quot; list to a new &quot;Mounts&quot; array. See my <a href="https://martinvanbeurden.nl/blog/parsing-docker-volume-info/">previous volume parsing post</a> for parsing on Docker &lt;=1.7</p>
<h3 id="gettingalistofvolumepaths">Getting a list of volume paths</h3>
<p>The <code>Mounts</code> section, if you do <code>docker inspect &lt;container name or id&gt;</code>, is structured like this:</p>
<pre><code>    &quot;Mounts&quot;: [
        {
            &quot;Name&quot;: &quot;e6c202f832b24e488cedfd0e134db439496c245a4d28f8d6345bb18f55aa61b4&quot;,
            &quot;Source&quot;: &quot;/var/lib/docker/volumes/e6c202f832b24e488cedfd0e134db439496c245a4d28f8d6345bb18f55aa61b4/_data&quot;,
            &quot;Destination&quot;: &quot;/dirinmycontainer&quot;,
            &quot;Driver&quot;: &quot;local&quot;,
            &quot;Mode&quot;: &quot;&quot;,
            &quot;RW&quot;: true
        }
    ],
</code></pre>
<p>To list all volumes and associated container paths for a docker (1.8.x) container, using go templating:</p>
<pre><code>docker inspect --format=&apos;{{range $mount := .Mounts}}{{$mount.Source}} -&gt; {{$mount.Destination}}{{&quot;\n&quot;}}{{end}}&apos; &lt;container name or id&gt;
</code></pre>
<p>which will return</p>
<pre><code>/var/lib/docker/volumes/e6c202f832b24e488cedfd0e134db439496c245a4d28f8d6345bb18f55aa61b4/_data -&gt; /dirinmycontainer</code></pre>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[VirtualBox numlock weirdness]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>After upgrading to VirtualBox 5 on Windows every time I started, focused or unfocused a virtual machine my numlock status would toggle. If you&apos;re having the same problem here is how to fix it:</p>
<pre><code>&gt; VBoxManage setextradata &quot;&lt;machine-name&gt;&quot; GUI/HidLedsSync &quot;0&quot;
</code></pre>
<p>This</p>]]></description><link>https://martinvanbeurden.nl/blog/virtualbox-numlock-weirdness/</link><guid isPermaLink="false">598c26a393078100014edf07</guid><category><![CDATA[Windows]]></category><category><![CDATA[VirtualBox]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sun, 26 Jul 2015 19:32:05 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>After upgrading to VirtualBox 5 on Windows every time I started, focused or unfocused a virtual machine my numlock status would toggle. If you&apos;re having the same problem here is how to fix it:</p>
<pre><code>&gt; VBoxManage setextradata &quot;&lt;machine-name&gt;&quot; GUI/HidLedsSync &quot;0&quot;
</code></pre>
<p>This will disable keyboard indicators (HID LEDs) synchronization. This setting it supposed to be disabled by default but for some reason it was not on my installation.<br>
VBoxManage is located where you installed virtualbox, usually <code>C:\Program Files\Oracle\VirtualBox</code>.</p>
<p>If you have a lot of virtual machines you can process them all by running the following commands:</p>
<ol>
<li>
<p>Open a command prompt</p>
</li>
<li>
<p>Add virtualbox to you path:</p>
<pre><code> &gt; set path=%path%;C:\Program Files\Oracle\VirtualBox
</code></pre>
</li>
<li>
<p>Go to the directory where you&apos;re virtual machines are located, commands below are for a default install:</p>
<pre><code> &gt; %HOMEDRIVE%
 &gt; cd &quot;%HOMEPATH%\VirtualBox VMs&quot;
</code></pre>
</li>
<li>
<p>Update the setting for all machines in the directory</p>
<pre><code> &gt; for /f &quot;tokens=*&quot; %G in (&apos;dir /b /a:d &quot;.\*&quot;&apos;) do (VBoxManage setextradata &quot;%G&quot; GUI/HidLedsSync &quot;0&quot;)
</code></pre>
</li>
</ol>
<p>Hooray, no more numlock weirdness.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Waiting for Docker containers]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>Ever tried to spin up two Docker containers, one depending on the other, only to find out the port(s) of the first container aren&apos;t actually up and running yet causing the second container to fail to start up?</p>
<h3 id="waitwait">Wait wait</h3>
<p>For a while I stuck some sleep</p>]]></description><link>https://martinvanbeurden.nl/blog/waiting-for-docker-containers/</link><guid isPermaLink="false">598c26a393078100014edf06</guid><category><![CDATA[Linux]]></category><category><![CDATA[Docker]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sun, 24 May 2015 19:07:25 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>Ever tried to spin up two Docker containers, one depending on the other, only to find out the port(s) of the first container aren&apos;t actually up and running yet causing the second container to fail to start up?</p>
<h3 id="waitwait">Wait wait</h3>
<p>For a while I stuck some sleep x statements in there to delay the second container but this was of course... a very flaky solution.</p>
<p>The solution is another docker container with the sole purpose of waiting for the port(s) of the first container to become available. Once the wait container has successfully exited the second container can safely be started.</p>
<p>Simple test bash script:</p>
<pre><code class="language-shell">#! /bin/bash

#start a database container
docker run -d --name database -e MYSQL_ROOT_PASSWORD=my-secret-pw mysql

#wait for the mysql port to become available
if docker run --link database:database --rm martin/wait ; then
  echo &quot;yay :) we can now start a container that uses the database&quot;
else
  echo &quot;oh no :( database is unavailable&quot;
fi

#just cleaning up
docker rm -f database
</code></pre>
<p>The wait container by default checks all <code>exposed</code> ports in the linked container. You can limit which ports or even check entirely different URLs. See <a href="https://github.com/chadoe/docker-wait">the github page</a> for more details. If you need to check ports in multiple containers link them all in the wait command.</p>
<p>The same concept can be used in systemd by adding the wait command in ExecStartPre</p>
<pre><code>ExecStartPre=/usr/bin/docker run --link database:database --rm martin/wait
ExecStart=/usr/bin/docker run --rm app-that-uses-database
</code></pre>
<p><a href="https://github.com/chadoe/docker-wait">View on Github</a> or <a href="https://registry.hub.docker.com/u/martin/wait/">View on Docker registry</a></p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Recurring task with systemd]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>I know, I know, cron is much easier but I was playing around with systemd and timers were one of the things that weren&apos;t very clear to me. So this is what I finally ended up with to run several backup tasks every sunday with systemd.</p>
<h3 id="writeunitfiles">Write unit-files</h3>]]></description><link>https://martinvanbeurden.nl/blog/recurring-task-with-systemd/</link><guid isPermaLink="false">598c26a393078100014edf05</guid><category><![CDATA[Linux]]></category><category><![CDATA[Ubuntu]]></category><category><![CDATA[Systemd]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sat, 16 May 2015 10:01:00 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>I know, I know, cron is much easier but I was playing around with systemd and timers were one of the things that weren&apos;t very clear to me. So this is what I finally ended up with to run several backup tasks every sunday with systemd.</p>
<h3 id="writeunitfiles">Write unit-files</h3>
<p>To create a recurring task in systemd the following unit-files are needed. A timer file which will trigger a target file at set times which in turn will trigger one or more service files. On ubuntu the files should be created in /lib/systemd/system.</p>
<ol>
<li>
<p>weekly-backup.timer</p>
<pre><code> [Unit]
 Description=Weekly backup timer  
 [Timer]
 OnCalendar=Sun *-*-* 14:00:00
 [Persistant=true](http://www.freedesktop.org/software/systemd/man/systemd.timer.html#Persistent=)=true
 Unit=weekly-backup.target  
 [Install]
 WantedBy=default.target
</code></pre>
</li>
</ol>
<p><code>WantedBy=default.target</code> will make sure the timer is enabled when the system starts.<br>
<code>Unit</code> defines the unit that will be triggered when the timer is activated.<br>
<code>Persistant=true</code> makes sure the target is triggered if the system happened to be shut down when the timer should have triggered. (See <a href="http://www.freedesktop.org/software/systemd/man/systemd.timer.html#Persistent=">Persistant</a>)<br>
<code>OnCalendar</code> defines the time(s) this timer file should trigger the target unit. I this case it will trigger on Sunday on any date at 14:00. (See <a href="http://www.freedesktop.org/software/systemd/man/systemd.time.html">systemd.time</a>)</p>
<ol start="2">
<li>
<p>weekly-backup.target<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup></p>
<pre><code> [Unit]
 Description=Weekly backup
 StopWhenUnneeded=yes
</code></pre>
</li>
</ol>
<p><code>StopWhenUnneeded=yes</code> will make sure the target is set to inactive when it&apos;s finished and the timer will be able to trigger it again the next time the timer activates.</p>
<ol start="3">
<li>
<p>backup-app.service<br>
First service.</p>
<pre><code> [Unit]
 Description=Backup app  
 [Service]
 ExecStart=/usr/local/bin/backupapp  
 [Install]
 WantedBy=weekly-backup.target
</code></pre>
</li>
</ol>
<p><code>WantedBy=weekly-backup.target</code> will make sure this service will start when weekly-backup.target is triggered by the timer.<br>
<code>ExecStart</code> defines the script or program that should be run.</p>
<ol start="4">
<li>
<p>backup-data.service<br>
Second service, all services having WantedBy=weekly-backup.target will be triggered.</p>
<pre><code> [Unit]
 Description=Backup data  
 [Service]
 ExecStart=/usr/local/bin/backupdata  
 [Install]
 WantedBy=weekly-backup.target
</code></pre>
</li>
</ol>
<h3 id="enableunits">Enable units</h3>
<ol>
<li>
<p>Enable the services<br>
<code>systemctl enable backup-app.service</code><br>
<code>systemctl enable backup-data.service</code></p>
</li>
<li>
<p>Enable and start the timer<br>
<code>systemctl enable weekly-backup.timer</code><br>
<code>systemctl start weekly-backup.timer</code></p>
</li>
</ol>
<p>That&apos;s it.</p>
<p>Notes:</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>You can skip the targetfile and set Unit=backup-app.service directly in the timer file if backup-app.service is the only service you want to run on the timer. In this case you should also remove the install section from the service file. <a href="#fnref1" class="footnote-backref">&#x21A9;&#xFE0E;</a></p>
</li>
</ol>
</section>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Cleaning up Docker volumes using Docker]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>A couple of months ago I wrote a <a href="https://martinvanbeurden.nl/blog/cleaning-up-after-docker/">script to delete orphaned Docker volumes</a>. Several people have helped on <a href="https://github.com/chadoe/docker-cleanup-volumes">Github</a> to improve the script since. I also added a Docker file so you can cleanup Docker volumes using... Docker. I&apos;m not entirely convinced it&apos;s easier than</p>]]></description><link>https://martinvanbeurden.nl/blog/cleaning-up-docker-volumes-from-docker/</link><guid isPermaLink="false">598c26a393078100014edf04</guid><category><![CDATA[Volumes]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sun, 12 Apr 2015 09:39:10 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>A couple of months ago I wrote a <a href="https://martinvanbeurden.nl/blog/cleaning-up-after-docker/">script to delete orphaned Docker volumes</a>. Several people have helped on <a href="https://github.com/chadoe/docker-cleanup-volumes">Github</a> to improve the script since. I also added a Docker file so you can cleanup Docker volumes using... Docker. I&apos;m not entirely convinced it&apos;s easier than downloading the script and running that but hey, you can choose.</p>
<h3 id="runcleanupusingdocker">Run cleanup using Docker</h3>
<p>Run using the latest Docker client version. Use the &#x2013;-dry-run option to have the script print the volumes that would have been deleted without actually deleting them:</p>
<pre><code>docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes --dry-run
</code></pre>
<p>or run a specific Docker client version, e.g. 1.4.1</p>
<pre><code>docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes:1.4.1 --dry-run
</code></pre>
<p><a href="https://github.com/chadoe/docker-cleanup-volumes">View on Github</a> or <a href="https://registry.hub.docker.com/u/martin/docker-cleanup-volumes/">View on Docker registry</a></p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Luks unlock with SSH or USB]]></title><description><![CDATA[<!--kg-card-begin: markdown--><h3 id="unlockingafulldiskencryptedubuntudebiansystemwithsshorusbflashdrive">Unlocking a full disk encrypted Ubuntu/Debian system with SSH or USB flash drive</h3>
<p>I&apos;ve started encryping my home server long before it was a next next next install option in Ubuntu and Debian. At some point I added USB unlocking with an old hacked up version of</p>]]></description><link>https://martinvanbeurden.nl/blog/luks-unlock-with-ssh-or-usb/</link><guid isPermaLink="false">598c26a393078100014edf03</guid><category><![CDATA[Linux]]></category><category><![CDATA[Luks]]></category><category><![CDATA[Ubuntu]]></category><category><![CDATA[Debian]]></category><category><![CDATA[Dropbear]]></category><category><![CDATA[SSH]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Mon, 09 Feb 2015 19:04:51 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h3 id="unlockingafulldiskencryptedubuntudebiansystemwithsshorusbflashdrive">Unlocking a full disk encrypted Ubuntu/Debian system with SSH or USB flash drive</h3>
<p>I&apos;ve started encryping my home server long before it was a next next next install option in Ubuntu and Debian. At some point I added USB unlocking with an old hacked up version of the script from <a href="http://wejn.org/how-to-make-passwordless-cryptsetup.html">How to setup passwordless disk encryption in Debian Etch</a> to my system but had to retract the keys from the luks volume too often because of broken or lost flash drives. So I recently started looking into unlocking it from SSH for which there even was a howto included in the ubuntu distribution (/usr/share/doc/cryptsetup/README.remote.gz). Unfortunately this has been broken since 2010 when <a href="https://wiki.ubuntu.com/Plymouth">plymouth</a> was introduced.</p>
<p>So I <a href="https://github.com/chadoe/luks-triple-unlock/blob/master/crypto-usb-key.sh">patched up</a> the usb unlock script from <a href="http://wejn.org/how-to-make-passwordless-cryptsetup.html">How to setup passwordless disk encryption in Debian Etch</a> to support unlocking from SSH, while maintaining support for entering the passphrase in plymouth, and<br>
wrote an install script which sets up the system to allow unlocking of full disk encrypted Ubuntu and Debian installs through console, USB-key or SSH.</p>
<p>Tested on:</p>
<ul>
<li>Ubuntu server 14.10 (no desktop)</li>
<li>Debian 7.8 (no desktop)</li>
</ul>
<p>Use at your own risk, I&apos;m not responsable for any damage this script might do to your system, make backups, make sure you have a safe boot option, test it in a VM first... etc. etc.</p>
<h3 id="usage">Usage</h3>
<ul>
<li>Install Ubuntu server or Debian with full disk encrypted LVM</li>
<li><code>sudo apt-get install -y git-core</code></li>
<li><code>git clone --depth 1 https://github.com/chadoe/luks-triple-unlock.git &amp;&amp; cd luks-triple-unlock</code></li>
<li><code>chmod +x *.sh</code></li>
<li><code>sudo ./install.sh [keyfile]</code>, it will ask you for the passphrase for the luks drive, keyfile is a path to a file you want to use as a key for the luks volume, this file will be read from an USB flash drive ext(2/3/4)/fat32/ntfs partition on boot. If no keyfile provided on the commandline a file <code>.keyfile</code> will be generated in the current directory.</li>
<li><code>sudo reboot</code></li>
</ul>
<h3 id="waystounlockyourmachine">Ways to unlock your machine</h3>
<ul>
<li>from the console</li>
<li>from SSH. Copy /etc/initramfs-tools/root/.ssh/id_rsa, this is the private key you need to log into dropbear (no password, root@machinename). When you connect it will ask you for the passphrase to unlock the machine.</li>
<li>with an USB flash drive. Copy .keyfile (or the file you provided on the commandline to ./install.sh) to any ext(2/3/4)/fat32/ntfs partition on an USB flash drive. Stick it in the machine and boot, it should boot straight through.</li>
</ul>
<p><a href="https://github.com/chadoe/luks-triple-unlock">View on GitHub</a></p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[XBMC/Kodi and SMB access denied]]></title><description><![CDATA[<!--kg-card-begin: markdown--><h3 id="ohnoaccessdenied">Oh no, access denied</h3>
<p>So I was trying <a href="http://kodi.tv">Kodi</a> on a new Android device I got (<a href="http://wetek.com">WeTek Play</a>) and soon ran into a problem where I couldn&apos;t access my password protected SMB shares on my linux server where my media is stored. Kodi would just ask for the</p>]]></description><link>https://martinvanbeurden.nl/blog/xbmckodi-and-smb-access-denied/</link><guid isPermaLink="false">598c26a393078100014edf02</guid><category><![CDATA[Linux]]></category><category><![CDATA[XBMC]]></category><category><![CDATA[Kodi]]></category><category><![CDATA[SMB]]></category><category><![CDATA[Samba]]></category><category><![CDATA[Android]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sat, 17 Jan 2015 13:53:30 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h3 id="ohnoaccessdenied">Oh no, access denied</h3>
<p>So I was trying <a href="http://kodi.tv">Kodi</a> on a new Android device I got (<a href="http://wetek.com">WeTek Play</a>) and soon ran into a problem where I couldn&apos;t access my password protected SMB shares on my linux server where my media is stored. Kodi would just ask for the username and password over and over but never authenticate. The error in Kodi&apos;s log was:</p>
<pre><code>SMBDirectory-&gt;GetDirectory: Unable to open directory : &apos;smb://USERNAME:PASSWORD@server&apos; unix_err:&apos;d&apos;error : &apos;Permission denied&apos;
</code></pre>
<p>Now the thing was I&apos;ve been using these shares from XBMC/Kodi on windows for many years and I could access these shares fine from every other machine and device... in fact even from this very same android device, just not from Kodi.<br>
So after googling for a while without any result except people suggesting to just allow guest access to the shares (omg!?). I vaguely remembered that the linux builds, and so probably android, generate a client smb configuration file. In this file lanman auth is enabled in order to be compatible with older servers. The problem is lanman is disabled by default in any &quot;recent&quot; samba version (as in since Samba 3.6.0 from 2011) and I wouldn&apos;t want to recommend enabling this broken and deprecated authentication method.</p>
<h3 id="thesolution">The solution</h3>
<p>What you want to do in this case is enable de default NTLMv2 authentication.<br>
To do this you have to edit the smb.conf file stored on the device in</p>
<pre><code>/storage/emulated/0/Android/data/org.xbmc.kodi/files/.smb/smb.conf
</code></pre>
<p>(path will vary with device) and add</p>
<pre><code>client NTLMv2 auth = yes
</code></pre>
<p>on a new line. You can use ES File Explorer for instance to edit the file. Save, and start Kodi.</p>
<p>If you can&apos;t find the file then just enable debug logging in system settings from within Kodi and it will show the path on screen where the logfile is stored which is close to where smb.conf is stored on your device. <code>/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/temp/kodi.log</code></p>
<p>Happy mediaplaying!</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[YUMI – Multiboot USB Creator]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>Reminder to myself that <a href="http://www.pendrivelinux.com/yumi-multiboot-usb-creator/">YUMI</a> is a great little tool to boot multiple iso&apos;s from a single bootable usb-stick.</p>
<!--kg-card-end: markdown-->]]></description><link>https://martinvanbeurden.nl/blog/yumi-multiboot-usb-creator/</link><guid isPermaLink="false">598c26a393078100014edf01</guid><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Fri, 31 Oct 2014 16:05:09 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>Reminder to myself that <a href="http://www.pendrivelinux.com/yumi-multiboot-usb-creator/">YUMI</a> is a great little tool to boot multiple iso&apos;s from a single bootable usb-stick.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Cleaning up after Docker]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>So I&apos;ve been playing around with <a href="http://docker.io">Docker</a> containers for a while now and really like it. In fact this blog is running in a Docker container right now. But Docker sure leaves a mess behind on disk.<br>
One of the things it tends to leave behind is volumes,</p>]]></description><link>https://martinvanbeurden.nl/blog/cleaning-up-after-docker/</link><guid isPermaLink="false">598c26a393078100014edf00</guid><category><![CDATA[Linux]]></category><category><![CDATA[Docker]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Sat, 06 Sep 2014 13:40:00 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>So I&apos;ve been playing around with <a href="http://docker.io">Docker</a> containers for a while now and really like it. In fact this blog is running in a Docker container right now. But Docker sure leaves a mess behind on disk.<br>
One of the things it tends to leave behind is volumes, that is unless you specify the <a href="http://docs.docker.com/reference/commandline/cli/#rm">--volumes option</a> when you rm a container which I always forget. So I wrote <a href="https://github.com/chadoe/docker-cleanup-volumes">a little script</a> to delete all the orphaned docker volumes in /var/lib/docker/volumes and /var/lib/docker/vfs/dir:</p>
<p><strong>WARNING</strong>: volumes have changed in Docker 1.7.0, the script below is outdated and will delete all volumes on Docker 1.7.0, goto <a href="https://github.com/chadoe/docker-cleanup-volumes">GitHub</a> for the latest version of the script that works with Docker 1.7.0</p>
<pre><code>#! /bin/bash

set -eo pipefail

#usage: sudo ./docker-cleanup-volumes.sh [--dry-run]

dockerdir=/var/lib/docker
volumesdir=${dockerdir}/volumes
vfsdir=${dockerdir}/vfs/dir
allvolumes=()
dryrun=false

function delete_volumes() {
  targetdir=$1
  echo
  if [[ ! -d ${targetdir} ]]; then
        echo &quot;Directory ${targetdir} does not exist, skipping.&quot;
        return
  fi
  echo &quot;Delete unused volume directories from $targetdir&quot;
  for dir in $(ls -d ${targetdir}/* 2&gt;/dev/null)
  do
        dir=$(basename $dir)
        if [[ &quot;${dir}&quot; =~ [0-9a-f]{64} ]]; then
                if [[ ${allvolumes[@]} =~ &quot;${dir}&quot; ]]; then
                        echo In use ${dir}
                else
                        if [ &quot;${dryrun}&quot; = false ]; then
                                echo Deleting ${dir}
                                rm -rf ${targetdir}/${dir}
                        else
                                echo Would have deleted ${dir}
                        fi
                fi
        else
                echo Not a volume ${dir}
        fi
  done
}

if [ $UID != 0 ]; then
    echo &quot;You need to be root to use this script.&quot;
    exit 1
fi

docker_bin=$(which docker.io || which docker)
if [ -z &quot;$docker_bin&quot; ] ; then
    echo &quot;Please install docker. You can install docker by running \&quot;wget -qO- https://get.docker.io/ | sh\&quot;.&quot;
    exit 1
fi

if [ &quot;$1&quot; = &quot;--dry-run&quot; ]; then
        dryrun=true
else if [ -n &quot;$1&quot; ]; then
        echo &quot;Cleanup docker volumes: remove unused volumes.&quot;
        echo &quot;Usage: ${0##*/} [--dry-run]&quot;
        echo &quot;   --dry-run: dry run: display what would get removed.&quot;
        exit 1
fi
fi

# Make sure that we can talk to docker daemon. If we cannot, we fail here.
docker info &gt;/dev/null

#All volumes from all containers
for container in `${docker_bin} ps -a -q --no-trunc`; do
        #add container id to list of volumes, don&apos;t think these
        #ever exists in the volumesdir but just to be safe
        allvolumes+=${container}
        #add all volumes from this container to the list of volumes
        for vid in `${docker_bin} inspect --format=&apos;{{range $vol, $path := .Volumes}}{{$path}}{{&quot;\n&quot;}}{{end}}&apos; ${container}`; do
            if [[ ${vid} == ${vfsdir}* &amp;&amp; &quot;${vid##*/}&quot; =~ [0-9a-f]{64} ]]; then
                    allvolumes+=(&quot;${vid##*/}&quot;)
            else
                    #check if it&apos;s a bindmount, these have a config.json file in the ${volumesdir} but no files in ${vfsdir}
                    for bmv in `grep --include config.json -Rl &quot;\&quot;IsBindMount\&quot;:true&quot; ${volumesdir} | xargs -i grep -l &quot;\&quot;Path\&quot;:\&quot;${vid}\&quot;&quot; {}`; do
                            bmv=&quot;$(basename &quot;$(dirname &quot;${bmv}&quot;)&quot;)&quot;
                            allvolumes+=(&quot;${bmv}&quot;)
                            #there should be only one config for the bindmount, delete any duplicate for the same bindmount.
                            break
                    done
            fi
            done
done

delete_volumes ${volumesdir}
delete_volumes ${vfsdir}
</code></pre>
<p><a href="https://github.com/chadoe/docker-cleanup-volumes">View on GitHub</a> or <a href="https://registry.hub.docker.com/u/martin/docker-cleanup-volumes/">View on Docker registry</a></p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Getting nano back after ctrl-z]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>When editing a file in nano I tend to hit ctrl-z to attempt to undo an edit but when you press ctrl-z in nano it dumps you back in the shell... very confusing... and very annoying because I do this all the time and usually just started over using a</p>]]></description><link>https://martinvanbeurden.nl/blog/getting-nano-back-after-ctrl-z/</link><guid isPermaLink="false">598c26a393078100014edeff</guid><category><![CDATA[How-to]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Martin van Beurden]]></dc:creator><pubDate>Fri, 05 Sep 2014 18:03:13 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>When editing a file in nano I tend to hit ctrl-z to attempt to undo an edit but when you press ctrl-z in nano it dumps you back in the shell... very confusing... and very annoying because I do this all the time and usually just started over using a new nano instance.</p>
<p>It turns out ctrl-z is a global command to send the current process to the background (not just nano) and here&apos;s a way to get a background process back, simply type:</p>
<pre><code>fg 
</code></pre>
<p>and nano will be back in the terminal as it was before hitting ctrl-z. Hooray!</p>
<p>If there are multiple processes in the background<br>
you can run <code>jobs</code> which will give you a list of processes running in the background:</p>
<pre><code>[1]+  Stopped        nano fileimediting
</code></pre>
<p>To bring job nr 1 to back to the foreground run <code>fg 1</code>, simple as that.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>