<?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 Jethro Kuan on Medium]]></title>
        <description><![CDATA[Stories by Jethro Kuan on Medium]]></description>
        <link>https://medium.com/@jethroksy?source=rss-87c86fc31113------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TEWiJBsmV87AXoiE.jpeg</url>
            <title>Stories by Jethro Kuan on Medium</title>
            <link>https://medium.com/@jethroksy?source=rss-87c86fc31113------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 01:38:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jethroksy/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[A Year with NixOS]]></title>
            <link>https://medium.com/@jethroksy/a-year-with-nixos-113b534f446b?source=rss-87c86fc31113------2</link>
            <guid isPermaLink="false">https://medium.com/p/113b534f446b</guid>
            <category><![CDATA[nixos]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Jethro Kuan]]></dc:creator>
            <pubDate>Sun, 23 Sep 2018 07:09:15 GMT</pubDate>
            <atom:updated>2018-09-23T07:09:15.887Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been a Linux user for as long as I can remember (which goes up to 5 years now), and have experimented with many distros. I started out with Ubuntu and Fedora. I then migrated to Arch-based distributions like Manjaro, and back to vanilla Arch. Slightly over a year ago, a friend of mine convinced me to give NixOS a try. After a period of struggle, and 500 build generations later, NixOS has really grown on me.</p><h3>What is NixOS?</h3><p>NixOS is a Linux distribution which takes a unique approach to package and configuration management. Everything, down to the kernel, is built by the Nix package manager with a declarative functional build language. To the lay-user, this means that we get:</p><ol><li><strong>Atomic Upgrades</strong>: any changes are always revertible. Broke your system during an upgrade? Simply boot into the previous generation. This was a huge lifesaver several times, and would’ve been really handy while I was still on Arch.</li><li><strong>Full Reproducibility</strong>: I run NixOS on both my desktop and laptop. The configurations I use are almost identical for the two machines, less some driver installations. My setup is replicated across both machines. As an anecdote, with the combination of NixOS and stow (to manage my dotfiles), I setup my laptop within 30 minutes of a fresh install of NixOS.</li></ol><h3>Why NixOS stuck</h3><p>My full OS setup is simple: I only require Emacs and Firefox. Even then, I’ve found that when using other Linux distros, the state of the system slowly but surely deteriorates into a spaghetti-like mess. In NixOS, only sh and /usr/bin/env is available by default. Everything else is declaratively added into your root system. This way, I’m always aware of exactly what I have available on my system.</p><p>I do all sorts of OS experiments, like changing window managers. NixOS makes this a trivial one-line change. For example, when I experimented with several window managers, I tried out exwm, stumpwm, xmonad and ratpoison , all with just one-line changes:</p><pre>services.xserver.windowManager.xmonad.enable = true;<br>services.xserver.windowManager.stumpwm.enable = true;<br>services.xserver.windowManager.exwm.enable = true;</pre><p>If I don’t like the changes, I can easily revert my system state. Knowing that I’ll always have a build generation to boot back into allows me to experiment with peace of mind otherwise unattainable.</p><p>Declaratively specifying systemd services and timers also simplified my setup. For example, I use mbsync to fetch my email, and run it using systemd on a timer every 2 minutes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31c649c5a557460abbb926d091f670ae/href">https://medium.com/media/31c649c5a557460abbb926d091f670ae/href</a></iframe><p>I install the required packages, and ensure that executables like pass are available to the systemd service trivially through this declarative interface.</p><p>Programmatically editing content in my hosts file was also so simple. I fetch a text file from Github and write it into my hosts file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/577ee31ba74868ebde294090cdec8953/href">https://medium.com/media/577ee31ba74868ebde294090cdec8953/href</a></iframe><p>Maintaining my operating system has never been simpler!</p><h4>Development with NixOS</h4><p>As a student and software engineer, I spend a lot of my time writing and running code. NixOS allows me to have project specific dependencies, and ensures that my development environment is consistent across all my machines.</p><p>Using nix-shell, I’m able to create a development environment containing only the dependencies required. For example, I create a python environment containing only Python and some libraries with the following shell.nix file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ead287528abd22ae3837c43c16ae579/href">https://medium.com/media/0ead287528abd22ae3837c43c16ae579/href</a></iframe><p>I use nix-shell with <a href="https://direnv.net/">direnv</a>, so within Emacs and my shell, my executable paths and environment variables are set correctly when I’m working on a project, and when I switch projects.</p><h4>Pain Points</h4><p>When I first started using NixOS, documentation was sparse. It took me a long time to get used to the Nix language, and even after a year of use, Nix is still rather foreign to me. I faced a lot of difficulty initially trying to get my wireless dongle to play nice with NixOS (which ultimately required kmod and some hackery), and writing shell.nix files for setting up development environments.</p><p>Even when using a shell.nix file, the development environments are also only fully replicated if <a href="https://github.com/NixOS/nixpkgs">nixpkgs</a>, the repository specifying how packages are built, is pinned to a particular commit. This requires large amounts of space, which my desktop with a 128GB SSD cannot afford. In fact, because NixOS stores multiple generations and builds packages from specified dependencies, it is not uncommon for the nix store, which stores all built packages, to quickly grow in size. Fortunately for most people, storage space is hardly an issue. I live with it by keeping my operational environment minimal, and garbage-collecting frequently.</p><p>In addition, Nix does not follow the Filesystem Hierarchy Standard (FHS), which some applications do assume. This can be emulated with some Nix utilities, but this means extra work when trying to install and use applications. Many packages in Nixpkgs are manually patched so they can work in Nix.</p><p>If following the unstable channel of nixpkgs, which receives upgrades regularly, it is also common for a upgrade of the system to fail. Because Nix tries to only keep a single version of the same package in nixpkgs, upgrading this package could mean other packages depending on an older version of this package would fail. This is common in language-specific packages, such as Python. Hence, to use Nix properly as a development environment, I have to write my own derivations for packages that are broken. However, this is only because I only use nix to specify that I require packages, and not the versions of the packages I require.</p><h4>Conclusion</h4><p>NixOS is definitely a difficult operating system to get into, but it was well worth the effort for me. Through using NixOS, and reading the build specifications for packages in NixOS, I learnt a lot about the Linux itself. Now I have an operational system that I can replicate and rely on, which can last.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=113b534f446b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tac]]></title>
            <link>https://medium.com/@jethroksy/tac-41480bdbaa01?source=rss-87c86fc31113------2</link>
            <guid isPermaLink="false">https://medium.com/p/41480bdbaa01</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jethro Kuan]]></dc:creator>
            <pubDate>Mon, 17 Oct 2016 13:09:08 GMT</pubDate>
            <atom:updated>2016-10-17T13:09:08.856Z</atom:updated>
            <content:encoded><![CDATA[<p>A while ago, I was trying to fix a bug in the fzf plugin where it would treat multi-line code blocks as individual lines. The solution proposed by a user was to use cat to print out the history file and sed to clean up the results. This worked fine, since the history file was plain text.</p><p>I realized after a short period of usage that the history seemed reversed. I did some googling, and found tac.</p><p>tac is packaged with coreutils and is used to concatenate and print files in reverse. This came in extremely handy in this situation! What a gem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41480bdbaa01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building “Weight”]]></title>
            <link>https://medium.com/@jethroksy/building-weight-bd0dcf9d09ea?source=rss-87c86fc31113------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd0dcf9d09ea</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Jethro Kuan]]></dc:creator>
            <pubDate>Tue, 05 Apr 2016 00:00:00 GMT</pubDate>
            <atom:updated>2016-10-08T09:39:26.054Z</atom:updated>
            <content:encoded><![CDATA[<p>A while back, Vishnu, Kevan and I decided to build something. It didn’t matter what it was — we knew it would be fun.</p><h3>The Big Idea</h3><p>We called it <em>weight</em> for namesake, and intend to change it later.</p><p>Till this date, I remain unclear of the purpose it serves. Here are the few key functionalities it has:</p><ol><li>It measures weight</li><li>It pushes the values periodically to the web</li><li>There’s a native app to view the weight</li></ol><p>I’m not even going to try to convince you that it’s useful.</p><h3>The Parts in Brief</h3><p>The first item we needed was a load cell. Load cells send electric signals of a magnitude proportionate to the force being measured. These are commonly found in weighing scales and pressure sensors.</p><p>A typical load cell consists of four strain gauges, arranged in a Wheatstone bridge formation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*vYleOCNDEzDlyQxPhU_1RQ.png" /><figcaption>Wheatstone Bridge</figcaption></figure><p>Wheatstone bridges are electrical circuit structures, typically used to accurately measure an unknown electrical resistance.</p><p>However, it can also be used to vary the potential difference between two ends of a circuit, in a way that’s independent on the current that passes through it. Slight variations in strain alter the electrical resistance of the circuit. This in turn causes variations in the potential difference across the two ends of the Wheatstone bridge. This potential difference is the electrical signal produced by load cell.</p><p>The electrical signal produced by the load cell is typically of the magnitude of millivolts. Fluctuations in this range are insignificant. Thus, we needed an amplifier. Drawing power from a source, an amplifier replicates the input signal shape, and increases its amplitude. The amplifier would make the fluctuations from the load cell measurable from a input reader, like an Arduino.</p><p>Last but not least, we needed a WiFi module for connectivity to the web. A generic ESP8266 module would do, so we borrowed one from the office where I worked at.</p><h3>Obtaining the parts</h3><p>Individual electronic parts were costly. Vishnu and I made a trip down to Sim Lim Tower, and returned with absolutely nothing. A load cell cost 30 dollars there, and they didn’t sell the cheaper amplifiers we needed.</p><p>Hoping to scavenge the parts from a working product, we bought a weighing scale for 12 dollars.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2zz1WflvkkeK1VMVrO9TQ.jpeg" /><figcaption>Dismantled weighing scale we bought</figcaption></figure><p>We tried using the load cells from the weighing scale, but the metallic ends on the load cell were too small. Soldering the load cell onto wires needed skills or equipment that we didn’t possess, and we ended up burning the load cells.</p><p>Giving up, we bought the load cells and amplifier online.</p><p>These are the parts we ended up using:</p><ol><li>Load Cell — 10kg, Straight Bar</li><li>Load Cell — 20kg, Straight Bar (Backup)</li><li>HX711 Amplifier</li><li>Espresso Lite v1.0 beta (ESP Module)</li></ol><h3>Beginning Work</h3><p>We decided to have a mini-hackathon at my house one Saturday. Kevan arrived first, then Vishnu, an hour later. The heat must’ve gotten to us, for we spent most of the afternoon lazing around. Work only commenced when the sun begun to set.</p><p>The first step was connecting the Espresso to the computer. This was easy — Vishnu had a lot of experience with the Espresso. Next, we connected the load cell to the amplifier, which was in turn connected to the Espresso. We were then able to read the values from the Espresso. The value was in the tens of thousands, and didn’t resemble anything remotely useful. It’s time for calibration!</p><p>Remember that the electrical signal produced is linear to the amount of force applied on the strain gauge? Calibration was simple.</p><pre><em>value = gradient x weight + tare_constant</em></pre><p><em>tare_constant</em> was the initial value read with no weight on the load cell. This way, when not measuring anything, the value read would be 0. Next, we needed to calculate the value of <em>gradient</em>. I brought down weight plates weighing 1.25kg each, and placed them on top of the load cell one by one. The idea was obtain a graph with a few points, and calculate the gradient using excel.</p><p>However, the graph resembled a logarithmic equation: some attenuation in the increase in value was observed. We could not calculate a value of <em>gradient</em> that would be accurate across all weights.</p><p>A while had passed before we realized our mistake. We were treating the straight-bar load cell as a regular circular load cell, by placing weight directly on top of it. It operated differently, measuring weight by its deformation. It needed to be fixated onto a surface on one end, and have force applied on the other to measure the amount of force applied trying to “bend” it.</p><p>We had no wood to drill the load cell into, nor did we have screws of the correct size, so we had to work with a makeshift structure using scotchtape and some cardboard to prop it up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LKYZYJu_eXlbtZBNlSy3ng.jpeg" /><figcaption>Make-shift weighing scale</figcaption></figure><p>Hunger, as always, was haunting Vishnu, and we made it quick. The scotchtape could not hold the weight plates, so we tested that it worked with two iPhones. We drove out to Springleaf Prata in celebration, and also in part to satisfy Vishnu’s cravings.</p><h3>Connecting it to the Web</h3><p>Back from a tantalizing dinner, we were ready to finish it up. We split the workload — Vishnu was to resume work on the hardware, and use the ESP8266 module to send data to the web. I was to build the backend server, as well as persist the data sent by Vishnu to a database. Kevan was to get a quick prototype of an Android app working with App Inventor.</p><p>Using <a href="http://restify.com/">Restify</a> and <a href="https://github.com/Level/levelup">LevelDB</a>, I got the backend running quickly. This is a side effect of starting many (unfinished) mini projects. I opened a tunnel to my computer with <a href="https://ngrok.com/">ngrok</a>, allowing Vishnu to connect to my server over the Internet.</p><p>Vishnu had trouble sending data. My server was receiving POST requests from “weight”, but no data was coming through. I went over to take a look.</p><p>I was not familiar with Processing, the language used to program the Espresso. My inability to read the code was compounded by the function names Vishnu chose to use, like ReadLikeABoss or ReadLikeASuperBoss.</p><pre>float readLikeABoss() {<br>  float cool = (hx711.read() - tareFactor) / calibFactor;<br>  return (cool / 1000);<br>}</pre><pre>float readLikeASuperBoss(int repeat) {<br>  float cool = 0;<br>  for (int i = 0; i &lt; repeat; i++) {<br>    cool += (hx711.read() - tareFactor) / calibFactor;<br>    delay(10);<br>  }<br>  return (cool / repeat);<br>}</pre><pre>float printLikeASuperBoss(int repeat) {<br>  Serial.println(String(readLikeASuperBoss(repeat))<br>  + &quot; | TareFactor: &quot;<br>  + String(tareFactor)<br>  + &quot; | CalibFactor: &quot;<br>  + String(calibFactor));<br>}</pre><p>HTTP requests in Processing were (in my opinion) weirdly constructed. Using a library may have helped, but would occupy more space on the limited memory of the Espresso.</p><pre>String data = &quot;weight=&quot;+String(readLikeABoss()); data += &quot;&amp;id=james&quot;; String url = &quot;POST / HTTP/1.1\r\nHost: &quot;;<br>url += host;<br>url += &quot;\r\nConnection: close&quot;;<br>url += &quot;\r\nContent-Length: &quot; + String(data.length());<br>url += &quot;\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n&quot;;<br>url += data;<br>client.print(url);</pre><p>Once we corrected the typo in the POST request, we are able to get data transmitted to my server and stored periodically!</p><p>Meanwhile, App Inventor gave hell to Kevan. Support for parsing custom JSON was horrible, and writing a parser with code blocks was both exhausting and a waste of time.</p><p>He got that working, but we looked to building a native app with Javascript instead. Handling JSON data would be simpler in Javascript. JSON is, after all, Javascript Object Notation. We didn’t do much research, and went ahead with <a href="https://nativescript.org/">Nativescript</a>, because that’s what Vishnu recommended. Alternatives included <a href="https://facebook.github.io/react-native/">React Native</a> or <a href="http://ionicframework.com/">Ionic</a>. In retrospect, I think <a href="https://facebook.github.io/react-native/">React Native</a> would have been a better choice. Hybrid mobile development has come such a long way since I last touched it two years ago, and I was impressed with how Nativescript easily handled things, until I tried React Native the day after.</p><p>Setting up the Android environment was frustrating. Turns out the Android development environment is minimally 3 gigabytes big. I only had 20GB allocated to my root partition (&#39;/&#39;) and it was too full to accomodate the Android environment. We installed it on Vishnu’s laptop, leaving his laptop with 250mb of space.</p><p>It was already 1am, and Vishnu slowly but surely fell asleep. I say surely, because he was snoring really loudly. Kevan and I soldiered on.</p><p>We installed Nativescript and began by playing around with it. We followed some tutorials on fetching things from the web. Nativescript’s documentation was occasionally incorrect, and we had to experiment to get things working again.</p><p>3 hours later, we were finally able to fetch and display the latest value sent by “weight”. It was 4am, and we each had our own agendas the next day, so we decided to head to bed.</p><p>Vishnu’s incessant snoring kept me from sleeping. After tossing and turning for a while, I got up and resumed work on the application. I created a settings page that enabled fetching of values from a range of time. It also allowed changing the id of the product, as well as the URL it was fetching the data from.</p><p>2 hours later… it was complete!</p><p>The excitement was quickly smothered by exhaustion, and I went to sleep, overjoyed and overworked.</p><p>Building “weight” was fun, and as a first venture into the IoT space, it was smoother than I expected. All in a day’s work!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd0dcf9d09ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing Static Sites]]></title>
            <link>https://medium.com/@jethroksy/developing-static-sites-953c5d7a1ea7?source=rss-87c86fc31113------2</link>
            <guid isPermaLink="false">https://medium.com/p/953c5d7a1ea7</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jethro Kuan]]></dc:creator>
            <pubDate>Sun, 27 Mar 2016 00:00:00 GMT</pubDate>
            <atom:updated>2016-10-08T09:09:03.664Z</atom:updated>
            <content:encoded><![CDATA[<pre>python -m SimpleHTTPServer</pre><p>Some of you may be familiar with the line above.</p><p>It used to be my go-to server when developing static sites. It starts a web server, serving the files in the current directory.</p><p>I’m not a fan of Python, but it’s definitely a language that’s readily available in most operating systems. Most systems, including OSX, come with some version of Python preinstalled. Grab the SimpleHTTPServer Python module, and you’re good to go.</p><p>However, the Python server created is single-threaded, and can result in timeouts for large images and Javascript files. We can do better.</p><h3>The Prerequisites</h3><p>Let’s establish context. We’re working on static files. This means our folder would look like this:</p><pre>. <br>├── [4.0K] &quot;css&quot;/<br>├── [4.0K] &quot;images&quot;/<br>├── [4.0K] &quot;js&quot;/<br>└── [ 668] &quot;index.html&quot;</pre><p>The web server should be lightweight. We don’t need any extra cruft, such as injecting yaml configurations. This rules out the usual suspects (Jekyll, Hugo etc).</p><p>The code for the server and the static files must be kept separate. Static files should not contain references to development dependencies in the server. A good litmus test is getting someone to look at the static files. The person should not be able to infer what web server is being used. If I wanted <a href="http://livereload.com/">livereload</a>, the server should inject it programatically, rather than litter the webpage with dependencies that won’t be required during production.</p><p>The server should be portable. It should work anywhere, and ideally has few or no dependencies. This rules out servers like http-server, which depends on Node, and requires npm for ease of installation. Even the Python web server depends on the SimpleHTTPServer module, and that goes into my bad books.</p><h3>Using Go</h3><p>I’ve been learning Go recently, and thus far I love it. It’s fast, easy and cross-platform compatible.</p><p>In Go, creating a web server is effortless with just the standard libraries:</p><pre>package main <br>import(&quot;fmt&quot;&quot;log&quot;&quot;net/http&quot;)</pre><pre>func main(){<br>  fmt.Println(&quot;Serving files in the current directory on port 3000&quot;)<br>  http.Handle(&quot;/&quot;,http.FileServer(http.Dir(&quot;.&quot;)))<br>  err := http.ListenAndServe(&quot;:3000&quot;,nil)<br>  if err!=nil {<br>    log.Fatal(&quot;ListenAndServe: &quot;,err)<br>  }<br>}</pre><p>I can build the Go code into a binary, and copy it (I named it serve) into my project directory. Serving the static files can now be accomplished simply with ./serve:</p><pre>❯ ./serve serving /home/jethro/Code/jethrokuan.github.io on port 3000 GET / 200 10ms - 668 GET /css/styles.css 200 3ms - 1.48kb</pre><h3>Going Further</h3><p>Now, we have a complete replacement for python -m SimpleHTTPServer that’s both fast, portable, and has no dependencies.</p><p>What if you really wanted other features like livereload, or TLS support? Instead of reinventing the wheel, look to <a href="https://github.com/cortesi/devd">devd</a>.</p><p>If you have Go installed, you can download devd and build it. Alternatively, download the binary <a href="https://github.com/cortesi/devd/releases/latest">here</a>, and put it your PATH.</p><p>To serve the current directory with livereload enabled, simply type:</p><p>Happy hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=953c5d7a1ea7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Unspoken Social Contract]]></title>
            <link>https://medium.com/@jethroksy/the-unspoken-social-contract-3a34bf5187d1?source=rss-87c86fc31113------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a34bf5187d1</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jethro Kuan]]></dc:creator>
            <pubDate>Fri, 18 Mar 2016 00:00:00 GMT</pubDate>
            <atom:updated>2016-10-08T09:22:43.800Z</atom:updated>
            <content:encoded><![CDATA[<p>I haven’t been writing a lot recently, for I have instead been climbing volcanoes, and flying off motorbicyles. I’ve also had the pleasure of giving a talk at Paypal to a group of local developers, and joined the team at <a href="http://fisherman.sh/">Fisherman</a>.</p><p>Open-source work takes a huge slice of my free time. When people depend on the software you make, there is a form of social obligation to be on support 24/7. This involves resolving bug fixes on my phone, and having Hangouts with strangers at 3am in the morning. I have come to understand the burden of the social contract I’ve unknowingly signed.</p><p>Having no formal education in Computer Science, it’s likely that the code I write and publish is sub-par. Yet, every single line of code I’ve written has been made available for the world to see and copy, contributing to the demise of the quality of code in the wild.</p><p>Take <a href="https://github.com/fisherman/fisher-checker">fisher-checker</a> for example. It’s my first Go program, and it’s already deployed in production. People depend on it to function flawlessly. I’m still largely unaware of the intricacies and antiques of the language; I could well be using certain data types wrongly, or not have written idiomatic code, the latter I’m fairly certain to be guilty of. In addition, no tests have been written, and I have not seeked second opinions on what could be changed or improved. This way, I am knowingly partaking in behaviour that lead to bad code.</p><p>If you’re self taught like I am, studying publicly-available codebases is the best way to master the craft. Codebases like <a href="https://github.com/antirez/redis">Redis</a> teach you a lot about how to architect and build a program. I shamefully apologise to those using my piece of Go code as reference.</p><p>I think I’ve done a better job with <a href="https://github.com/fisherman/z">z</a>. I’ve written a comprehensive test suite that covers most use-cases. This can be attributed to the greater need for one; the plugin has a larger user base. I’ve also received a generous amount of help from Jorge Bucaran, the author of <a href="http://fisherman.sh/">Fisherman</a> himself. Despite garnering much animosity in the fish community, I believe he genuinely means good for it, and am grateful for his mentorship.</p><p>Without dwelving into the technical details, it suffices to say that I occasionally find myself making irresponsible changes to the codebase, with little consideration of the effect it has on my users. This stems from my work being thus far being solo projects, but these are mere excuses. You may think that it’s alright because it’s <em>my</em> codebase. It’s not. Nothing you put online for free is ever 100% yours.</p><p>In sum, I’ve learnt that regardless of content type, one has to assume the social responsibility of upholding integrity, accuracy and quality. The World Wide Web is like our ocean, and it’s already littered with trash. While cleaning up the ocean may be a herculean task, it all starts from the individual. It starts from you and I.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a34bf5187d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why You Shouldn’t Learn to Code]]></title>
            <link>https://medium.com/@jethroksy/why-you-shouldnt-learn-to-code-857134ccc692?source=rss-87c86fc31113------2</link>
            <guid isPermaLink="false">https://medium.com/p/857134ccc692</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Jethro Kuan]]></dc:creator>
            <pubDate>Sun, 14 Feb 2016 00:00:00 GMT</pubDate>
            <atom:updated>2016-10-08T09:26:53.257Z</atom:updated>
            <content:encoded><![CDATA[<p>This is both a manifestation of my frustration, and a sincere plea to those about to take their first step. The “everyone should learn how to code” movement has been taken too far.</p><p>Programming does not belong among reading, writing and arithmetic as essential skills. Learning to think like a programmer could be, but not programming.</p><p>Don’t get me wrong, I love programming. It has given me the ability to express certain ideas clearly, ideas so abstract it would be difficult or even impossible to do the same in spoken languages. This is not an ability you require. It would benefit you more to work on expressing yourself in the spoken languages, than to wrestle with a medium that takes years to master, and yet remain inapplicable.</p><p>“What’s a good language to begin with?”</p><p>“What do I have to learn to build a website?”</p><p>Wrong questions.</p><p>The first question you should ask yourself is: “Why do you want to learn programming?” Let’s address the possible answers.</p><h3>“I think it’s a good skill to learn”</h3><p>Why would you think so? In what way would learning how to program make your life better?</p><p>More importantly, what exactly does said “skill” refer to? Are you clear on the amount of effort required to learn said skill?</p><h3>“I like to build things”</h3><p>Websites like <a href="http://www.freecodecamp.com/">FreeCodeCamp</a> and <a href="https://www.codecademy.com/">Codecademy</a> claim to teach you how to code. In a couple of days, you’ll be able to make a website, and maybe even add some interactivity. Give yourself a pat on the back. You’ve built your first website.</p><p>Riding the momentum you gained from the sense of achievement, you dig in further. You learn the latest CSS frameworks to make your website prettier. You learn Javascript and jQuery to make things fly across the screen. Before you know it, months have gone by.</p><p>You take some time to reflect on what you’ve learnt. You can only think of one thing: how to make a decent website. Everything else is beyond your comfort zone and level of understanding. This skill is 90% orthogonal to whatever you’ll end up doing in the future.</p><p><strong>Programming is not about being able to code. It’s about being able to create solutions to existing problems.</strong> Nothing about making a website teaches you that. This methodology of introducing programming is fundamentally incorrect.</p><p><strong>Programming is hard</strong>. It’s not just hard, it’s boring. Websites like Codecademy lower the bar by showing the masses that it is easy to produce tangible products. Just because everyone can learn to code, doesn’t mean everyone should.</p><p>Heed my advice: <strong>don’t learn how to code. Learn how to solve problems</strong>.</p><h3>What programming really is</h3><p>Learning to program entails learning how to break down a problem, understanding the problem domain, thinking in the appropriate abstractions, and producing a concise solution. A programming language is just a tool to express the solution in a mathematical, machine-readable language. Problem-solving is the essential skill. It enhances critical thinking.</p><h3>So what now?</h3><p><a href="https://notendur.hi.is/hei2/teaching/Polya_HowToSolveIt.pdf">How To Solve It</a> is a great book on problem solving. It presents four principles of problem solving, and while presented in a mathematical context, remains highly applicable in other fields.</p><p>If you have a genuine interest in programming, <a href="https://mitpress.mit.edu/sicp/">SICP</a> is the greatest introductory course on programming by a long shot. It may seem a little dry, but the simplicity of the ideas presented will consistently blow your mind.</p><p>If looking merely to broaden your perspective on computational and mathematical theories, I highly recommend <a href="https://en.wikipedia.org/wiki/G%C3%B6del,_Escher,_Bach">The Eternal Golden Braid</a>, which serves this purpose well through the eclectic mix of Greek mythology, mathematics and music.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=857134ccc692" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[cli = ♥]]></title>
            <link>https://medium.com/@jethroksy/cli-763866ca2dc8?source=rss-87c86fc31113------2</link>
            <guid isPermaLink="false">https://medium.com/p/763866ca2dc8</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[cli]]></category>
            <dc:creator><![CDATA[Jethro Kuan]]></dc:creator>
            <pubDate>Tue, 09 Feb 2016 00:00:00 GMT</pubDate>
            <atom:updated>2016-10-08T09:40:35.095Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s amazing how much you can get done with the command line. I manage my music, sync my email, manage my agenda/todos (somewhat) in the command line. Disregarding how cool it might look to your friends, it provides unparalleled functionality and flexibility. Let’s get started.</p><h3>Music</h3><h4>beets</h4><p>I use <a href="http://beets.io/">beets</a> to manage my music. Among other things, it does these well:</p><ol><li>Fix metadata by matching the acoustic footprint of each song against the MusicBrainz database</li><li>Fetch album art and lyrics, adding them to the songs’ metadata</li><li>Search for missing tracks in albums</li><li>Manage the folder structure for your audio files</li></ol><p>Because I listen to random songs from everywhere, I import my songs as songs (rather than albums) with the -s flag. This copies the audio file into the appropriate location:</p><pre>beet import -s ~/Downloads</pre><p>This is the resultant folder structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*R-_JsEd2zD0-T2SOMcOX4Q.png" /><figcaption>Folder structure created by beets</figcaption></figure><p>Notice how it replaces illegal characters in the file system (AC/DC =&gt; AC_DC). This may seem minor, but it’ll save you a lot of time when backing up your files and realizing you have incompatible file/folder names. With beet I can guarantee that my music library is always neat and organized. Should you delete or edit some files, simply run beet up to update your local library.</p><p><a href="https://www.getsync.com/">BitTorrent Sync</a> pushes all the relevant changes to my phone, so my phone will always have the updated music library.</p><h3>ncmpcpp</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*HyrX7cWklQ4VftuFDmX3RQ.png" /><figcaption>ncmpcpp</figcaption></figure><p><a href="http://rybczak.net/ncmpcpp/">ncmpcpp</a> is a music player built with C++. It is highly configurable, and also has tag editing capabilities. Its killer feature is its incredibly simple song queue.</p><p>I have ncmpcpp bound to Ctrl-Alt-P, so when I activate the shortcut, it pops up instantly (one of the pros of it being cli-based is that it’s super light). Updated your database with beet recently? No problem! Just type u and the changes are immediately reflected. p to pause, &gt; to skip song, ~ to add random songs to the play queue. There’s also a music browser that lets you add whole albums or individual songs after the current song, or at the end of the playlist.</p><h3>Email</h3><p>If you’re using Gmail like me, consider using <a href="https://github.com/OfflineIMAP/offlineimap">offlineimap</a>. The problem with online email is that you have to trust the service providers that they don’t lose your email. offlineimap does two-way synchronization, so you’ll always have your email ready, even without an internet connection.</p><p>An additional benefit of having your email offline is that they can be indexed. I use mu, a mail indexer that makes searching for emails quick. mu4e provides me an interface on Emacs to interact with my email. Outlined <a href="http://pragmaticemacs.com/emacs/master-your-inbox-with-mu4e-and-org-mode/">here</a>, I handle emails in the same way:</p><ul><li>delete if it is rubbish</li><li>read and delete if it is not something I’ll need to revisit</li><li>read and archive if it is something I might need to look up again</li><li>reply and archive if it is something that will take less than a couple of minutes to reply to and I have the time</li><li>add to to-do list and archive if it is something that requires an action or just needs a longer reply than I have time to write</li></ul><p>The gif below demonstrates my workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*pRUWYH71MWgpaD12plY-DA.gif" /><figcaption>Email workflow with Emacs and OfflineIMAP</figcaption></figure><p>Having everything in one place really helps with organization.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=763866ca2dc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Mythical Man Month]]></title>
            <link>https://medium.com/@jethroksy/the-mythical-man-month-is-the-tour-de-force-of-fred-brooks-a-software-engineer-and-architect-who-b56f0a72019d?source=rss-87c86fc31113------2</link>
            <guid isPermaLink="false">https://medium.com/p/b56f0a72019d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Jethro Kuan]]></dc:creator>
            <pubDate>Sun, 07 Feb 2016 00:00:00 GMT</pubDate>
            <atom:updated>2016-10-08T09:02:28.408Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://en.wikipedia.org/wiki/The_Mythical_Man-Month"><em>The Mythical Man Month</em></a> is the <em>tour de force</em> of Fred Brooks, a software engineer and architect who is best known for managing the development of <a href="https://en.wikipedia.org/wiki/OS/360_and_successors">OS/360</a>. The book details the concept of a <strong>man-month</strong>, the hypothetical unit of measure for the amount of work completed by one person in one month. The enduring idea is summarised as such:</p><blockquote><em>The </em>man-month<em> is a myth; it is impossible to measure useful work in man-months.</em></blockquote><p>While dated, this book is among the most influential books ever written. Several points remain relevant in the programming industry:</p><ol><li>Good programs need time to formalize: projects more often than not go awry for lack of allocated time.</li><li>All programmers are optimists: Few difficulties are expected during implementation, because the medium in which we work in is inherently tractable.</li><li>Faulty ideas cause bugs more than faulty implementation.</li><li>“Adding manpower to a late software project makes it later” was later come to be known as <em>Brook’s Law</em>.</li><li>Effort increases with a greater number of people on a software project for a number of reasons, namely division of workload, effort in onboarding new members, and the need for effective communication.</li><li>A surgical team is small and sharp, with the best minds designing the system. The <strong>architect</strong> ensure conceptual integrity of system. Maintains high function to conceptual complexity ratio. Listens to implementer for architectural improvements. The <strong>implementer</strong> builds the system based on architectural design from architects. The discipline of following the system design should enhance, not hinder creativity. The <strong>editor</strong> ensures maximum clarity of documentation generated by the architect. This rework minimises miscommunication of ideas to implementers and testers. The <strong>testers</strong> form a dedicated team to test the software during the implementation process. This guarantees the integrity of the sytem. The <strong>language lawyers</strong> are well-acquainted with the intricacies of the language used. Able to see obscure but efficient ways of solving tricky problems. The <strong>program clerks</strong> are left in charge of clerical chores, such as paper work, logging results of the test suite etc.</li><li>Document your work: essential documents such as objectives, manual, schedule, organization chart, budget keep you on track.</li><li>Design your system keeping in mind its flaws. Do not over-design the second system. Recognize the flaws early (maybe even before the implementation phase) and correct them. Having a strong test suite to start with really helps.</li><li>Program maintenance is costly. Prepare your system for change. User needs and perceptions change all the time.</li><li>All repairs tend to destroy structure, increase the entropy and disorder of the system.</li><li>System debugging is a skill. Debug one system component at a time. Use components only when they are fully battle-tested.</li></ol><p>These are just some of my takeaways. I recommend the book to anyone who takes programming seriously.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b56f0a72019d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>