<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Denis on Medium]]></title>
        <description><![CDATA[Stories by Denis on Medium]]></description>
        <link>https://medium.com/@NucuLabs?source=rss-973ac43d4621------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*u_fE3GcSFzLv7mxI5sJ-6g.jpeg</url>
            <title>Stories by Denis on Medium</title>
            <link>https://medium.com/@NucuLabs?source=rss-973ac43d4621------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 14:42:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@NucuLabs/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Cancellation Token Pattern in Python]]></title>
            <link>https://medium.com/nuculabs/cancellation-token-pattern-in-python-b549d894e244?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/b549d894e244</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 19:00:32 GMT</pubDate>
            <atom:updated>2024-03-09T19:00:32.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1VElhFqWj7dcCjyICD1gPA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@aronvisuals?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Aron Visuals</a> on <a href="https://unsplash.com/photos/selective-focus-photo-of-brown-and-blue-hourglass-on-stones-BXOXnQ26B7o?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>Hello! 👋</p><p>The Cancellation Token Pattern article is a pattern inspired by C#’s <a href="https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoen?view=net-8.0">CancellationToken</a> struct and Golang’s <a href="https://pkg.go.dev/context">context</a> package.</p><p>The main idea of the pattern is to <strong>allow the user of an API</strong> to cancel its operations, but in order for this pattern to work, the API must be written with the cancellation token pattern in mind.</p><p>To use the pattern, you need a class that represents a cancellation token. Here’s my simple version:</p><pre>class CancellationToken:<br>    def __init__(self):<br>        self._is_canceled = False<br>    def is_canceled(self):<br>            return self._is_canceled<br>    def cancel(self):<br>        self._is_canceled = True</pre><p>Since cancel() is an <strong>idempotent</strong> operation the CancellationToken class can be safely used in a multithreaded application.</p><p>The code of the API must be written with the CancellationToken in mind. For example, consider the following piece of code is not written with the pattern in mind:</p><pre>while True:<br>    time.sleep(1)<br>    print(&quot;Hello world.&quot;)</pre><p>It loops forever, sleeps for a second and prints the string “Hello World.” We can rewrite it using the cancellation token pattern like this:</p><pre>ct = CancellationToken()<br>while not ct.is_canceled():<br>    time.sleep(1)<br>    print(&#39;Hello World!&#39;)</pre><p>The code now checks if the token is canceled, and if it is, it will stop running.</p><p>The user of the API has more control to when to cancel the execution of the operation/code.</p><p>Consider this example which cancels the token when it receives the SIGINT signal. The signal SIGINT is sent by the operating system to the program when we press CTRL+C inside the terminal or click the stop button in the IntelliJ IDE:</p><pre>import functools<br>import signal<br>import time<br><br>class CancellationToken:<br>    def __init__(self):<br>        self._is_canceled = False<br><br>def is_canceled(self):<br>        return self._is_canceled<br>    def cancel(self):<br>        self._is_canceled = True<br><br>def main():<br>    # Setup cancellation token<br>    ct = CancellationToken()<br>    # Setup signal handling for SIGINT<br>    def signal_handler(cancellation_token: CancellationToken, sig, frame):<br>        print(&quot;Handling sigint&quot;)<br>        cancellation_token.cancel()<br>    signal.signal(signal.SIGINT, functools.partial(signal_handler, ct))<br>    # Block until signal is received<br>    while not ct.is_canceled():<br>        time.sleep(1)<br>        print(&#39;Hello World!&#39;)<br>    print(&quot;Done&quot;)<br><br>if __name__ == &#39;__main__&#39;:<br>    main()</pre><p>If an API has a more complex control flow like running multiple functions in parallel, we can pass the initial cancellation token to each function and cancel all of them at once.</p><p>Golang has <a href="https://pkg.go.dev/context#WithTimeout">WithTimeout</a> which creates a context that gets cancelled after the specified timeout. To implement a similar feature in our CancellationToken we can subclass it in our Python implementation and use <a href="https://docs.python.org/3/library/threading.html#timer-objects">Timer</a> object to cancel the token. Alternatively, we can add the timeout to the current time and call it timeout_time, and when is_canceled() is called we can check if the current time is greater than or equal (&gt;=) than the timeout_time.</p><p>I hope you’ve enjoyed this article and <strong>thank you for reading</strong>! 🙏</p><p><em>If you have any thoughts about this article, feel free to leave a comment.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b549d894e244" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nuculabs/cancellation-token-pattern-in-python-b549d894e244">Cancellation Token Pattern in Python</a> was originally published in <a href="https://medium.com/nuculabs">NucuLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to install HP LaserJet 107a Drivers on Linux]]></title>
            <link>https://medium.com/nuculabs/how-to-install-hp-laserjet-107a-drivers-on-linux-154d09f28519?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/154d09f28519</guid>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Thu, 22 Feb 2024 13:58:55 GMT</pubDate>
            <atom:updated>2024-02-22T13:59:32.661Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bBvd2aacRytRJr3s" /><figcaption>Photo by <a href="https://unsplash.com/@mahrous_houses?utm_source=medium&amp;utm_medium=referral">Mahrous Houses</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hello everyone! 👋</p><p>I’ve recently installed <a href="https://fedoraproject.org/">Fedora</a> on my main PC and I wanted to write this post to serve me as a memo on how to install the HP LaserJet 107 printer driver.</p><p>The driver should also be compatible with the following products and generally HP’s LaserJet 100 printer series.</p><ul><li>HP LaserJet 107a</li><li>HP LaserJet 105a</li><li>HP LaserJet 103a</li></ul><h3>Installing the Drivers</h3><p>Installing the drivers requires Python3 available on your system if I remember correctly, it should be already available on Fedora and Ubuntu.</p><p>To install the drivers run the following commands:</p><pre>wget <a href="https://ftp.hp.com/pub/softlib/software13/printers/CLP150/uld-hp_V1.00.39.12_00.15.tar.gz">https://ftp.hp.com/pub/softlib/software13/printers/CLP150/uld-hp_V1.00.39.12_00.15.tar.g</a>z</pre><pre>tar -xvf uld-hp_V1.00.39.12_00.15.tar.gz</pre><pre>cd uld/ <br>sudo ./install.sh</pre><p>If you don’t like the terminal you can also download the driver from HP’s <a href="https://support.hp.com/us-en/drivers/hp-laser-100-printer-series/24494339">website</a>.</p><h3>Installing the Printer</h3><p>I’m using Gnome Software v45 and if you’re using Gnome as well you can follow these steps to install the printer.</p><ol><li>Connect your printer to your PC.</li><li>Go to Settings -&gt; Printers</li><li>Click add a printer and select your printer.</li><li><strong>IMPORTANT</strong> In the printer details, the driver should be HP Laser 10x Series.</li></ol><p>If the driver is not HP Laser 10x Series then click on the Select from Database... button, select Hewlett-Packard as the manufacturer in the left tab and search for the HP Laser 10x Series driver in the righ tab then select it.</p><p>You should be able to print your documents. 😁</p><p>Thank you for reading! 📚</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=154d09f28519" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nuculabs/how-to-install-hp-laserjet-107a-drivers-on-linux-154d09f28519">How to install HP LaserJet 107a Drivers on Linux</a> was originally published in <a href="https://medium.com/nuculabs">NucuLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing cat with Kotlin Native]]></title>
            <link>https://medium.com/nuculabs/implementing-cat-with-kotlin-native-8f9276882fd7?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f9276882fd7</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[kotlin-native]]></category>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Sun, 04 Feb 2024 15:58:47 GMT</pubDate>
            <atom:updated>2024-02-04T15:58:47.436Z</atom:updated>
            <content:encoded><![CDATA[<h3>A quick article on how to leverage the power of Kotlin native to implement k-cat.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4yulj4pFqI_BPUHu.png" /></figure><h3>Introduction</h3><p>Hello! 👋</p><p>In this article we’ll implement the cat command utility which is used in many Unix like systems like Linux and macOS. To implement it, we’ll use <a href="https://kotlinlang.org/">kotlin</a> and to drop the Java Virtual Machine (JVM). We’ll build a binary directly with <a href="https://kotlinlang.org/docs/native-overview.html">Kotlin Native</a>. In the end, we’ll get an executable that we can simply run on our Linux or macOS box.</p><h3>What is cat?</h3><p>The catutility which has purpose of concatenating files. You can use it by typing cat file.txt and it will output the contents of the file into the terminal. It also has more options like: usage: cat [-belnstuv] [file ...] which are documented in the <a href="https://linux.die.net/man/1/cat">manual pages</a>.</p><h3>Kotlin &amp; Kotlin Native</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5c_5bWZTx3I0y5Gq.png" /></figure><p>Kotlin is a <strong>modern</strong> programming language that was first introduced by JetBrains in 2011 and later officially supported by Google for Android development. It’s designed to be fully interoperable with Java, while also fixing some of the common pain points of Java, making it more concise, expressive, and enjoyable to use.</p><p>Kotlin Native is a technology for compiling Kotlin code to native binaries, which can run without a virtual machine like the Java Virtual Machine (JVM). It is part of <a href="https://kotlinlang.org/docs/multiplatform.html">Kotlin Multiplatform</a> which is technology designed to simplify cross-platform development. You can use Kotlin Multiplatform to develop software for Server, Android, iOS, Desktop and Web — JavaScript.</p><h3>Implementing cat with Kotlin Native</h3><p>To follow along, I recommend that you use the <a href="https://www.jetbrains.com/idea/download/?section=mac">IntelliJ IDEA Community</a> or <a href="https://www.jetbrains.com/idea/">Professional</a> integrated development environment (IDE).</p><h3>Cloning the Kotlin Native template</h3><p>Start by cloning the Kotlin Native project template, I’ll come with everything preconfigured to get you started.</p><pre>git clone https://github.com/Kotlin/kmp-native-wizard k-cat</pre><p>Then open up the project in your IDE.</p><h3>Modifying the template</h3><p>I’ve started modifying the template by first changing the project name to k-cat.</p><p>Open .../IdeaProjects/k-cat/settings.gradle.kts and set rootProject.name</p><pre>rootProject.name = &quot;k-cat&quot;</pre><p>And that’s pretty much everything we need so far to give our project a proper name! 🔩</p><h3>Implementing cat</h3><p>The cat utility is a complex program. We’ll implement a simplified version that has the following requirements.</p><h3>Requirements</h3><p>The program accepts a required string parameter which is implicit and represents the file path and an optional -n flag parameter.</p><p>It will open the file given in the file path parameter, and it will print its contents on the terminal screen.</p><p>When called with the optional -n parameter it will print the line number before printing the file.</p><p>Example use:</p><pre>./k-cat.kexe -n file.txt<br>0  Hello,<br>1  From nuculabs.dev</pre><h3>Implementation</h3><p>To start implementing, please open: .../IdeaProjects/k-cat/src/nativeMain/kotlin/Main.kt.</p><h4>Reading command line arguments</h4><p>To read command line arguments, we need to add the args: Array&lt;String&gt; parameter to our main function. The args array will contain command line arguments passed to the program.</p><pre>fun main(args: Array&lt;String&gt;) {<br> //...<br>}</pre><h4>Parsing command line arguments</h4><p>To parse command line arguments, I’ve used simple Kotlin constructs.</p><p>The code is pretty much self-describing. First we search for the required filePath argument, and then we store its value inside a variable. Secondly, we search for the optional -n shortform and --numbering longform argument, and if it’s found in the command line arguments array then we set the numbering boolean to true.</p><pre>// Grab the required file path argument<br>    val fileArgs = args.filterNot { it.startsWith(&quot;-&quot;) }<br>    if (fileArgs.size != 1) {<br>        println(&quot;Usage: missing path to file: ./k-cat &lt;file&gt;&quot;)<br>        return<br>    }<br>    val filePath = fileArgs.first()<br>    // Parse for optional `-n` argument<br>    var numbering = false;<br>    args.forEach {<br>        when (it) {<br>            &quot;-n&quot; -&gt; numbering = true<br>            &quot;--numbering&quot; -&gt; numbering = true<br>        }<br>    }</pre><h4>Reading Files</h4><p>Reading files can be done by using already available function or by using a library. I’ve chosen the later one and added the <a href="https://square.github.io/okio/">okio</a> dependency to my project.</p><p>To add a dependency open .../IdeaProjects/k-cat/build.gradle.kts and change sourceSets as following:</p><pre>kotlin {<br>    //...<br>    sourceSets {<br>        val nativeMain by getting<br>        val nativeTest by getting<br>        val commonMain by getting {<br>            dependencies {<br>                implementation(&quot;com.squareup.okio:okio:3.7.0&quot;)<br>            }<br>        }<br>    }<br>}</pre><p>Then you can import and use the library in your main function to read files. For example:</p><pre>import okio.FileSystem<br>import okio.Path.Companion.toPath<br>import okio.use<br>import okio.buffer</pre><pre>FileSystem.SYSTEM.source(&quot;file.txt&quot;.toPath()).use { fileSource -&gt;<br>    fileSource.buffer().use { bufferedFileSource -&gt;<br>        while (true) {<br>          val line = bufferedFileSource.readUtf8Line() ?: break<br>          // do something with line<br>        }<br>    }<br>}</pre><h4>Implementing simple k-cat</h4><p>The implementation is now straightforward, since we know how to parse command line arguments and to read files.</p><p>The following piece of code implements k-cat. It reads all the lines from a file path, and if numbering is true, it will print the line number and the line, otherwise it will only print the line.</p><pre>FileSystem.SYSTEM.source(filePath.toPath()).use { fileSource -&gt;<br>        fileSource.buffer().use { bufferedFileSource -&gt;<br>            var number = 0<br>            while (true) {<br>                val line = bufferedFileSource.readUtf8Line() ?: break<br>                if (numbering) {<br>                    val formattedNumber = number.toString().padEnd(2, &#39; &#39;)<br>                    println(&quot;$formattedNumber $line&quot;)<br>                } else {<br>                    println(line)<br>                }<br>                number += 1<br>            }<br>        }<br>    }</pre><h3>Conclusion</h3><p>In summary, Kotlin Native extends the capabilities of Kotlin, enabling developers to compile Kotlin code into native binaries for a variety of platforms, including desktop, web, android, iOS and embedded systems. This extension offers the performance of native applications while maintaining Kotlin’s expressiveness and safety features.</p><p>Thanks for reading! Happy Holidays! 🎄✨</p><h3>Further Reading / References</h3><ul><li><a href="https://kotlinlang.org/docs/native-get-started.html#build-and-run-the-application">https://kotlinlang.org/docs/native-get-started.html#build-and-run-the-application</a></li><li><a href="https://kotlinlang.org/docs/native-overview.html">https://kotlinlang.org/docs/native-overview.html</a></li><li><a href="https://github.com/Kotlin/kmp-native-wizard">https://github.com/Kotlin/kmp-native-wizard</a></li></ul><h3>Full Code: Main.kt</h3><pre>import okio.FileSystem<br>import okio.Path.Companion.toPath<br>import okio.use<br>import okio.buffer</pre><pre>fun main(args: Array&lt;String&gt;) {<br>    // Grab the required file path argument<br>    val fileArgs = args.filterNot { it.startsWith(&quot;-&quot;) }<br>    if (fileArgs.size != 1) {<br>        println(&quot;Usage: missing path to file: ./k-cat &lt;file&gt;&quot;)<br>        return<br>    }<br>    val filePath = fileArgs.first()<br>    // Parse for optional `-n` argument<br>    var numbering = false;<br>    args.forEach {<br>        when (it) {<br>            &quot;-n&quot; -&gt; numbering = true<br>            &quot;--numbering&quot; -&gt; numbering = true<br>        }<br>    }</pre><pre>    FileSystem.SYSTEM.source(filePath.toPath()).use { fileSource -&gt;<br>        fileSource.buffer().use { bufferedFileSource -&gt;<br>            var number = 0<br>            while (true) {<br>                val line = bufferedFileSource.readUtf8Line() ?: break<br>                if (numbering) {<br>                    val formattedNumber = number.toString().padEnd(2, &#39; &#39;)<br>                    println(&quot;$formattedNumber $line&quot;)<br>                } else {<br>                    println(line)<br>                }</pre><pre>                number += 1<br>            }<br>        }<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f9276882fd7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nuculabs/implementing-cat-with-kotlin-native-8f9276882fd7">Implementing cat with Kotlin Native</a> was originally published in <a href="https://medium.com/nuculabs">NucuLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My experience with BambuLab A1 and 3D printing]]></title>
            <link>https://medium.com/nuculabs/my-experience-with-bambulab-a1-and-3d-printing-fed3d996786a?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/fed3d996786a</guid>
            <category><![CDATA[freecad]]></category>
            <category><![CDATA[3d-printing]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Sun, 04 Feb 2024 15:57:07 GMT</pubDate>
            <atom:updated>2024-02-12T18:20:40.445Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UV13UBCjP1RN26Bz.JPG" /></figure><h3>Introduction</h3><p>Hello everyone, 👋</p><p>This is my first post of 2024, and ever since I’ve started the blog in ~2018, I’ve had engineering Programming, Cloud and Engineering! 👨‍🔬; in the blog’s description. 😄</p><p>I made a few posts related to “engineering” other than Software Engineering. In 2018, I was still studying computer science and engineering at UPT, and I was fascinated by the Electrical Engineering courses. I figured that I’d write blog posts about circuit analysis techniques such as Ohm’s Law, Thévenin’s Theorem, Mesh Analysis, and so on.</p><p>I wrote a few of them and focused solely on Software Engineering and a few posts on <a href="https://blog.nuculabs.dev/categories/embedded/">Embedded</a>.</p><h3>3D Printing</h3><p>In this post, I talk about my experience with my first 3D printer the <a href="https://bambulab.com/en/a1">Bambu Lab A1</a> and modeling real world objects using open-source CAD software.</p><p>The printer is <strong>intuitive</strong> to use. I got my first print withing minutes after the initial setup and calibrations.</p><p>You don’t need to perform manual calibration since the printer can self-calibrate before every print. On the first run, it will do a more thorough calibration. Other than that, you will need to perform monthly or weekly maintenance, which is well documented on Bambu Lab’s <a href="https://wiki.bambulab.com/en/a1/maintenance">website</a>.</p><p>Software support is available on all the major platforms: Windows, macOS, Linux and Android.</p><p>You can print everything from your phone (with fewer customization options) because the printer is connected to your Wi-Fi network.</p><p>Since I got the printer, I successfully printed:</p><ul><li>Ice Scrapper — To scrap ice from my car’s window. 😎</li><li>Cutlery Holder — I threw the old one away since it was getting dirty.</li><li>Raspberry PI case — This was the most fun print. A case that fits my Raspberry PI perfectly and just snaps in place.</li><li>Phone Holder — For those moments when video calling my family and I need to do something else as well.</li></ul><p>I’ve also used open source and proprietary software to model objects. I modeled and printed a box for my audio interface and another box for the Raspberry PI case. I glued the boxes to some furniture to hide the objects 😅.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*60RjScXbWdXNj7QN.JPG" /></figure><p>I glued my audio interface under my desk. The next thing I’m going to glue under my desk is the KVM switch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bjttZJaZ9eQrfPFp.jpg" /></figure><p>This is my Raspberry PI, which reads climate data from a BME680 sensor and displays it on my phone (using Homekit) and records values to a prometheus instance allowing me to view a historical record of values in a Grafana. I wrote more about this project in the <a href="https://blog.nuculabs.dev/posts/2022/2022-01-16-bme680-home-assistant-integration/">BME680 Home Assistant Integration</a> post. <em>(I did not project the case from the image myself)</em>.</p><p>If you plan on buying a 3D printer yourself, you can find lots of <strong>free</strong> models on websites such as:</p><ul><li><a href="https://www.printables.com/">https://www.printables.com/</a></li><li><a href="https://makerworld.com/en">https://makerworld.com/en</a></li></ul><p>To model objects I’ve started, using a free for personal use program called <a href="https://www.autodesk.com/products/fusion-360">Fusion 360</a></p><p>I did not like the fact that it requires an active internet connection to use since all computations are done in the cloud.</p><p>It started lagging on my machine and I searched for alternatives that I can use while also being offline.</p><p>Then I stumbled across <a href="https://www.freecad.org/">FreeCAD</a>, which is open-source and free to use! 🤯</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aV95YZ9Ic14dhS3W.png" /></figure><p>YouTube is full of FreeCAD <a href="https://www.youtube.com/watch?v=8h1ofkRFdeI&amp;list=PL7eiW2bt21YU6QEbly78kUgQCNEiDUwSH">tutorials</a>.</p><h3>Closing Thoughts</h3><p>I did not expect to have so much fun 3D printing things for my home and friends. Initially, I bought the printer to print D&amp;D miniatures and I got an FDM printer because of the lack of space in my apartment.</p><p>The printer got useful really quickly when I printed a box for hiding my audio interface under my desk and some cable clippers, helping me to effectively reduce cable clutter.</p><p>BambuLab A1 is an easy and straightforward to use printer. The price of the printer is fair, and if you’re looking for more advanced printers, you can find them on their <a href="https://bambulab.com/en/compare">website</a>. I like that everything just works straight out of the box, the printer has Wi-Fi, a camera for monitoring, notifications for my mobile phone when something goes wrong, easy pause and resume for prints, auto calibration, easy setup and maintenance.</p><p>The open-source community also offers us a great and capable tool <a href="https://www.freecad.org/">FreeCAD</a> that we can use for free to bring our designs to life.</p><p>Thank you for reading! 📖</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fed3d996786a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nuculabs/my-experience-with-bambulab-a1-and-3d-printing-fed3d996786a">My experience with BambuLab A1 and 3D printing</a> was originally published in <a href="https://medium.com/nuculabs">NucuLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to document a project with MkDocs ]]></title>
            <link>https://medium.com/nuculabs/how-to-document-a-project-with-mkdocs-99479ac6f6bb?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/99479ac6f6bb</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mkdocs]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[videos]]></category>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Sat, 16 Oct 2021 17:39:45 GMT</pubDate>
            <atom:updated>2021-10-17T18:51:40.493Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/440/0*VRR0ztIvn9WZUZJB" /></figure><p>Hello,</p><p>Welcome my third video tutorial, this time, on how to get started with <a href="https://www.mkdocs.org/">MkDocs</a>.</p><p>In this video I try to give you a basic overview of MkDocs and a configuration consisting of the material theme and search plugin.</p><h3>Config</h3><p>The MkDocs configuration used in the video.</p><pre>site_name: My Cool Project Documentation theme: name: material features: - search.suggest - search.highlight - content.tabs.link plugins: - search nav: - Introduction: &quot;index.md&quot; - Tutorial: - Tutorial Subsection: &quot;pages/tutorial/tutorial_subsection.md&quot; - About: &quot;pages/about.md&quot; - FAQ: &quot;pages/faq.md&quot; markdown_extensions: - attr_list</pre><h3>Docker Deployment</h3><p>When you’re ready to deploy your documentation website, say in Docker with Nginx the following Dockerfile and Nginx default.conf should do.</p><p><strong>Dockerfile</strong></p><pre>FROM python:3.9 as builder WORKDIR /app COPY . . RUN pip install mkdocs mkdocs-material &amp;&amp; mkdocs build FROM nginx as deploy # Copy the build to the nginx directory. COPY --from=builder /app/site/ /usr/share/nginx/html/ # Copy the nginx configuration to the nginx config directory. COPY default.conf /etc/nginx/conf.d/ EXPOSE 8080:8080/tcp</pre><p><strong>default.conf</strong></p><pre>server { listen 8080; root /usr/share/nginx/html/; index index.html; }</pre><p>I thought that making videos will be easier that typing blog posts but to my surprise the difficulty is a bit higher. Fixing mistakes takes more time with videos and since I’m not that great of a presenter I struggle with presenting the content. Hopefully I will improve my skills with time and practice.</p><p>Thanks for reading! 🍻</p><p><em>Originally published at </em><a href="https://nuculabs.dev/2021/10/16/how-to-document-a-project-with-mkdocs-%f0%9f%93%b9/"><em>http://nuculabs.dev</em></a><em> on October 16, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99479ac6f6bb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nuculabs/how-to-document-a-project-with-mkdocs-99479ac6f6bb">How to document a project with MkDocs 📹</a> was originally published in <a href="https://medium.com/nuculabs">NucuLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MAD: GameDevLog #0]]></title>
            <link>https://medium.com/nuculabs/mad-gamedevlog-0-29f4fbf344ef?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/29f4fbf344ef</guid>
            <category><![CDATA[games]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[retro]]></category>
            <category><![CDATA[pixel-art]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Sat, 01 Jun 2019 18:37:38 GMT</pubDate>
            <atom:updated>2019-06-01T18:37:38.544Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*eoHJ-WKwUQIqNfomf04LAw.gif" /></figure><p>It’s been a while since I wrote an article and this one is a bit different. I joked one day with a two other friends to make a game, and somehow the idea was very well received, we teamed up and started pitching game ideas. We are three friends. Me and Andrei are good with coding and Max is good with arts.</p><p>The problem was that me and Andrei aren’t video game developers, the only thing that we’re both experts at is to write hello world in many different programming languages.</p><p>After analyzing what engine should we use for our game we decided to go with Unity. We spend the last 3 weeks making concept art, doing Unity tutorials and brainstorming ideas for our game. After gathering some ideas we decided to make an old style game, inspired by the classical NES Bomberman.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xMFG3QJBH8yLFtcqWc_KUQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*xACaigJIq7UTfhHhPzwQdQ.jpeg" /></figure><p>Me and Andrei were learning Unity while Max, our artist continued to draw and make assets for the game.</p><p>So far, we got to the point where we completed the player movement part, the camera part, and somewhat the world part. The other stuff is still in development. This is our very first time we collaborate and it is also our first attempt in making a game. I’m curious what the future will bring us and how the project will continue to develop.</p><p>After finishing the game we’d like to release it for PC, Android and Xbox.</p><p>Lastly, I’m glad that Max (<a href="https://www.instagram.com/maximilianbtw/">@maximilianbtw</a>) has decided to chose Pixel Art for the game, I think it looks great and it brings back lots of memories from games that we’ve grown up with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*K3gVsOZbflJDLUe4EnJdAA.png" /></figure><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29f4fbf344ef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nuculabs/mad-gamedevlog-0-29f4fbf344ef">MAD: GameDevLog #0</a> was originally published in <a href="https://medium.com/nuculabs">NucuLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I solved a simple CrackMe challenge with the NSA’s Ghidra]]></title>
            <link>https://medium.com/free-code-camp/how-i-solved-a-simple-crackme-challenge-with-the-nsas-ghidra-d7e793c5acd2?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7e793c5acd2</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Wed, 20 Mar 2019 15:30:50 GMT</pubDate>
            <atom:updated>2019-03-28T21:05:11.239Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9N3SURf2cF4fISICAH7tGA.png" /></figure><p>Hello!</p><p>I’ve been playing recently a bit with <a href="https://ghidra-sre.org/">Ghidra</a>, which is a reverse engineering tool that was recently open sourced by the NSA. The official website describes the tool as:</p><blockquote><em>A software reverse engineering (SRE) suite of tools developed by NSA’s Research Directorate in support of the Cybersecurity mission.</em></blockquote><p>I’m at the beginning of my reverse engineering career, so I didn’t do anything advanced. I don’t know what features to expect from a professional tool like this, if you’re looking to read about advanced Ghidra features this is likely not the article for you.</p><p>In this article I will try to solve a simple CrackMe challenge that I’ve found on the website <a href="https://www.root-me.org/">root-me</a>. The challenge I’m solving is called <a href="https://www.root-me.org/en/Challenges/Cracking/ELF-CrackPass">ELF - CrackPass</a>. If you want to give it try by yourself, then you should consider not reading this article because it will spoil the challenge from you.</p><p>Let’s get started! I open up Ghidra and create a new Project which I call RootMe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yr02b0tO_LwZ2YeWAA_uxg.png" /></figure><p>Then I import the challenge file by dragging it to the project folder. I will go with the defaults.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qi2FpMsT07aaCegSqGygqA.png" /></figure><p>After being presented with some info about the binary file, I press OK, select the file, and double click it. This opens up Ghidra’s code browser utility and asks if I want to analyse the file, then I press Yes and go on with the defaults.</p><p>After we import the file, we get some information about the binary file. If we press OK and dismiss this window, and then double click the file we imported, this opens up Ghidra’s code browser utility. I select Yes when prompted to analyze the binary and go on with the defaults.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vc-jFGaFpY3tDPadqMk8mQ.png" /></figure><p>The Code Browser is quite convenient. In the left panel we get to see the disassembly view and in the right panel the decompile view.</p><p>Ghidra shows us directly the ELF header info and the entry point of the binary. After double clicking the entry point, the dissembler view jumps to the entry function.</p><p>Now we can successfully identify the main function, which I rename to main. It would be nice if the tool would attempt to automatically detect the main function and rename it accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9N3SURf2cF4fISICAH7tGA.png" /></figure><p>Before analyzing the main function, I wanted to change its signature. I changed the return type to int and corrected the parameters’ type and name. This change has taken effect in the decompile view which is cool! 👍</p><p>Highlighting a line in the decompile view also highlights it in the assembly view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l29BFM-3AmdwbdZ2xIJ_ZQ.png" /></figure><p>Let’s explore the FUN_080485a5 function, which I’ll rename to CheckPassword.</p><p>The contents of the CheckPassword function can be found below. I’ve copied the code directly from Ghidra’s decompile view, which is a neat feature that many tools of this type lack! Being able to copy assembly and code is a nice to have feature.</p><pre>void CheckPassword(char *param_1)<br> {<br>   ushort **ppuVar1;<br>   int iVar2;<br>   char *pcVar3;<br>   char cVar4;<br>   char local_108c [128];<br>   char local_100c [4096];<br>   cVar4 = param_1;   <br>    if (cVar4 != 0) {    <br>      ppuVar1 = __ctype_b_loc();     <br>      pcVar3 = param_1;     <br>      do {       <br>        if (((byte )(ppuVar1 + (int)cVar4) &amp; 8) == 0) {<br>         puts(&quot;Bad password !&quot;);<br>                     /* WARNING: Subroutine does not return */<br>         abort();<br>       }<br>       cVar4 = pcVar3[1];<br>       pcVar3 = pcVar3 + 1;<br>     } while (cVar4 != 0);<br>   }<br>   FUN_080484f4(local_100c,param_1);<br>   FUN_0804851c(s_THEPASSWORDISEASYTOCRACK_08049960,local_108c);<br>   iVar2 = strcmp(local_108c,local_100c);<br>   if (iVar2 == 0) {<br>     printf(&quot;Good work, the password is : \n\n%s\n&quot;,local_108c);<br>   }<br>   else {<br>     puts(&quot;Is not the good password !&quot;);<br>   }<br>   return;<br> }</pre><p>After taking a look at the code, I’ve come to the following conclusions. The block with the if checks if the user has provided a password and inspects the provided password to check if it’s a valid character or something. I’m not exactly sure what it’s checking for, but here’s what __ctype_b_loc()’s documentation says:</p><blockquote><em>The __ctype_b_loc() function shall return a pointer into an array of characters in the current locale that contains characteristics for each character in the current character set. The array shall contain a total of 384 characters, and can be indexed with any signed or unsigned char (i.e. with an index value between 128 and 255). If the application is multi-threaded, the array shall be local to the current thread.</em></blockquote><p>Anyways, that block of code is not really worth the time, because it doesn’t modify our password in any way, it just verifies it. So we can skip this kind of verification.</p><p>The next function called is FUN_080484f4. Looking at its code, we can tell that it’s just a custom memcopy implementation. Instead of copying the C code from the decompiler view, I copied the assembly code — yes, this is fun.</p><pre>*************************************************************                     *                           FUNCTION                                               *************************************************************                     undefined  FUN_080484f4 (undefined4  param_1 , undefined4  p     undefined         AL:1           &lt;RETURN&gt;     undefined4        Stack[0x4]:4   param_1                                 XREF[1]:     080484f8 (R)        undefined4        Stack[0x8]:4   param_2                                 XREF[1]:     080484fb (R)                        FUN_080484f4                                    XREF[1]:     CheckPassword:080485f5 (c)   <br> 080484f4 55              PUSH       EBP<br> 080484f5 89  e5           MOV        EBP ,ESP<br> 080484f7 53              PUSH       EBX<br> 080484f8 8b  5d  08       MOV        EBX ,dword ptr [EBP  + param_1 ]<br> 080484fb 8b  4d  0c       MOV        ECX ,dword ptr [EBP  + param_2 ]<br> 080484fe 0f  b6  11       MOVZX      EDX ,byte ptr [ECX ]<br> 08048501 84  d2           TEST       DL,DL<br> 08048503 74  14           JZ         LAB_08048519<br> 08048505 b8  00  00       MOV        EAX ,0x0<br>             00  00<br>                         LAB_0804850a                                    XREF[1]:     08048517 (j)   <br> 0804850a 88  14  03       MOV        byte ptr [EBX  + EAX *0x1 ],DL<br> 0804850d 0f  b6  54       MOVZX      EDX ,byte ptr [ECX  + EAX *0x1  + 0x1 ]<br>             01  01<br> 08048512 83  c0  01       ADD        EAX ,0x1<br> 08048515 84  d2           TEST       DL,DL<br> 08048517 75  f1           JNZ        LAB_0804850a<br>                         LAB_08048519                                    XREF[1]:     08048503 (j)   <br> 08048519 5b              POP        EBX<br> 0804851a 5d              POP        EBP<br> 0804851b c3              RET<br>Comment: param_1 is dest, param_2 is src. <br>08048501 checks if src is null and if it is <br>it returns else it initializes EAX (index, current_character) <br>with 0. The next instructions move bytes into EBX (dest) from EDX (src).<br>The loop stops when EDX is null.</pre><p>And the other function FUN_0804851c generates the password from the “THEPASSWORDISEASYTOCRACK” string. Looking at the decompiled view. we can roughly see how this function works. If we didn’t have that, we would need to manually analyze every assembly instruction from the function to understand what it does.</p><p>Then, we compare the previously generated password with the password that we got from the user (the first argument, argv[1]). If it matches, the program says good job and prints it, else it prints an error message.</p><p>From this basic analysis, we can conclude that if we patch the program in various places, we can get it to spit the password without us needing to reverse any C function and write code. Patching the program means changing some of its instructions.</p><p>Let’s see what we have to patch:</p><p>At address 0x0804868c we patch the JNS instruction into a JMP. And voilà, the change is reflected in the decompiler view. The ptrace result check is bypassed.</p><pre>{<br>   ptrace(PTRACE_TRACEME,0,1,0);<br>   if (argc != 2) {<br>     puts(&quot;You must give a password for use this program !&quot;);<br>                     /* WARNING: Subroutine does not return */<br>     abort();<br>   }<br>   CheckPassword(argv[1]);<br>   return 0;<br>}</pre><p>At address 0x080485b8 we patch the JZ instruction into a JMP. We bypass that password verification block we saw earlier.</p><pre>void CheckPassword(undefined4 param_1)<br> {<br>   int iVar1;<br>   char local_108c [128];<br>   char local_100c [4096];<br>   CustomCopy(local_100c,param_1);<br>      GeneratePassword(s_THEPASSWORDISEASYTOCRACK_08049960,local_108c);<br>   iVar1 = strcmp(local_108c,local_100c);<br>   if (iVar1 == 0) {<br>     printf(&quot;Good work, the password is : \n\n%s\n&quot;,local_108c);<br>   }<br>   else {<br>     puts(&quot;Is not the good password !&quot;);<br>   }<br>   return;<br> }</pre><p>At address 0x0804861e we patch JNZ to JZ. This inverts the if/else condition. Since we don’t know the password, we’re going to submit a random password that is not equal to the generated one, thus executing the printf on the else block.</p><pre>void CheckPassword(undefined4 param_1)<br> {<br>   int iVar1;<br>   char local_108c [128];<br>   char local_100c [4096];<br>   CustomCopy(local_100c,param_1);<br>   // constructs the password from the strings and stores it in<br>   // local_108c <br>   GeneratePassword(s_THEPASSWORDISEASYTOCRACK_08049960,local_108c);<br>   iVar1 = strcmp(local_108c,local_100c);<br>   if (iVar1 == 0) { // passwords are equal<br>     puts(&quot;Is not the good password !&quot;);<br>   }<br>   else {<br>     printf(&quot;Good work, the password is : \n\n%s\n&quot;,local_108c);<br>   }<br>   return;<br> }</pre><p>That’s all!</p><p>Now we run the program. In other tools we just save the file and it works, but in Ghidra it seems that we need to export it.</p><p>To export the program, we go to File -&gt; Export Program (O). We change the format to binary and click OK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*cuFxke3_dEqs74w0c--UPg.png" /></figure><p>I get the exported program on my desktop but it doesn’t work — I couldn’t manage to run the exported program. After trying to read it’s header with the readelf -h program, I get the following output:</p><pre>root@DESKTOP:/mnt/c/users/denis/Desktop# readelf -h Crack.bin<br> ELF Header:<br>   Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00<br>   Class:                             ELF32<br>   Data:                              2&#39;s complement, little endian<br>   Version:                           1 (current)<br>   OS/ABI:                            UNIX - System V<br>   ABI Version:                       0<br>   Type:                              EXEC (Executable file)<br>   Machine:                           Intel 80386<br>   Version:                           0x1<br>   Entry point address:               0x8048440<br>   Start of program headers:          52 (bytes into file)<br>   Start of section headers:          2848 (bytes into file)<br>   Flags:                             0x0<br>   Size of this header:               52 (bytes)<br>   Size of program headers:           32 (bytes)<br>   Number of program headers:         7<br>   Size of section headers:           40 (bytes)<br>   Number of section headers:         27<br>   Section header string table index: 26<br> readelf: Error: Reading 1080 bytes extends past end of file for section headers</pre><p>Shame. It looks like Ghidra has messed up the <a href="https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header">file header</a>… and, right now I don’t want to manually fix headers. So I fired up another tool and applied the same patches to the file, saved it, ran it with a random argument and validated the flag.</p><h4>Conclusions</h4><p>Ghidra is a nice tool with a lot of potential. In its current state, it’s not that great but it works. I’ve also encountered a weird scrolling bug while running it on my laptop.</p><p>The alternatives would be to pay $$ for other tools of this kind, make your own tools, or work with free but not so user friendly tools.</p><p>Let’s hope that once the code is released, the community will start doing fixes and improve Ghidra.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7e793c5acd2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-i-solved-a-simple-crackme-challenge-with-the-nsas-ghidra-d7e793c5acd2">How I solved a simple CrackMe challenge with the NSA’s Ghidra</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a simple DNS server]]></title>
            <link>https://medium.com/nuculabs/setting-up-a-simple-dns-server-859de750f6fe?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/859de750f6fe</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Sat, 23 Feb 2019 14:24:07 GMT</pubDate>
            <atom:updated>2019-02-23T14:24:07.324Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kzV6xOoPNcJl2lsAMiiIlA.jpeg" /></figure><p>Right after I’ve configured <a href="https://medium.com/@MetonymyQT/setting-up-an-anonymous-ftp-server-775a258d1395">the FTP server</a>, I wanted to be able to “name” my server and so I’ve installed a lightweight DNS server.</p><blockquote>“dnsmasq is a lightweight DNS, TFTP, PXE, router advertisement and DHCP server. It is intended to provide coupled DNS and DHCP service to a LAN.”</blockquote><p>I’ve chosen this over the bind 9 dns server because it was very easy to setup, I almost got it right the first time.</p><p>To install and configure dnsmasq, you’d usually do the following:</p><pre># On Ubuntu<br>sudo apt-get install dnsmasq<br>sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.orig</pre><p>And override<strong> /etc/dnsmasq.conf</strong> with this configuration:</p><pre>#/etc/dnsmasq.conf<br>domain-needed<br>bogus-priv</pre><pre>expand-hosts<br> <br># The address 192.168.0.176 is the static IP of this server <br># You can find this ip by running ifconfig and look for the <br># IP of the interface which is connected to the router.<br>listen-address=127.0.0.1<br>listen-address=192.168.0.176<br>bind-interfaces<br> <br># Use open source DNS servers<br>server=8.8.8.8<br>server=8.8.4.4<br>server=208.67.220.220<br> <br># Create custom &#39;domains&#39;.<br># Custom &#39;domains&#39; can also be added in /etc/hosts<br>address=/busyserver.net/192.168.0.176</pre><p>And that’s basically it.</p><p>You can check the status of dnsmasq server by running: sudo systemctl status dnsmasq.</p><p>To actually use the server and make your computer recognize your custom domains you need to tell your computers to use the IP of the server on which dnsmasq is installed, in my case it is 192.168.0.176.</p><p>Thank you for reading!</p><p><a href="https://twitter.com/denisnutiu">Twitter</a> | <a href="https://m.do.co/c/22f012126c25">DORefferal</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=859de750f6fe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nuculabs/setting-up-a-simple-dns-server-859de750f6fe">Setting up a simple DNS server</a> was originally published in <a href="https://medium.com/nuculabs">NucuLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up an Anonymous FTP Server]]></title>
            <link>https://medium.com/nuculabs/setting-up-an-anonymous-ftp-server-775a258d1395?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/775a258d1395</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[file-sharing]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Fri, 22 Feb 2019 20:09:47 GMT</pubDate>
            <atom:updated>2019-02-22T20:09:47.823Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ND7KaK413kFB8D-kPUZpPQ.jpeg" /></figure><p>After spending a good part of my weekend fiddling with VSFTPD, I’m very happy that I managed to get it to work properly.</p><p>My goal was to create a simple, anonymous and private FTP server for my home network. It should facilitate sharing files between my machines.</p><h3>Configuring the Server</h3><p>If you’d like to try out my configuration all you need to do is look at the following commands and replace your configuration file with mine. The configuration file will be provided later in the article.</p><pre># For Ubuntu<br>sudo apt-get install vsftpd<br>cp /etc/vsftpd.conf /etc/vsftpd.conf.orig</pre><pre># Make the directories for the server<br>sudo mkdir -p /srv/vsftpd/root/public<br>sudo touch /srv/vsftpd/banner</pre><pre># Change permissions and set ownership<br>sudo chown -R ftp:ftp /srv/vsftpd/<br>sudo chmod -R 555 /srv/vsftpd/<br>sudo chmod 775 /srv/vsftpd/root/public</pre><pre># Edit the configuration file<br># /etc/vsftpd.conf with editor of choice</pre><pre># Restart the service and check the status<br>sudo systemctl restart vsftpd<br>sudo systemctl status vsftpd</pre><p>The configuration file vsftpd.conf that I use can be found below:</p><pre># Nucu Labs&#39;s BUSY vsFTPd server configuration file.<br># Denis Nutiu 09.02.2019</pre><pre># Scope of the server: The server is supposed to facilitate easy file sharing and should<br># be only available on the local network. No outside access is allowed!</pre><pre># The meaning of this configuration file and the full list of options can be found by<br># checking the manual page of vsftpd.</pre><pre>listen=NO<br>listen_ipv6=YES</pre><pre>### Debug Options</pre><pre># If enabled, a log file will be maintained detailing uploads and downloads. <br># By default, this file will be placed at /var/log/vsftpd.log,<br>xferlog_enable=YES</pre><pre># debug_ssl=YES<br># log_ftp_protocol=YES<br># syslog_enable=YES</pre><pre>###</pre><pre># If enabled, both the usernames ftp and anonymous are recognised as anonymous logins.<br>anonymous_enable=YES</pre><pre># This option represents a directory which vsftpd will try to change into after an anonymous login. <br># Failure is silently ignored.<br>anon_root=/srv/vsftp/root<br>local_root=/srv/vsftp/root<br>allow_writeable_chroot=YES</pre><pre># Enable local users to login to the FTP.<br>local_enable=NO</pre><pre># This option is the name of a file containing text to display when someone connects to the server.<br>banner_file=/srv/vsftp/banner</pre><pre># When enabled, this prevents vsftpd from asking for an anonymous password <br># - the anonymous user will log straight in.<br>no_anon_password=YES</pre><pre># If set to YES, anonymous users will be permitted to create new directories under certain conditions.<br># For this to work, the option write_enable must be activated, <br># and the anonymous ftp user must have write permission on the parent directory.<br>anon_mkdir_write_enable=YES</pre><pre># If set to YES, anonymous users will be permitted to perform write operations <br># other than upload and create directory, such as deletion and renaming. <br># This is generally not recommended but included for completeness.<br>anon_other_write_enable=YES</pre><pre># If set to YES, anonymous users will be permitted to upload files under certain conditions.<br>anon_upload_enable=YES</pre><pre># When enabled, anonymous users will only be allowed to download files which are world readable.<br>anon_world_readable_only=YES</pre><pre># If enabled, all anonymously uploaded files will have the ownership changed <br># to the user specified in the setting chown_username<br>chown_uploads=YES<br>chown_username=ftp<br>nopriv_user=ftp</pre><pre>delete_failed_uploads=YES</pre><pre># If enabled, users of the FTP server can be shown messages when they first enter <br># a new directory. By default, a directory is scanned for the file .message.<br>dirmessage_enable=YES</pre><pre># If enabled, all user and group information in directory listings will be displayed as &quot;ftp&quot;.<br>hide_ids=YES</pre><pre># Allows: STOR, DELE, RNFR, RNTO, MKD, RMD, APPE and SITE.<br>write_enable=YES</pre><pre># Upload files are executable.<br>chown_upload_mode=0777<br>file_open_mode=0777<br>local_umask=002<br>anon_umask=002</pre><pre>###</pre><pre># Use the system&#39;s local time in GMT.<br>use_localtime=YES</pre><pre># This option should be the name of a directory which is empty.  Also, the<br># directory should not be writable by the ftp user. This directory is used<br># as a secure chroot() jail at times vsftpd does not require filesystem<br># access.<br>secure_chroot_dir=/var/run/vsftpd/empty</pre><pre># This string is the name of the PAM service vsftpd will use.<br>pam_service_name=vsftpd</pre><pre># Uncomment this to indicate that vsftpd use a utf8 filesystem.<br>utf8_filesystem=YES</pre><p>Using this setup will give you a fully working anonymous VSFTPD server. BUT WAIT! Make sure that you don’t expose the server to the internet! Keep it for private use only, since the server is anonymous everyone can download and upload files.</p><h3>Troubleshooting Server Problems</h3><p>I had lots of trouble getting the permissions right, if you don’t get the permissions right you’ll find yourself unable to upload files, download them, create directories or cd into directories.</p><p>The most common error I encountered was <strong>Writable root. Owner of the chroot() is root and has write permissions.</strong> This was fixed by removing the write permission from the /<strong>srv/vsftpd/root </strong>directory.</p><p>Another thing you may want is to add your user to the <strong>ftp</strong> group. I did miss the <strong>-a</strong> when I added myself and I ended up removing myself from all groups, except the ftp group. I had to boot Ubuntu in Recovery Mode, get a root shell and add myself back to sudo as well as other administrative groups. To add yourself to the ftp group, you can safely copy paste the following command: sudo usermod -a -G ftp $USER.</p><p>If the banner file (the one created with the touch command above) is not existent or permissions are insufficient, the server won’t start.</p><h3>Troubleshooting Client Problems</h3><p>To be honest I haven’t used FTP that much. Everytime you connect to the VSFTPD server you should do so in passive mode, this means that the server will open another socket when doing an operation instead of initializing a connection to you (the client), if you don’t use passive FTP mode, you’ll get a prompt from your firewall to allow the FTP client to pass through. To connect using passive FTP, you should run: ftp -p ftp_server_ip_or_alias</p><p>When uploading images, pdfs or other binary files, you’ll need to issue the <strong>binary</strong> command in your FTP client, before the <strong>put</strong>, otherwise things are going to get messy and the binary file will get corrupted.</p><h3>Conclusions</h3><p>I had great fun installing and configuring VSFTPD, also writing this article. If you need anymore help with VSFTPD I suggest visiting the <a href="https://wiki.archlinux.org/index.php/Very_Secure_FTP_Daemon">Arch Linux wiki page</a>, it contains a great deal of information.</p><p>Thank you for reading and have a great day!</p><p>This article is part of my Homelab series, you may want to check out my previous post: <a href="https://medium.com/nuculabs/my-homelab-journey-introduction-479d7c1883b7">My Homelab Journey: Introduction</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=775a258d1395" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nuculabs/setting-up-an-anonymous-ftp-server-775a258d1395">Setting up an Anonymous FTP Server</a> was originally published in <a href="https://medium.com/nuculabs">NucuLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Homelab Journey: Introduction]]></title>
            <link>https://medium.com/nuculabs/my-homelab-journey-introduction-479d7c1883b7?source=rss-973ac43d4621------2</link>
            <guid isPermaLink="false">https://medium.com/p/479d7c1883b7</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[ideas]]></category>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[homelab]]></category>
            <dc:creator><![CDATA[Denis]]></dc:creator>
            <pubDate>Fri, 22 Feb 2019 19:56:43 GMT</pubDate>
            <atom:updated>2019-02-22T19:56:43.524Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KXHzLSVAKdrsNeGzG6cbDg.jpeg" /></figure><p>Hello everyone!</p><p>After following the <a href="https://www.reddit.com/r/homelab/">/r/homelab</a> reddit for a while I’ve decided to give it a try and make myself my own homelab environment. I don’t have access to expensive server equipment nor do I have the means to acquire it, so I will be using an old HP Laptop which has quite a few resources, it is a bit stronger than the average Raspberry PI.</p><p>The laptop has 11GB of RAM memory, a 740GB disk and an Intel i7–4702MQ CPU. I have it for almost 4 years now and I’ve only used it for a few months, I decided to re-purpose it. If you’re asking yourself why didn’t I used the laptop, well, the laptop is absolutely horrible to work with! HP has made a terrible consumer product, it wasn’t targeted to business users and it is sluggish (with windows) and made of cheap plastic. On Windows HP has failed to provide basic working drivers, the laptop freezes every minute or so.</p><h3>The Busy Server</h3><p>This will be the name of my new server Busy Server. The name was chosen because I plan to host all the services on this machine, for now.</p><p>For starting I’m going to put a DNS server, an OpenSSH server, an FTP server and a media server. In the future I’ll think about other services that might benefit me.</p><p>The DNS server’s purpose is to allow me to access the other resources in a more friendly manner, like ftp.busyserver.net instead if 192.168.0.*</p><p>The FTP server will be an anonymous server to facilitate easy file sharing in the local network, it won’t have any outside access.</p><p>The media server will be unused, for now. A potential use case for it would be to get a Chromecast and use it to watch movies together with my family, but I’m not even sure if I need a media server.</p><h3>Cloud Services</h3><p>I currently still rely on multiple cloud services for work.</p><p>There’s a few cloud services that I like a lot and I use them daily. I’m not ready to make the move from them to my own self-hosted alternatives. Some of these services are Trello, Slack, Dropbox, Github and Evernote.</p><p>Trello is a great tool for productivity, it gives me space to host my scrum boards, I don’t do any planning on it although I’ve heard about people that follow an agile lifestyle and plan their entire month using agile boards. I use Trello mostly to store programming notes and other technical stuff. I like the fact that I can invite other people to my boards and collaborate with them, but a huge turn-off is that it feels a bit weird to use when storing large notes, it’s not really meant for reading but I guess it could do for now. A replacement for it would be a 10$ Jira server license or another alternative.</p><p>Dropbox is the place where is store all the files that I need to take with me. Those files can be documents, books, software licenses and small programs. Of course they are encrypted with my personal GPG key so don’t even think about it.</p><p>While Slack is quite new to the scene, I’m thinking in making my own private work-space that I’ll share with my family members and perhaps close friends. In the future, I will attempt to compliment this with custom Slack apps, that will aid in home automation and status reporting, it’s going to be fun.</p><p>Evernote is my standard application for taking notes, it’s not perfect, but it works. I’m not going to pay for it (ever), I’d rather use simple markdown files if it goes this far. Evernote could be replaced with a MediaWiki or DokuWiki but since I rely on my notes a lot this won’t happen very soon.</p><p>Those are my plans for now, I also have a <a href="https://medium.freecodecamp.org/running-your-own-openvpn-server-on-a-raspberry-pi-8b78043ccdea">nice VPN raspberry pi server setup </a>that allows me to access my LAN network from outside.</p><p>What do you think about my plans? Do you I could make use of other interesting services? Let me know in the comments if so.</p><p>Thank you for reading and have a nice day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=479d7c1883b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nuculabs/my-homelab-journey-introduction-479d7c1883b7">My Homelab Journey: Introduction</a> was originally published in <a href="https://medium.com/nuculabs">NucuLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>