<?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"><channel><title><![CDATA[Coder Saga]]></title><description><![CDATA[A publication that explores the journey of coding, technology, and problem-solving. Each piece contributes to the ongoing saga of how code shapes ideas, product]]></description><link>https://codersaga.com</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1724477040171/322ed18d-5fc2-450c-982e-ca52bc9e4026.png</url><title>Coder Saga</title><link>https://codersaga.com</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 17:11:05 GMT</lastBuildDate><atom:link href="https://codersaga.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Setting Up a Virtual Webcam on Linux]]></title><description><![CDATA[I was testing a web app that involves taking pictures. Once again, my attached webcam wasn't working, and I didn't bother to check this minor issue. Just as 42 is the answer to everything, so is v4l2loopback.
First, let's summon the video device out ...]]></description><link>https://codersaga.com/setting-up-a-virtual-webcam-on-linux</link><guid isPermaLink="true">https://codersaga.com/setting-up-a-virtual-webcam-on-linux</guid><category><![CDATA[v4l2loopback]]></category><category><![CDATA[v4l2]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Faruq Sandi]]></dc:creator><pubDate>Thu, 02 Oct 2025 16:43:39 GMT</pubDate><content:encoded><![CDATA[<p>I was testing a web app that involves taking pictures. Once again, my attached webcam wasn't working, and I didn't bother to check this minor issue. Just as 42 is the answer to everything, so is v<strong>4</strong>l<strong>2</strong>loopback.</p>
<p>First, let's summon the video device out of thin air:</p>
<pre><code class="lang-bash">sudo modprobe v4l2loopback
</code></pre>
<p>Check this <a target="_blank" href="https://wiki.archlinux.org/title/V4l2loopback">extensive documentation</a>[<a target="_blank" href="https://archive.ph/wip/DuWZf">archive</a>] for details on the arguments you can use. A newly created video device is now available. In my case, it is at <code>/dev/video3</code>.</p>
<p>Now, see how <code>ffmpeg</code> takes input from <code>testrc</code> and then writes it to <code>/dev/video3</code>.</p>
<pre><code class="lang-bash">ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 -f v4l2 /dev/video3
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759422831106/389a289f-bf51-4a57-9616-a15a4c4627de.png" alt class="image--center mx-auto" /></p>
<p>Similarly, we can use <code>ffplay</code> to show the video.</p>
<pre><code class="lang-bash">ffplay /dev/video3
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759423008047/fa7b9cb4-0ee2-4948-a3bb-b7018e198df5.png" alt class="image--center mx-auto" /></p>
<p>At my workplace, I used <code>ffmpeg</code> and <code>gstreamer</code> to deliver real-time video feeds to our customers. This information might be available online, but it's scattered. While this post serves as my personal note, I hope it will also be useful for you. Ciao!</p>
]]></content:encoded></item><item><title><![CDATA[Setting Up a Local Docker Mirror]]></title><description><![CDATA[I often do docker build and impulsively did docker system prune -a, which effectively deletes all images and build caches. For some reason, this image, elasticsearch:8.13.4, takes its time to download. I don’t know why, but I know it is not worth try...]]></description><link>https://codersaga.com/setting-up-a-local-docker-mirror</link><guid isPermaLink="true">https://codersaga.com/setting-up-a-local-docker-mirror</guid><category><![CDATA[Docker]]></category><category><![CDATA[localhost]]></category><category><![CDATA[locally]]></category><category><![CDATA[Developer]]></category><category><![CDATA[development]]></category><dc:creator><![CDATA[Faruq Sandi]]></dc:creator><pubDate>Sun, 28 Sep 2025 17:31:53 GMT</pubDate><content:encoded><![CDATA[<p>I often do <code>docker build</code> and impulsively did <code>docker system prune -a</code>, which effectively deletes all images and build caches. For some reason, this image, <code>elasticsearch:8.13.4</code>, takes its time to download. I don’t know why, but I know it is not worth trying to fix it.</p>
<hr />
<p>This problem is not unique:</p>
<ol>
<li><p><a target="_blank" href="https://stackoverflow.com/questions/69113444/docker-pull-so-slow">https://stackoverflow.com/questions/69113444/docker-pull-so-slow</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/docker/hub-feedback/issues/2172">https://github.com/docker/hub-feedback/issues/2172</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/docker/hub-feedback/issues/2161">https://github.com/docker/hub-feedback/issues/2161</a></p>
</li>
<li><p><a target="_blank" href="https://forums.docker.com/t/docker-pull-taking-forever/130113/2">https://forums.docker.com/t/docker-pull-taking-forever/130113/2</a></p>
</li>
</ol>
<p>So I decided to set up my local Docker registry as a mirror. First, I need to spin up the Docker registry image from my Portainer:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759079852087/09e171c0-a143-416b-94ce-68628c4006a0.png" alt class="image--center mx-auto" /></p>
<p>After that, for each computer I use at home, update <code>/etc/docker/daemon.json</code>:</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"registry-mirrors"</span>: [<span class="hljs-string">"http://192.168.1.20:32776"</span>]
}
</code></pre>
<p>Do not forget to restart docker service <code>sudo systemctl restart docker</code>.</p>
<p>The result is that <code>docker pull</code> almost saturates my network speed. Without this mirror, docker pull often capped at hundreds of kbps despite my 150Mbps downlink.</p>
<p><img src="https://media.licdn.com/dms/image/v2/D5622AQGetLhTwn8v-Q/feedshare-shrink_2048_1536/B56ZmHXNEyKEAw-/0/1758912631713?e=1761782400&amp;v=beta&amp;t=fa882k5F7qmZrxIxYGcT-dTSuDagLvmomrwxfbNHp7w" alt="No alternative text description for this image" /></p>
<p>Visit this URL to see what images are cached <code>http://&lt;container_addr&gt;/v2/_catalog</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759084094523/3d421631-bbb3-48d4-9c11-12f649d19bab.png" alt class="image--center mx-auto" /></p>
<p>Follow me for updates.</p>
]]></content:encoded></item><item><title><![CDATA[Shrink WSL Disk Size Easily]]></title><description><![CDATA[Along with Visual Studio Code, Windows Subsystem for Linux (WSL) is a godsend. It makes it easy to access a Linux system without needing to install Linux on the host machine or use a virtual machine. It is indeed a virtual machine, but the way Micros...]]></description><link>https://codersaga.com/shrink-wsl-disk-size-easily</link><guid isPermaLink="true">https://codersaga.com/shrink-wsl-disk-size-easily</guid><category><![CDATA[WSL]]></category><category><![CDATA[Windows]]></category><category><![CDATA[Docker]]></category><dc:creator><![CDATA[Faruq Sandi]]></dc:creator><pubDate>Sat, 24 Aug 2024 05:14:55 GMT</pubDate><content:encoded><![CDATA[<p>Along with Visual Studio Code, <a target="_blank" href="https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux?ref=codersaga.com">Windows Subsystem for Linux</a> (WSL) is a godsend. It makes it easy to access a Linux system without needing to install Linux on the host machine or use a virtual machine. It is indeed a virtual machine, but the way Microsoft integrates it into Windows is slick.</p>
<p>The problem is that WSL uses a virtual disk as storage, which previously retained its size on the host machine even when files inside the virtual disk were no longer there. <a target="_blank" href="https://web.archive.org/web/20240312041541/https://devblogs.microsoft.com/commandline/windows-subsystem-for-linux-september-2023-update/#automatic-disk-space-clean-up-set-sparse-vhd">Newer WSL releases</a> will use a sparse disk to address this problem automatically. However, the old version requires setting the flag manually.</p>
<pre><code class="lang-plaintext">C:\Users\faruq&gt;wsl --list --verbose
  NAME                   STATE           VERSION
