<?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 Wai Hon Law on Medium]]></title>
        <description><![CDATA[Stories by Wai Hon Law on Medium]]></description>
        <link>https://medium.com/@whhone?source=rss-72ac130389a6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*WeOSVRYalWibBkimTqZN2g.jpeg</url>
            <title>Stories by Wai Hon Law on Medium</title>
            <link>https://medium.com/@whhone?source=rss-72ac130389a6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 01:37:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@whhone/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[Kubernetes for Personal Project]]></title>
            <link>https://medium.com/@whhone/kubernetes-for-personal-project-3209eb0da684?source=rss-72ac130389a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3209eb0da684</guid>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Wai Hon Law]]></dc:creator>
            <pubDate>Sun, 29 Dec 2019 17:53:07 GMT</pubDate>
            <atom:updated>2019-12-29T18:09:54.369Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you are reading this post and trying to set up Kubernetes for your personal projects, it will disappoint you.</em></p><p>Yesterday, I saw a very cool self-hosted project (<a href="https://github.com/ankicommunity/anki-sync-server">anki-sync-server</a>) and I would like to host it myself.</p><p>It had happened to me repeatedly that I hosted something (e.g., wordpress) and ended up giving them. It was mostly because I forgot the machine setup or the way those apps are being configured. They became burdens and I kill them to save the hosting cost.</p><p>However, technology keeps evolving! We now have Docker and Kubernetes for running portable containers. Configurations could be stored as Dockerfile in a git repository. The apps could be restored accurately. How cool it is to own a personal cluster? How cool it is to be able to launch random Docker containers in the cluster? It is just super cool, at least from a software engineer’s perspective.</p><p>Hence, I decided to set up a Kubernetes cluster on DigitalOcean this afternoon. My goal was to set up a cluster that allows me to launch whatever containers as easy as possible. My direction was to set up the Ingress and IngressController for routing the traffic to the right pod. If possible, I would try using NodePort instead of LoadBalancer [1] to avoid the extra $10 bucks per month.</p><p>Few hours past, I took a pause and went for a run. During the run, I concluded to give up. Here are the reasons.</p><p>First, the learning curve of Kubernetes is steep. That means the re-learning curve is also steep. Imagine that even if the cluster is set up today but I do not touch it for a few months (because I am focusing on other things or lift just does not allow me to spend more time on it), it is very likely that I will not be able to maintain it without going through a steep re-learning curve. It will likely become another burden that I choose to get rid of, again. The time I spent on setting up the cluster is gone.</p><p>Second, it is expensive for small project. Do you need a load balancer for an app that had very little QPS? It is just overkilled. You might argue that it is possible to avoid the load balancer [2]. However, these solutions (like setting up an extra Nginx with public IP as a proxy) are hacky to me. Hacky solutions increase the complexity / maintenance cost and thus more likely it becomes a burden in the future.</p><p>Everything comes with costs, the biggest is time, simply because it is limited. When you choose to do something, you are giving up another at the same time, inevitably. As of now, my priority is no longer playing with those self-hosted. Kubernetes is nice and all, but just not for me at this moment.</p><p>[1] <a href="https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types">https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types</a><br>[2] <a href="https://stackoverflow.com/questions/37792641/how-can-you-publish-a-kubernetes-service-without-using-the-type-loadbalancer-on">https://stackoverflow.com/questions/37792641/how-can-you-publish-a-kubernetes-service-without-using-the-type-loadbalancer-on</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3209eb0da684" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Deep Work Strategies]]></title>
            <link>https://medium.com/@whhone/my-deep-work-strategies-2e39cee64d29?source=rss-72ac130389a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e39cee64d29</guid>
            <category><![CDATA[deep-work]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Wai Hon Law]]></dc:creator>
            <pubDate>Sun, 28 Apr 2019 05:06:20 GMT</pubDate>
            <atom:updated>2019-04-28T05:09:11.634Z</atom:updated>
            <content:encoded><![CDATA[<p>I read the book “<a href="https://www.amazon.com/dp/B00X47ZVXM">Deep Work</a>” recently. Cal Newport (the author) expounded many strategies to train our brains and transform our work habits to place deep work at the core of the professional life.</p><p>I picked some of those and merged to my existing habits. Here is my version.</p><h4><strong><em>Wear an Active Noise Cancelling (ANC) Headphone</em></strong></h4><p>I am an open office worker and there is no retreat for deep work nearby. Instead, I wear a good headphone to keep myself isolated from the surrounding noise. Sometimes, I still get distracted when coworkers talk loud nearby but it is much better than wearing nothing.</p><h4><strong><em>Logging and Record Time Spent on Deep Work</em></strong></h4><p>I log the starting and ending time of deep work activities. This gives me an idea of the intensity of the day and time spent on each task. Without this kind of logging, it is easier to devolve time into shallow work.</p><h4><strong><em>Go Running in the Evening</em></strong></h4><p>On 80% of my workdays, I go for a run in the evening at 5:30pm. The benefits of exercising is tremendous and transcend the scope of deep work. However, in terms of deep work, it recharges my “directed attention”, let my “unconscious mind” to solve some hard problems.</p><h4><strong><em>Shutdown Ritual (Daily Review)</em></strong></h4><p>By the end of a workday, I go thought a review and ensure that there is no urgent items and everything is captured for revisit. This clears my mind for the night.</p><p>Here is my shutdown ritual:</p><ul><li>Clear my email inbox.</li><li>Clear my code reviews to unblock my peers. For large / complicated review, create a TODO for later.</li><li>Review bug (ticket) updates.</li><li>Review digital (Google Keep) and physical notebook.</li><li>Check my calendar events in the next few days.</li><li>Finally, review Org-Mode, a tool to organize my TODOs.</li></ul><p>I used to be a late person in the office but I am applying the “fixed-schedule productivity” in the book. After dinner, I will start the shutdown ritual and then go home immediately.</p><h4><strong><em>Memorize Vocabularies</em></strong></h4><p>Cal Newport suggested to “memorize a deck of cards” with the mind palace technique. I agree this is a good training for laser focused attention. For me, as a non-native, it is more practical to memorize English vocabularies. I use Anki to collect new vocabularies and memorize them with spaced repetition every night.</p><p>P.S., a few hundreds vocabularies were added to my Anki while reading “Deep Work”.</p><h4><strong><em>Spend more time on Reading</em></strong></h4><p>I have to admit that I basically don’t read in my first 28 years of life. I probably haven’t finished a single book in my first 5 years of career. For no particular reason, I start to read more in the 6-th year. And you are right, the latest book I had finished was “Deep Work”.</p><p>This greatly reduced my time spent on the shallows, like web surfing and social media.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e39cee64d29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[粵拼-倉頡-混打輸入法]]></title>
            <link>https://medium.com/@whhone/%E7%B2%B5%E6%8B%BC-%E5%80%89%E9%A0%A1-%E6%B7%B7%E6%89%93%E8%BC%B8%E5%85%A5%E6%B3%95-14e928f1dd6f?source=rss-72ac130389a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/14e928f1dd6f</guid>
            <category><![CDATA[倉頡]]></category>
            <category><![CDATA[rime]]></category>
            <category><![CDATA[粵拼]]></category>
            <category><![CDATA[廣東話]]></category>
            <dc:creator><![CDATA[Wai Hon Law]]></dc:creator>
            <pubDate>Mon, 06 Aug 2018 05:50:36 GMT</pubDate>
            <atom:updated>2019-03-16T19:35:11.051Z</atom:updated>
            <content:encoded><![CDATA[<p>廣東話雖然係我母語，但係一直無好好咁學廣東話拼音，當年中大教過幾堂，不過平時無用就自然唔記得。既然係咁，不如試下平時都用廣東話拼音打中文，一黎精神上支持下愈黎愈弱勢嘅廣東話，二黎順便學下廣東話拼音。不過，廣東話拼音用係上黎有兩個問題。</p><p>第一：廣東話拼音有幾多方案，流行的至少都有幾個（如<a href="https://zh-yue.wikipedia.org/wiki/%E9%A6%99%E6%B8%AF%E8%AA%9E%E8%A8%80%E5%AD%B8%E5%AD%B8%E6%9C%83%E7%B2%B5%E8%AA%9E%E6%8B%BC%E9%9F%B3%E6%96%B9%E6%A1%88">粵拼</a>，<a href="https://zh-yue.wikipedia.org/wiki/%E8%80%B6%E9%AD%AF%E7%B2%B5%E8%AA%9E%E6%8B%BC%E9%9F%B3">耶魯</a>，<a href="https://zh-yue.wikipedia.org/wiki/%E6%95%99%E8%82%B2%E5%AD%B8%E9%99%A2%E6%8B%BC%E9%9F%B3%E6%96%B9%E6%A1%88">教院</a>）。咁中大個 <a href="https://humanum.arts.cuhk.edu.hk/Lexis/lexi-can/"><strong>粵語審音配詞字庫</strong></a><strong> </strong>用粵拼，我就用粵拼先，唔識都可以上去查。然後就裝 <a href="https://github.com/rime/rime-jyutping">rime-jyutping</a> 試下手。</p><p>第二：粵拼輸入法唔係識講就識打，而係要識我唔識嘅粵拼。咁我唔識拼又點會打得順呢？遇到唔識打嘅字就唯有轉返用倉頡，上網查拼音，成日轉黎轉去好無效率。</p><p>原來 rime 係支持混打功能，即係無縫咁同時用兩種輸入法，平時就盡量用粵拼，遇到唔識嘅字就直接當倉頡打，再睇返加記住個拼音。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/185/1*hEWC-Z1tPgXkLMWhNFfowQ.png" /><figcaption>唔識“香”點拼，用倉頡，原來係 hoeng</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/102/1*I-ScWBiIFyMIVszD2jJFwA.png" /><figcaption>學識左，下次就用 hoeng</figcaption></figure><p>理論上我應該愈黎愈唔需要依賴倉頡，同時學識粵拼。</p><p>配置方面，<a href="https://github.com/rime/rime-jyutping">rime-jyutping</a> 預設係 粵拼-普拼-混打，對倉頡/速成流嘅香港人黎講唔太 make sense，可以加個 jyutping.custom.yaml 去改返做粵拼-倉頡-混打。</p><pre><em># ~/.config/ibus/rime/jyutping.custom.yaml</em><br>patch:<br>  abc_segmentor:              # 唔洗用 prefix &quot;`&quot; 就可以混打<br>    extra_tags:<br>      - reverse_lookup    </pre><pre>reverse_lookup:<br>    dictionary: cangjie5      # 用倉頡<br>    prefix: &quot;`&quot;<br>    suffix: &quot;&#39;&quot;<br>    tips: 〔倉頡〕<br>    preedit_format:<br>      - &quot;xlit|abcdefghijklmnopqrstuvwxyz|日月金木水火土竹戈十大中一弓人心手口尸廿山女田難卜符|&quot;</pre><p><em>注意：唔同操作系統有唔同嘅「</em><a href="https://github.com/rime/home/wiki/UserData#%E4%BD%8D%E7%BD%AE"><em>Rime 用戶文件夾</em></a><em>」：</em></p><ul><li>小狼毫（Windows 版本）： 用戶文件夾的默認路徑爲 %APPDATA%\Rime。也可以通過「開始菜單＼小狼毫輸入法＼用戶文件夾」打開。</li><li>鼠鬚管（Mac 版本）： 用戶文件夾的路徑爲 ~/Library/Rime。也可以通過「系統輸入法菜單／鼠鬚管／用戶設定…」打開。</li><li>ibus-rime: ~/.confg/ibus/rime</li><li>fcitx-rime: ~/.confg/fcitx/rime</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14e928f1dd6f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[24]]></title>
            <link>https://medium.com/@whhone/24-cc42bb43fefe?source=rss-72ac130389a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc42bb43fefe</guid>
            <dc:creator><![CDATA[Wai Hon Law]]></dc:creator>
            <pubDate>Tue, 24 Feb 2015 08:44:14 GMT</pubDate>
            <atom:updated>2018-06-23T21:58:16.705Z</atom:updated>
            <content:encoded><![CDATA[<h3>合 24</h3><p>就是 4 個數，加減乘除組成 24。例如</p><blockquote><strong>( 3 , 7 , 2 , 1 ) =&gt; 3 * ( 7 + 2–1 )</strong></blockquote><p>小時候很喜歡玩這玩意，其實難題都是那幾道，都是那幾招，講心得之前，先讓聰明的讀者試試這七道世紀難題。</p><blockquote><strong>( 1 , 3 , 9 , 10 )</strong><br><strong>( 4 , 4 , 10 , 10 )</strong> <strong>( 1 , 5 , 5 , 5 )</strong> <strong>( 3 , 3 , 7 , 7 )<br>( 4 , 4 , 7 , 7 )<br>( 3 , 3 , 8 , 8 )<br>( 1 , 4 , 5 , 6 )</strong></blockquote><p>在下即管把難題分成甲乙丙三類。</p><h3><em>丙類難題：</em></h3><blockquote><strong>( 1 , 3 , 9 , 10 ) =&gt; ( 1 + 10 ) * 3–9<br>( 4 , 4 , 10 , 10 ) =&gt; ( 10 * 10–4 ) / 4</strong></blockquote><p>這類題目的答案很簡單，但不易想出來，因為解法是唯一的，非用那個該死的解法不可。</p><h3><em>乙類難題：</em></h3><blockquote><strong>( 1 , 5 , 5 , 5 ) =&gt; 5 * ( 5–1 / 5 )</strong><br><strong>( 3 , 3 , 7 , 7 ) =&gt; 7 * ( 3 + 3 / 7 )</strong><br><strong>( 4 , 4 , 7 , 7 ) =&gt; 7 * ( 4–4 / 7 )</strong></blockquote><p>這類題目的特點是被除數不能被整除，然後通常讓人覺得是「茅招」，「不可以用分數小數」，分數即是除數嘛。um… 聰明的讀者應該已經發現乙類題目的共通點。</p><p><strong>( 1 , 5 , 5 , 5 )</strong> 如果少了一個 <strong>5</strong>，就是<strong> 5 * 5–1</strong>； <strong>( 3 , 3 , 7 , 7 )</strong> 如果少了一個 <strong>7</strong>，就是<strong> 3 * 7 + 3</strong>； <strong>( 4 , 4 , 7 , 7 )</strong> 如果少了一個 <strong>7</strong>，就是 <strong>4 * 7–4</strong>；</p><p>所以呢，因為 <strong>2 * 9 + 6 = 24</strong>，我也可以輕易出一道「分數」題，硬要加上一個 <strong>9</strong>。</p><blockquote><strong>( 2 , 6 , 9 , 9 ) =&gt; 9 * ( 2 + 6 / 9 )</strong></blockquote><p>就是這麽簡單。</p><h3><em>甲類難題：</em></h3><blockquote><strong>( 3 , 3 , 8 , 8 ) =&gt; 8 / ( 3–8 / 3 )</strong><br><strong>( 1 , 4 , 5 , 6 ) =&gt; 4 / ( 1–5 / 6 )</strong></blockquote><p>需要多一點大膽一點的想像力，我覺得除非是天才，否則很難一分鐘內想出來。這類難題數量不多，4 個數字都比 10 小的題目之中就只有這兩個例子，記住就好。</p><p>從此，世間上就沒有合 24 的問題可以難到聰明的讀者了。</p><p>啊，其實 <strong>( 1 , 4 , 5 , 6 ) </strong>還有第有第二個解法的，聰明的讀者或者已經想到，不在這兒說了。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc42bb43fefe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>