* Ubuntu-22.04           Stopped         2
  docker-desktop-data    Stopped         2
  docker-desktop         Stopped         2
</code></pre>
<h2 id="heading-solution-1-use-diskpart-to-compact-the-vdisk-size">Solution #1: Use diskpart to compact the vdisk size</h2>
<pre><code class="lang-plaintext">Microsoft DiskPart version 10.0.22621.1

Copyright (C) Microsoft Corporation.
On computer: BITWISE

DISKPART&gt; select vdisk file=C:\Users\faruq\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx

DiskPart successfully selected the virtual disk file.

DISKPART&gt; compact vdisk

  100 percent completed

DiskPart successfully compacted the virtual disk file.

DISKPART&gt;
</code></pre>
<p>Below are pictures comparing the size before and after the compact command. However, there is not much difference because before I wrote this article, I had already compacted the vdisk and reclaimed 50GB.</p>
<p><img src="https://digitalpress.fra1.cdn.digitaloceanspaces.com/kjd70ad/2024/03/image.png" alt /></p>
<p><img src="https://digitalpress.fra1.cdn.digitaloceanspaces.com/kjd70ad/2024/03/image-2.png" alt /></p>
<h2 id="heading-solution-2-set-vdisk-as-sparse">Solution #2: Set vdisk as sparse</h2>
<p>Another solution is to simply set the WSL distro to use a sparse vdisk and let the system do the job.</p>
<pre><code class="lang-plaintext">C:\Users\faruq&gt;wsl --manage Ubuntu-22.04 --set-sparse false
Conversion in progress, this may take a few minutes.
The operation completed successfully.
</code></pre>
<p>If you try to compact it like the previous solution, you will get an error:</p>
<pre><code class="lang-plaintext">DISKPART&gt; compact vdisk

DiskPart has encountered an error: The requested operation could not be completed due to a virtual disk system limitation.  Virtual hard disk files must be uncompressed and unencrypted and must not be sparse.
See the System Event Log for more information.
</code></pre>
<p>See you later!</p>
]]></content:encoded></item></channel></rss>