hexo_patrickwu.space.atom.xml - sfeed_tests - sfeed tests and RSS and Atom files
 (HTM) git clone git://git.codemadness.org/sfeed_tests
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       hexo_patrickwu.space.atom.xml (147619B)
       ---
            1 <?xml version="1.0" encoding="utf-8"?>
            2 <feed xmlns="http://www.w3.org/2005/Atom">
            3   <title>Patrick Wu&#39;s Blog</title>
            4   
            5   
            6   <link href="/atom.xml" rel="self"/>
            7   
            8   <link href="https://patrickwu.space/"/>
            9   <updated>2021-06-19T14:13:15.351Z</updated>
           10   <id>https://patrickwu.space/</id>
           11   
           12   <author>
           13     <name>Patrick Wu, Jinming</name>
           14     
           15   </author>
           16   
           17   <generator uri="https://hexo.io/">Hexo</generator>
           18   
           19   <entry>
           20     <title>Microsoft Build 2021: My Tiny Little Summary</title>
           21     <link href="https://patrickwu.space/2021/06/03/build-2021/"/>
           22     <id>https://patrickwu.space/2021/06/03/build-2021/</id>
           23     <published>2021-06-03T22:20:13.000Z</published>
           24     <updated>2021-06-19T14:13:15.351Z</updated>
           25     
           26     <content type="html"><![CDATA[<h2 id="tl-dr"><a class="markdownIt-Anchor" href="#tl-dr"></a> TL; DR</h2><p>Oh, look, a wild Microsoft Build appeared! The Microsoft Build this year was, you know, all virtual again. As a person who is more interested in .NET and WSL development, I find it disappointing that not much of Windows development is mentioned in the entire conference. It made me miss <a href="https://patrickwu.space/2019/05/10/build-2019/">Build 2019</a>. While I am still not recovered from my master’s study, my laptop died right during the Build conference; I can only provide a straightforward summary of this year’s Build. Well, I think let’s dive in.</p><div class="twitter-wrapper"><blockquote class="twitter-tweet"><a href="https://twitter.com/callmepkwu/status/1397623325560504329" target="_blank" rel="noopener"></a></blockquote></div><script async defer src="//platform.twitter.com/widgets.js" charset="utf-8"></script><h2 id="wsl"><a class="markdownIt-Anchor" href="#wsl"></a> WSL</h2><p>To my disappointment, there is not much new in this build. This build generally recapped everything we have so far, such as WSLg and ``wsl --install`. The only new thing I noticed is Visual Studio’s ability to debug using the browser in WSL using WSLg.</p><div class="twitter-wrapper"><blockquote class="twitter-tweet"><a href="https://twitter.com/callmepkwu/status/1397585583459868673" target="_blank" rel="noopener"></a></blockquote></div><script async defer src="//platform.twitter.com/widgets.js" charset="utf-8"></script><h2 id="net"><a class="markdownIt-Anchor" href="#net"></a> .NET</h2><p>The sessions about .NET is packed with information, although there is nearly 1-digit number of sessions about it. .NET Upgrade Assistant (Help upgrade .NET project to latest version) would be possibly a great tool for me to migrate my old projects to newer version, and .NET 6 with its Single stack (only one SDK, BCL, Toolchain for cross-platform) structure made it looks really promising.  Here is a quick sum up from the <a href="https://docs.microsoft.com/en-us/events/build-may-2021/azure/breakouts/od485/?ocid=AID3032299" target="_blank" rel="noopener">session</a>:</p><ul><li><p>C# 10</p><ul><li>Syntactic Simplications<ul><li>In-line comparison (Equals in <code>{}</code> in Writeline can be simplified to just <code>==</code>)</li></ul></li><li>Record structs<ul><li>record class/struct</li></ul></li><li>Improvements to lambdas and auto-properties<ul><li><code>init</code> for simple initialization</li><li><code>required</code> option for <code>init</code> items</li><li><code>=&gt;</code> for <code>init</code>, <code>get</code> and <code>set</code></li><li><code>!!</code> for check incoming variable</li><li><code>global using</code> for all dependency accorss</li><li><code>namespace &lt;name&gt;;</code>can be used instead of the old<code>namespace &lt;name&gt; {}</code></li></ul></li></ul></li><li><p>Web API (minimal)</p></li><li><p>.NET MAUI</p><ul><li><code>dotnet new maui</code></li><li>Speacial Resources type (Maui*)</li><li>Would be really great for some projects</li></ul></li><li><p>Blazor</p></li><li><p>WebAssembly ahead-of-time compilation</p></li><li><p>Error boundaries</p></li><li><p>Razor component type inference &amp; generic type constraints</p></li><li><p>Dynamic Components</p></li><li><p>Blazor state persistence during prendering</p></li><li><p>Fluent UI</p></li><li><p><a href="http://ASP.NET" target="_blank" rel="noopener">ASP.NET</a> Core</p><ul><li>Runtime<ul><li>HTTP/3</li><li>HTTP logging middleware</li><li>Shadow copying for IIS deployment</li><li>OpenTelementary support</li></ul></li><li>API<ul><li>Minimal APIs<ul><li><code>start.cs</code> is now optional</li><li>lambda support</li><li>provide experience similar to NodeJS</li></ul></li><li>Async streaming</li><li><code>IAsyncDisposable</code> support</li><li>gRPC client retries &amp; load balancing</li></ul></li><li>Web UI<ul><li>CSS isolation for Pages &amp; Views</li><li>Improved SPA support</li></ul></li></ul></li></ul><h1 id="other"><a class="markdownIt-Anchor" href="#other"></a> Other</h1><ul><li><a href="https://devblogs.microsoft.com/commandline/windows-package-manager-1-0/?utm_source=isaacl&amp;utm_medium=twitter&amp;utm_campaign=link&amp;WT.mc_id=link-twitter-isaacl" target="_blank" rel="noopener">winget 1.0</a></li><li>Visual Studio Hot Reload; this will save a lot of times for me</li><li>Project Reunion 0.8<ul><li>Provides UWP-like interface</li><li>MAUI+WinUI</li><li>1.0 will come with the notification feature</li></ul></li></ul>]]></content>
           27     
           28     <summary type="html">
           29     
           30       
           31       
           32         &lt;h2 id=&quot;tl-dr&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#tl-dr&quot;&gt;&lt;/a&gt; TL; DR&lt;/h2&gt;
           33 &lt;p&gt;Oh, look, a wild Microsoft Build appeared! The Microsoft Build
           34       
           35     
           36     </summary>
           37     
           38     
           39     
           40       <category term="C#" scheme="https://patrickwu.space/tags/C/"/>
           41     
           42       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
           43     
           44       <category term="Microsoft Build" scheme="https://patrickwu.space/tags/Microsoft-Build/"/>
           45     
           46       <category term="WSLg" scheme="https://patrickwu.space/tags/WSLg/"/>
           47     
           48   </entry>
           49   
           50   <entry>
           51     <title>Ubuntu 16.04 End-Of-Life on WSL: What you should do</title>
           52     <link href="https://patrickwu.space/2021/04/30/wsl-ubuntu1604-eol/"/>
           53     <id>https://patrickwu.space/2021/04/30/wsl-ubuntu1604-eol/</id>
           54     <published>2021-04-30T19:47:43.000Z</published>
           55     <updated>2021-06-19T14:13:15.355Z</updated>
           56     
           57     <content type="html"><![CDATA[<p>Ubuntu 16.04 LTS reached End-Of-Life today. This also means Ubuntu 16.04 on Windows also will get off from the Microsoft Store. For people who still use Ubuntu 16.04 on WSL, unless you have purchased <a href="https://ubuntu.com/security/esm" target="_blank" rel="noopener">ESM (Extended Security Maintainance)</a> as part of Ubuntu Advantage, you will not be able to upgrade packages on Ubuntu 16.04 LTS. If you still have a WSL instance running Ubuntu 16.04 LTS, you can take the following actions.</p><h2 id="move-ubuntu-1604-images-to-another-ubuntu-uwp"><a class="markdownIt-Anchor" href="#move-ubuntu-1604-images-to-another-ubuntu-uwp"></a> Move Ubuntu 16.04 images to another Ubuntu UWP</h2><p>As Ubuntu 16.04 is removed from the Microsoft Store, it is suggested to move your WSL system to another supported UWP version of Ubuntu:</p><ul><li><a href="https://www.microsoft.com/store/apps/9N9TNGVNDL3Q" target="_blank" rel="noopener">Ubuntu 18.04 LTS</a></li><li><a href="https://www.microsoft.com/store/apps/9n6svws3rx71" target="_blank" rel="noopener">Ubuntu 20.04 LTS</a></li><li><a href="https://www.microsoft.com/store/apps/9NBLGGH4MSV6" target="_blank" rel="noopener">Ubuntu</a></li></ul><p>Download one of them, open it once, and proceed to the following steps:</p><h3 id="export-and-remove-ubuntu-1604-lts"><a class="markdownIt-Anchor" href="#export-and-remove-ubuntu-1604-lts"></a> Export and Remove Ubuntu 16.04 LTS</h3><p>Export your current distro to a tarball:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wsl --export Ubuntu-16.04 ubuntu1604.tar</span><br></pre></td></tr></table></figure><p>It would be best if you also used this as a copy of your original Ubuntu 16.04 backup.</p><h3 id="install"><a class="markdownIt-Anchor" href="#install"></a> Install</h3><h4 id="for-ubuntu-2004-lts"><a class="markdownIt-Anchor" href="#for-ubuntu-2004-lts"></a> For Ubuntu 20.04 LTS</h4><p>Execute the following:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">wsl --unregister Ubuntu-20.04</span><br><span class="line">wsl --import Ubuntu-20.04 C:\Users\&lt;Your Windows Username&gt;\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState .\ubuntu1604.tar</span><br><span class="line">ubuntu2004.exe config --default-user &lt;Your WSL Username&gt;</span><br></pre></td></tr></table></figure><h4 id="for-ubuntu-1804-lts"><a class="markdownIt-Anchor" href="#for-ubuntu-1804-lts"></a> For Ubuntu 18.04 LTS</h4><p>Execute the following:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">wsl --unregister Ubuntu-18.04</span><br><span class="line">wsl --import Ubuntu-18.04 C:\Users\&lt;Your Windows Username&gt;\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState .\ubuntu1604.tar</span><br><span class="line">ubuntu1804.exe config --default-user &lt;Your WSL Username&gt;</span><br></pre></td></tr></table></figure><h4 id="for-ubuntu"><a class="markdownIt-Anchor" href="#for-ubuntu"></a> For Ubuntu</h4><p>Execute the following:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">wsl --unregister Ubuntu</span><br><span class="line">wsl --import Ubuntu C:\Users\&lt;Your Windows Username&gt;\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState .\ubuntu1604.tar</span><br><span class="line">ubuntu.exe config --default-user &lt;Your WSL Username&gt;</span><br></pre></td></tr></table></figure><p>And then you are done! Now we should upgrade your system to a supported one:</p><h2 id="upgrading-ubuntu-1604-to-the-latest-supported-version"><a class="markdownIt-Anchor" href="#upgrading-ubuntu-1604-to-the-latest-supported-version"></a> Upgrading Ubuntu 16.04 to the latest supported version</h2><p>You should still be able to upgrade to the latest supported version when this article is written. But if you miss the deadline, you should follow the following method to perform the release upgrade.</p><h3 id="update-sourceslist"><a class="markdownIt-Anchor" href="#update-sourceslist"></a> Update sources.list</h3><p>To begin the upgrade, make sure you have a <code>sources.list</code> like the following:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"># Required</span><br><span class="line">deb http:&#x2F;&#x2F;old-releases.ubuntu.com&#x2F;ubuntu&#x2F; xenial main restricted universe multiverse</span><br><span class="line">deb http:&#x2F;&#x2F;old-releases.ubuntu.com&#x2F;ubuntu&#x2F; xenial-updates main restricted universe multiverse</span><br><span class="line">deb http:&#x2F;&#x2F;old-releases.ubuntu.com&#x2F;ubuntu&#x2F; xenial-security main restricted universe multiverse</span><br><span class="line"></span><br><span class="line"># Optional</span><br><span class="line">#deb http:&#x2F;&#x2F;old-releases.ubuntu.com&#x2F;ubuntu&#x2F; CODENAME-backports main restricted universe multiverse</span><br></pre></td></tr></table></figure><p>You can use <code>-backports</code> and or <code>-proposed</code> if you want.</p><h3 id="dependencies"><a class="markdownIt-Anchor" href="#dependencies"></a> Dependencies</h3><p>It would help if you also made sure meta-package <code>ubuntu-wsl</code> is installed so the upgrade can continue without problems.</p><h3 id="run-the-upgrade"><a class="markdownIt-Anchor" href="#run-the-upgrade"></a> Run the upgrade</h3><p>After you’ve done the above, run the updates and then the upgrade as usually:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get update</span><br><span class="line">sudo apt-get dist-upgrade</span><br><span class="line">sudo do-release-upgrade</span><br></pre></td></tr></table></figure>]]></content>
           58     
           59     <summary type="html">
           60     
           61       
           62       
           63         &lt;p&gt;Ubuntu 16.04 LTS reached End-Of-Life today. This also means Ubuntu 16.04 on Windows also will get off from the Microsoft Store. For peopl
           64       
           65     
           66     </summary>
           67     
           68     
           69     
           70       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
           71     
           72       <category term="Ubuntu" scheme="https://patrickwu.space/tags/Ubuntu/"/>
           73     
           74   </entry>
           75   
           76   <entry>
           77     <title>Solving Native Docker(Not Docker Desktop) unable to start on Ubuntu 20.10+ on WSL</title>
           78     <link href="https://patrickwu.space/2021/03/09/wsl-solution-to-native-docker-daemon-not-starting/"/>
           79     <id>https://patrickwu.space/2021/03/09/wsl-solution-to-native-docker-daemon-not-starting/</id>
           80     <published>2021-03-09T15:47:28.000Z</published>
           81     <updated>2021-06-19T14:13:15.355Z</updated>
           82     
           83     <content type="html"><![CDATA[<p>Right now, you know you have two options to run docker on WSL2: You can</p><ol><li>Install using the package manager version;</li><li>Install using Docker Desktop for Windows and enable the WSL2 support.</li></ol><p>The option 2 would usually a great solution for users; but sometimes, we prefer option 1 to do some works more natively.</p><p>However, Recently we got a <a href="https://bugs.launchpad.net/ubuntu-wsl-integration/+bug/1908539" target="_blank" rel="noopener">bug report</a> that people could not use Docker on UoWCP (Ubuntu on Windows Community Preview, based on Ubuntu Hirsute Hippo (21.04)) as they cannot start the daemon.</p><p>Some investigation leads to an interesting find: When trying to run <code>dockerd</code>, it will throw an error:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">...</span><br><span class="line">INFO[2021-03-09T15:06:20.839195000+08:00] Loading containers: start.</span><br><span class="line">INFO[2021-03-09T15:06:20.885624800+08:00] stopping event stream following graceful shutdown  error&#x3D;&quot;&lt;nil&gt;&quot; module&#x3D;libcontainerd namespace&#x3D;moby</span><br><span class="line">INFO[2021-03-09T15:06:20.885865900+08:00] stopping healthcheck following graceful shutdown  module&#x3D;libcontainerd</span><br><span class="line">INFO[2021-03-09T15:06:20.886012400+08:00] stopping event stream following graceful shutdown  error&#x3D;&quot;context canceled&quot; module&#x3D;libcontainerd namespace&#x3D;plugins.moby</span><br><span class="line">failed to start daemon: Error initializing network controller: error obtaining controller instance: unable to add return rule in DOCKER-ISOLATION-STAGE-1 chain:  (iptables failed: iptables --wait -A DOCKER-ISOLATION-STAGE-1 -j RETURN: iptables v1.8.7 (nf_tables):  RULE_APPEND failed (No such file or directory): rule in chain DOCKER-ISOLATION-STAGE-1</span><br><span class="line"> (exit status 4))</span><br></pre></td></tr></table></figure><p>I noticed <code>iptables</code> being used is a <code>nftables</code> version. Turns out, Starting from version 20.10, Ubuntu switched the firewall system to <code>nftables</code> in like mentoned <a href="https://net2.com/ubuntu-20-10-comes-with-nftables-as-firewall/" target="_blank" rel="noopener">here</a>; But unfortunately, using <code>nftables</code> natively requires Linux Kernel 5.8, where the latest Kernel version for WSL is 5.4.</p><p>Fortunately, Ubuntu still have a legacy version of <code>iptables</code> kept in the system. To do it, you can simlpy use <code>update-alternatives --config iptables</code> to change it:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">$ sudo update-alternatives --config iptables</span><br><span class="line">There are 2 choices for the alternative iptables (providing &#x2F;usr&#x2F;sbin&#x2F;iptables).</span><br><span class="line"></span><br><span class="line">  Selection    Path                       Priority   Status</span><br><span class="line">------------------------------------------------------------</span><br><span class="line">* 0            &#x2F;usr&#x2F;sbin&#x2F;iptables-nft      20        auto mode</span><br><span class="line">  1            &#x2F;usr&#x2F;sbin&#x2F;iptables-legacy   10        manual mode</span><br><span class="line">  2            &#x2F;usr&#x2F;sbin&#x2F;iptables-nft      20        manual mode</span><br><span class="line"></span><br><span class="line">Press &lt;enter&gt; to keep the current choice[*], or type selection number: 1</span><br><span class="line">update-alternatives: using &#x2F;usr&#x2F;sbin&#x2F;iptables-legacy to provide &#x2F;usr&#x2F;sbin&#x2F;iptables (iptables) in manual mode</span><br></pre></td></tr></table></figure><p>Afterwards, restart the daemon and you will notice docker works normal again!</p>]]></content>
           84     
           85     <summary type="html">
           86     
           87       
           88       
           89         &lt;p&gt;Right now, you know you have two options to run docker on WSL2: You can&lt;/p&gt;
           90 &lt;ol&gt;
           91 &lt;li&gt;Install using the package manager version;&lt;/li&gt;
           92 &lt;li&gt;
           93       
           94     
           95     </summary>
           96     
           97     
           98     
           99       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
          100     
          101       <category term="Docker" scheme="https://patrickwu.space/tags/Docker/"/>
          102     
          103   </entry>
          104   
          105   <entry>
          106     <title>WSL powershell.exe Output Encoding Problem</title>
          107     <link href="https://patrickwu.space/2021/02/02/wsl-powershell-output-issue/"/>
          108     <id>https://patrickwu.space/2021/02/02/wsl-powershell-output-issue/</id>
          109     <published>2021-02-02T15:36:44.000Z</published>
          110     <updated>2021-06-19T14:13:15.355Z</updated>
          111     
          112     <content type="html"><![CDATA[<p>Well well well, here we go again.</p><p>I recently received a bug report that when there are umlauts in their username (<a href="https://github.com/wslutilities/wslu/issues/162" target="_blank" rel="noopener">wslutilities/wslu#162</a>), <code>wslusc</code> failed to copy the file. In his case, the username is “StephanHochdörfer,” and the output is the following:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">...</span><br><span class="line">[warn] wsl.ico not found in Windows directory. Copying right now...</span><br><span class="line">mkdir: cannot create directory &#39;&#x2F;mnt&#x2F;c&#x2F;Users&#x2F;StephanHochd\224rfer&#x2F;wslu&#39;: No such file or directory</span><br><span class="line">cp: cannot create regular file &#39;&#x2F;mnt&#x2F;c&#x2F;Users&#x2F;StephanHochd&#39;$&#39;\224&#39;&#39;rfer&#x2F;wslu&#39;: No such file or directory</span><br><span class="line">[info] wsl.ico copied. Located at &quot;&#x2F;mnt&#x2F;c&#x2F;Users&#x2F;StephanHochd�rfer&#x2F;wslu&quot;.</span><br><span class="line">...</span><br></pre></td></tr></table></figure><p><img src="https://cdn.patrickwu.space/memes/oh-no-anyway.jpeg" alt="Oh no! Anyway..." /></p><p>Oh no! Anyway, it’s related to the code page mess in our good old <code>powershell.exe</code> —- what a great sequel to our <a href="https://patrickwu.space/2019/08/03/wsl-powershell-raster-font-problem/">powershell raster font problem</a>.</p><p>From last time, we already get a pretty good structure that solves raster font, so we will expand from there:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">oemcp=$(reg.exe query <span class="string">"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage"</span> /v OEMCP 2&gt;&amp;1 | sed -n 3p | sed -e <span class="string">'s|\r||g'</span> | grep -o <span class="string">'[[:digit:]]*'</span>)</span><br><span class="line">chcp.com <span class="variable">$oemcp</span></span><br><span class="line">powershell.exe ... </span><br><span class="line">chcp.com 65001</span><br></pre></td></tr></table></figure><p><code>powershell.exe</code> has an interesting way in its input/output encoding, that it will follow the system code page. You can type <code>[Console]::OutputEncoding</code> and <code>[Console]::InputEncoding</code> in Powershell, and you can see what language/encoding/code page your console is currently using (Mine here is already corrupted during the debugging):</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/wsl-winps-encoding-1.png" alt="My messed up encoding" /></p><p>However, As we mentioned in <a href="https://patrickwu.space/2019/08/03/wsl-powershell-raster-font-problem/">powershell raster font problem article</a>, we need UTF-8 all the time. Thus, we can force input to follow your system language by using <code>[Console]::InputEncoding = [System.Text.Encoding]::GetEncoding(&lt;codepage&gt;)</code> command, where <code>codepage</code> is… well… code page; we can then force the output to use UTF-8 by using <code>[Console]::OutputEncoding = [System.Text.Encoding]::UTF8</code> command. Both commands should be executed before executing your command, so it should be something like this:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">powershell.exe ... -Command <span class="string">"[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEncoding(&lt;codepage&gt;); &lt;command&gt;"</span></span><br></pre></td></tr></table></figure><p>Combining from the base, we got the following:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">oemcp=$(reg.exe query <span class="string">"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage"</span> /v OEMCP 2&gt;&amp;1 | sed -n 3p | sed -e <span class="string">'s|\r||g'</span> | grep -o <span class="string">'[[:digit:]]*'</span>)</span><br><span class="line">chcp.com <span class="variable">$oemcp</span></span><br><span class="line">oemcp=$((<span class="variable">$oemcp</span>+0))</span><br><span class="line">powershell.exe ... -Command <span class="string">"[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEncoding(<span class="variable">$cp</span>); &lt;command&gt;"</span></span><br><span class="line">chcp.com 65001</span><br></pre></td></tr></table></figure><p>And now the problem is now gone! Following is demo of the fixed bug in <code>wslu</code>:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/wsl-winps-encoding-2.png" alt="" /></p><p>Now I wish there won’t be another sequel to this problem…</p>]]></content>
          113     
          114     <summary type="html">
          115     
          116       
          117       
          118         &lt;p&gt;Well well well, here we go again.&lt;/p&gt;
          119 &lt;p&gt;I recently received a bug report that when there are umlauts in their username (&lt;a href=&quot;https:/
          120       
          121     
          122     </summary>
          123     
          124     
          125     
          126       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
          127     
          128       <category term="Powershell" scheme="https://patrickwu.space/tags/Powershell/"/>
          129     
          130   </entry>
          131   
          132   <entry>
          133     <title>Among Us but it&#39;s Garbled AND Transfer</title>
          134     <link href="https://patrickwu.space/2021/01/10/Among-Us-but-it-s-Garbled-AND-Transfer/"/>
          135     <id>https://patrickwu.space/2021/01/10/Among-Us-but-it-s-Garbled-AND-Transfer/</id>
          136     <published>2021-01-10T22:40:45.000Z</published>
          137     <updated>2021-06-19T14:13:15.351Z</updated>
          138     
          139     <content type="html"><![CDATA[<p><img src="https://cdn.patrickwu.space/posts/among-us-crypto.jpg" alt="Among Us but it's Garbled AND Transfer" /></p>]]></content>
          140     
          141     <summary type="html">
          142     
          143       
          144       
          145         &lt;p&gt;&lt;img src=&quot;https://cdn.patrickwu.space/posts/among-us-crypto.jpg&quot; alt=&quot;Among Us but it&#39;s Garbled AND Transfer&quot; /&gt;&lt;/p&gt;
          146 
          147       
          148     
          149     </summary>
          150     
          151     
          152     
          153       <category term="Comic" scheme="https://patrickwu.space/tags/Comic/"/>
          154     
          155       <category term="Cryptography" scheme="https://patrickwu.space/tags/Cryptography/"/>
          156     
          157   </entry>
          158   
          159   <entry>
          160     <title>Mia Unua Afiŝo en Esperanto</title>
          161     <link href="https://patrickwu.space/2020/12/28/eo-unua-afisxo/"/>
          162     <id>https://patrickwu.space/2020/12/28/eo-unua-afisxo/</id>
          163     <published>2020-12-28T23:52:56.000Z</published>
          164     <updated>2021-06-19T14:13:15.351Z</updated>
          165     
          166     <content type="html"><![CDATA[<p>Estas mia una afiŝo en Esperanto sur ĉi tiu blogo. Estas homoj kiuj demandas mi ‘Kial vi volas lerni Esperanto?’ La origina caŭso estas ke mi volas uzi Esperanto por lerni aliaj lingvoj. Ĝin jam helpis: Mi ege trovas ke lerni la Francan pli facila(Oui, Je crois). Nun mi trovas, ke Esperanto estas amuza, kaj mi amas ĝin.</p><p>Mi provos diskuti pri politiko kaj teknologio en Esperanto estonte; ĉar mi ne volas afiŝi politikan io en la Angla, kaj skribi afiŝoj helpas min por lerni Esperanto.</p><p>Mi havas du projektojn sur GitHub kun Esperantaj tradukaĵoj: <a href="https://github.com/wslutilities/wslu/blob/master/README.eo.md" target="_blank" rel="noopener">wslu</a> kaj <a href="https://github.com/patrick330602/esperanto-osx-keyboard-layout" target="_blank" rel="noopener">Esperanta Klava</a>. Mi ankaŭ helpas tradukadon en <strong><a href="https://discourse.ubuntu.com/t/announcing-ubuntu-on-windows-community-preview/19789" target="_blank" rel="noopener">Ubuntu on Windows Community Preview</a></strong>, kiun mi okupiĝas pri.</p><p><img src="https://lh6.googleusercontent.com/YC5K0CkeZvnAg3VeOkdymd8bM0TddfXamywvFtVgvzVGEarxwZTLfpymQfOLKFxNkelaOD5AyhafHbsb-GJgluK9bbI2ihV6D4xSfTUBOL_9mZEZ09o5VwTkIhsu2gTF7mUnpOyI" alt="Esperanto en UoWCP" /></p><p>Mi esperas ke mi havas pli bonan komprenadon de Esperanto dum scribi pli.</p>]]></content>
          167     
          168     <summary type="html">
          169     
          170       
          171       
          172         &lt;p&gt;Estas mia una afiŝo en Esperanto sur ĉi tiu blogo. Estas homoj kiuj demandas mi ‘Kial vi volas lerni Esperanto?’ La origina caŭso estas k
          173       
          174     
          175     </summary>
          176     
          177     
          178     
          179       <category term="Esperanto" scheme="https://patrickwu.space/tags/Esperanto/"/>
          180     
          181   </entry>
          182   
          183   <entry>
          184     <title>2020: Ĉi tiu ne estas bone!</title>
          185     <link href="https://patrickwu.space/2020/12/28/review-2020/"/>
          186     <id>https://patrickwu.space/2020/12/28/review-2020/</id>
          187     <published>2020-12-28T11:48:28.000Z</published>
          188     <updated>2021-06-19T14:13:15.351Z</updated>
          189     
          190     <content type="html"><![CDATA[<p>Well, you know what time it is. It’s my annual review time. And from now on, the review will be in English.</p><p>With the pandemic going on and the continuing political suppression in Hong Kong, it is getting very emotional for me this year.</p><p>Let’s review my 2020, starting from my last year’s goal:</p><h2 id="2020-did-i-do-it"><a class="markdownIt-Anchor" href="#2020-did-i-do-it"></a> 2020, Did I do it?</h2><p>In <a href="https://patrickwu.space/2019/12/25/review-2019/">Last Year’s Annual Review</a>, I made the following goal for the year:</p><ul><li>開始做音樂 (Start Making Music)</li><li>寫《和平路書報攤》和《WSL指北》(Write a novel planned and <em>Ultimate Guide to WSL</em>)</li><li>認真的去找個女朋友(Get a girlfriend, seriously)</li><li>繼續鍛鍊(Keep Exercising)</li><li>找到工作/考研成功 (Find a job or pursue a master degree successfully)</li></ul><h3 id="starting-making-music"><a class="markdownIt-Anchor" href="#starting-making-music"></a> Starting Making Music</h3><p>I did start to compose some small pieces of music… Although nothing is published, progress is progress.</p><h3 id="write-a-novel-planned-and-ultimate-guide-to-wsl"><a class="markdownIt-Anchor" href="#write-a-novel-planned-and-ultimate-guide-to-wsl"></a> Write a novel planned and <em>Ultimate Guide to WSL</em></h3><p>Almost forget I have these goals… Should pick them up next year</p><h3 id="get-a-girlfriend-seriously"><a class="markdownIt-Anchor" href="#get-a-girlfriend-seriously"></a> Get a girlfriend, seriously</h3><p>Initially want to make a pandemic excuse, but well, it’s still my own fault for not socializing ¯\_(ツ)_/¯</p><p>This is going to stay on the annual goal list forever…</p><h3 id="keep-exercising"><a class="markdownIt-Anchor" href="#keep-exercising"></a> Keep Exercising</h3><p>I did! With getting Nintendo Switch, I no longer just jogging… I also do different exercises in RingFit Adventure and Rope Skipping in Rope Jump Challenge, which made me regret why I didn’t get it early this year.</p><h3 id="find-a-job-or-pursue-a-master-degree-successfully"><a class="markdownIt-Anchor" href="#find-a-job-or-pursue-a-master-degree-successfully"></a> Find a job or pursue a master degree successfully</h3><p>I actually never thought this would not only be achieved but also the “or” should be changed to “and.” Not only I got a dream job at Canonical, but even I earned a master’s degree offer from CUHK with a scholarship.</p><h2 id="2020-what-did-i-do"><a class="markdownIt-Anchor" href="#2020-what-did-i-do"></a> 2020, what did I do?</h2><p>This year, despite the awful toxic environment around the world, I did more things I thought I would do this year, mostly due to lock-downs.</p><p>I gave <a href="">a talk</a> in WSLConf 2020, and with the help of it, I was able to get a Software Developer job at Canonical focusing on developing Ubuntu for WSL and Hyper-V. I thought this is the end of the surprise, but no, I got a master’s offer with a scholarship! I never thought I would achieve that much this year, but here we are.</p><p>This year, I started to study Esperanto(Estas mia plej flua lingvo, unu afiŝo elvenos baldaŭ), Japanese(流暢に話せません), and French(Je est débutant).</p><p>This year, I got Netflix and started to watch there, which allowed me to watch more movies and shows than before.</p><p>This year, I did not do much of the reading, mostly due to the work and study. I do pick up the Fazbear’s Frights series, but that is mostly all. Next year, I think I can get more chances to read after my master study complete.</p><h2 id="2020-what-did-i-make"><a class="markdownIt-Anchor" href="#2020-what-did-i-make"></a> 2020, what did I make?</h2><p>I made a lot of things this year. Within this year, I made Ubuntu WSL Onboarding Experience that consists of the main OOBE Experience (<code>ubuntu-wsl-oobe</code>), the <code>ubuntuwsl</code> utility (<code>ubuntu-wsl-integration</code>), and CI/CD system for Ubuntu (<code>ubuntu-cooker</code>). Also, during this period, I successfully completed another project, <code>PsUWI</code>.</p><p>My old project, <code>wslu</code> now reaches version 3.2.1, and 4.0.0 is still being worked on.</p><p>Due to the pandemic, I cannot do much of the photography this year, but I did take some of the photos that receive some good response like <a href="https://unsplash.com/photos/v8dj-2mURXo" target="_blank" rel="noopener">this one</a> with over 100k views.</p><h2 id="2021-whats-next"><a class="markdownIt-Anchor" href="#2021-whats-next"></a> 2021, what’s next?</h2><h3 id="write-a-novel-planned-and-ultimate-guide-to-wsl-2"><a class="markdownIt-Anchor" href="#write-a-novel-planned-and-ultimate-guide-to-wsl-2"></a> Write a novel planned and <em>Ultimate Guide to WSL</em></h3><p>I have a terrible habit of not able to concentrate on writing… This year, I will start trying my best to spare time to write them.</p><h3 id="get-a-girlfriend"><a class="markdownIt-Anchor" href="#get-a-girlfriend"></a> Get a girlfriend</h3><p>Well, <strong>THE</strong> annual list member that won’t be crossed out any time soon ¯\_(ツ)_/¯</p><h3 id="get-fit"><a class="markdownIt-Anchor" href="#get-fit"></a> Get Fit</h3><p>As I continue to exercise, I should start moving to the next stage: Not just exercise, I should begin to lose weight and get fit.</p>]]></content>
          191     
          192     <summary type="html">
          193     
          194       
          195       
          196         &lt;p&gt;Well, you know what time it is. It’s my annual review time. And from now on, the review will be in English.&lt;/p&gt;
          197 &lt;p&gt;With the pandemic goin
          198       
          199     
          200     </summary>
          201     
          202     
          203     
          204       <category term="Annual Review" scheme="https://patrickwu.space/tags/Annual-Review/"/>
          205     
          206   </entry>
          207   
          208   <entry>
          209     <title>Implement a &quot;tab&quot; in JavaScript</title>
          210     <link href="https://patrickwu.space/2020/11/09/js-tab-uwu/"/>
          211     <id>https://patrickwu.space/2020/11/09/js-tab-uwu/</id>
          212     <published>2020-11-09T15:53:25.000Z</published>
          213     <updated>2021-06-19T14:13:15.351Z</updated>
          214     
          215     <content type="html"><![CDATA[<h2 id="tldr"><a class="markdownIt-Anchor" href="#tldr"></a> TL;DR</h2><p>This article is a quick guide on building a simple tab on a webpage using vanilla JavaScript.</p><h2 id="why"><a class="markdownIt-Anchor" href="#why"></a> WHY?</h2><p>If you saw this post, You will know that I already remove the tab on my homepage. I decided that I don’t want the tab on my site anymore; so I decided to write an article about this to archive it. Here is how it works, and it is all happening on the same page:</p><p><img src="https://cdn.patrickwu.space/posts/dev/js-tab.gif" alt="demonstration of Tab" /></p><p>Some people might be already shouting at me for using vanilla JavaScript; To be honest, I am not that kind of JavaScript framework guy; I like to keep thing simple (but most of the time they turn out to be spaghetti) like this site (Like, I literally inherited the CSS stylesheet from <a href="http://bettermotherfuckingwebsite.com" target="_blank" rel="noopener">bettermotherf**kingwebsite.com</a>; more details <a href="https://patrickwu.space/2020/01/04/a-even-better-motherfing-website/">here</a>).</p><p>Well, less talking more writing.</p><h2 id="the-real-part"><a class="markdownIt-Anchor" href="#the-real-part"></a> The real part</h2><script async src="//jsfiddle.net/callmepk/oqht7k1c/1/embed/js,html,css,result/dark/"></script><p>I can just that there and call it for a day, you know. Well, I will not. I will, at least, explain some parts of it.</p><p>First, we got the function <code>openSection()</code> that we used in <code>onclick</code> property:</p><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">openSection</span>(<span class="params">SecName</span>) </span>&#123;</span><br><span class="line"> <span class="keyword">var</span> i, tabcontent;</span><br><span class="line"> tabcontent = <span class="built_in">document</span>.getElementsByClassName(<span class="string">"tabcontent"</span>);</span><br><span class="line"> <span class="keyword">for</span> (i = <span class="number">0</span>; i &lt; tabcontent.length; i++) &#123;</span><br><span class="line"> tabcontent[i].style.display = <span class="string">"none"</span>;</span><br><span class="line">. &#125;</span><br><span class="line"> <span class="built_in">document</span>.getElementById(SecName).style.display = <span class="string">"block"</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>This function will try to find all tag with class name <code>tabcontent</code> and set their <code>display</code> to <code>none</code>. Then, find the <code>tabcontent</code> with the name passed from <code>SecName</code> and set only that to <code>block</code>.</p><p>For the <code>window.onload</code> event, this allows you to load the default tab by id.</p><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">window</span>.onload = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line"> <span class="built_in">document</span>.getElementById(<span class="string">'default-tab'</span>).click()</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>You might be curious with the CSS part, since it looks useless:</p><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.tabcontent</span> &#123;</span><br><span class="line"> <span class="attribute">display</span>: none;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>However, this is very important. This small piece of <s>spaghetti</s> CSS prevents the situation in some browser that, for some reason, it is not fast enough to set the display to none, causing the web page to look bad when loading.</p><h2 id="conclusion"><a class="markdownIt-Anchor" href="#conclusion"></a> Conclusion</h2><p>This article is just about a tiny piece of JavaScript. I hope you find it useful, but I knew most of you already know about this 😉 Also, check out your browser console if you haven’t.</p>]]></content>
          216     
          217     <summary type="html">
          218     
          219       
          220       
          221         &lt;h2 id=&quot;tldr&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#tldr&quot;&gt;&lt;/a&gt; TL;DR&lt;/h2&gt;
          222 &lt;p&gt;This article is a quick guide on building a simple tab on a webpa
          223       
          224     
          225     </summary>
          226     
          227     
          228     
          229       <category term="Javascript" scheme="https://patrickwu.space/tags/Javascript/"/>
          230     
          231   </entry>
          232   
          233   <entry>
          234     <title>WSL-related Registry: A small dive</title>
          235     <link href="https://patrickwu.space/2020/07/19/wsl-related-registry/"/>
          236     <id>https://patrickwu.space/2020/07/19/wsl-related-registry/</id>
          237     <published>2020-07-19T13:46:26.000Z</published>
          238     <updated>2021-06-19T14:13:15.355Z</updated>
          239     
          240     <content type="html"><![CDATA[<blockquote><p>Due to the lack of documentation, some of the information is possibly not complete or inaccurate. This is a updated version since WSLConf 2020.</p></blockquote><p>Information of WSL distributions store here: <code>HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss</code>.</p><h2 id="overview"><a class="markdownIt-Anchor" href="#overview"></a> Overview</h2><p><img src="https://cdn.patrickwu.space/works/wslconf/images/top_key.png" alt="Overview of the key" /></p><ul><li>Subkeys are the definition of single WSL distributions. They are named using GUID.</li><li><code>DafaultDistribution</code>, RGE_SZ: This defines the default distribution used when using <code>bash.exe</code> and <code>wsl.exe</code>. The value passed is a GUID. By default, it’s the first distribution installed.</li><li><code>DefaultVersion</code>, REG_DWORD: (WSL2 Only) This defines the default WSL version that would be used for new WSL distributions.  Value for WSL1 is 0x1(1); for WSL2, 0x2(2).</li></ul><h3 id="store-distribution-key"><a class="markdownIt-Anchor" href="#store-distribution-key"></a> Store Distribution Key</h3><p><img src="https://cdn.patrickwu.space/works/wslconf/images/store_distro_key.png" alt="View of a sample store distribution key" /></p><p>Here are the details of the key values:</p><ul><li><code>BasePath</code>, REG_SZ: This defines where the WSL distribution source location is.</li><li><code>DefaultEnvironment</code>, REG_MULTI_SZ: This defines the default environment value that passed to WSL Distribution when opening the WSL distribution.</li><li><code>DefaultUid</code>, REG_DWORD: This defines the default user for the distro. The value uses the <code>uid</code> in Linux, for example, <code>root</code> is always <code>0</code>.</li><li><code>DistributionName</code>, REG_SZ: This defines the registered name of the WSL distribution. This will be used in <code>wsl.exe --list</code> and in <code>wsl.exe -d</code>.</li><li><code>Flags</code>, REG_DWORD: This defines the behavior of a distribution registered with the Windows Subsystem for Linux. The value passed is numeral combination of enumeration <code>WSL_DISTRIBUTION_FLAGS</code> , which is used by function <code>WslConfigureDistribution</code> in <code>wslapi.h</code>.  The default value is <code>WSL_DISTRIBUTION_FLAGS_DEFAULT</code>, which is 0x7(7) in older version and 0xf(15) in newer version. Known available single options are the following:<ul><li><p><code>WSL_DISTRIBUTION_FLAGS_NONE</code>: 0x0(0)</p></li><li><p><code>WSL_DISTRIBUTION_FLAGS_ENABLE_INTEROP</code>: 0x1(1)</p></li><li><p><code>WSL_DISTRIBUTION_FLAGS_APPEND_NT_PATH</code>: 0x2(2)</p></li><li><p><code>WSL_DISTRIBUTION_FLAGS_ENABLE_DRIVE_MOUNTING</code>: 0x4(4)</p><p>There is also one undocumented flag with value 0x8(8) in the newer version, which defines which WSL version it is using. With the flag, the distro will be using WSL2.</p></li></ul></li><li><code>KernelCommandLine</code>, REG_SZ: (2004 Only) This defines the command passed to WSL2 Kernel.</li><li><code>PackageFamilyName</code>, REG_SZ: This defines the WSL distribution’s UWP package Family name.</li><li><code>State</code>, REG_DWORD: This defines the state of WSL distribution. By default, it is in normal state 0x1(1). Here are also some other states:<ul><li>Normal: 0x1(1)</li><li>Installing: 0x3(3)</li><li>Uninstalling: 0x4(4)</li></ul></li><li><code>Version</code>, REG_DWORD: Do not confuse this with <code>DefaultVersion</code>! They define two entire different settings. This defines whether you are using <code>wslfs</code> or <code>lxfs</code> for the filesystem. Value for <code>lxfs</code> is 0x1(1); for <code>wslfs</code>, 0x2(2).</li></ul><h3 id="imported-distribution-key"><a class="markdownIt-Anchor" href="#imported-distribution-key"></a> Imported Distribution Key</h3><p><img src="https://cdn.patrickwu.space/works/wslconf/images/imported_distro_key.png" alt="View of a sample imported distribution key" /></p><p>As you can see, by default imported distribution do not have <code>DefaultEnvironment</code>‌, <code>KernelCommandLine</code> and <code>PackageFamilyName</code>. Also by default, <code>DefaultUid</code> will be <code>0</code> which is root.</p>]]></content>
          241     
          242     <summary type="html">
          243     
          244       
          245       
          246         &lt;blockquote&gt;
          247 &lt;p&gt;Due to the lack of documentation, some of the information is possibly not complete or inaccurate. This is a updated version 
          248       
          249     
          250     </summary>
          251     
          252     
          253     
          254       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
          255     
          256       <category term="WSL2" scheme="https://patrickwu.space/tags/WSL2/"/>
          257     
          258   </entry>
          259   
          260   <entry>
          261     <title>Setup Protonmail on UWP Mail</title>
          262     <link href="https://patrickwu.space/2020/06/14/protonmail-on-uwp-mail/"/>
          263     <id>https://patrickwu.space/2020/06/14/protonmail-on-uwp-mail/</id>
          264     <published>2020-06-14T15:06:20.000Z</published>
          265     <updated>2021-06-19T14:13:15.351Z</updated>
          266     
          267     <content type="html"><![CDATA[<h2 id="tldr"><a class="markdownIt-Anchor" href="#tldr"></a> TL;DR</h2><p>This is a quick guide on how you can setup your Protonmail Bridge with UWP version of Mail app. There is some issues such as email content cannot be downloaded, but I heard that ProtonMail is investigating the issue.</p><h2 id="prepare"><a class="markdownIt-Anchor" href="#prepare"></a> Prepare</h2><p>Firstly, you need to download <a href="https://protonmail.com/bridge/install" target="_blank" rel="noopener">ProtonMail Bridge</a>, of course. Install and setup ProtonMail Bridge, and get all your Protonmail Configuration Information:</p><p><img src="https://cdn.patrickwu.space/posts/dev/protonmail/1.png" alt="" /></p><p>Also, remember to unlock the Mail app for Local loopback using the following command in PowerShell with Admin privilege:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">checknetisolation loopbackexempt -a -n&#x3D;&quot;(Get-AppxPackage *windowscommunications*).PackageFamilyName&quot;</span><br></pre></td></tr></table></figure><p><img src="https://cdn.patrickwu.space/posts/dev/protonmail/2.png" alt="" /></p><h2 id="adding-account"><a class="markdownIt-Anchor" href="#adding-account"></a> Adding account</h2><p>Now, open your UWP mail, and go to Settings -&gt; Manage Accounts -&gt; Add account -&gt; Advanced Setup -&gt; Internet Email. Input Information as follows:</p><table><thead><tr><th>Field</th><th>Input</th></tr></thead><tbody><tr><td>Email Address</td><td><em><strong>Username</strong> from Protonmail Configuration</em></td></tr><tr><td>Username</td><td><em><strong>Username</strong> from Protonmail Configuration</em></td></tr><tr><td>Password</td><td><em><strong>Password</strong> from Protonmail Configuration</em></td></tr><tr><td>Account name</td><td><em>whatever you like</em></td></tr><tr><td>Send your messages using this name</td><td><em>whatever you like</em></td></tr><tr><td>Incoming email server</td><td>127.0.0.1:1143</td></tr><tr><td>Account type</td><td>IMAP4</td></tr><tr><td>Outgoing (SMTP) email server</td><td>127.0.0.1:1025</td></tr></tbody></table><p>Also keep <strong>Outgoing server requires authentification</strong> and <strong>Use the same username and password for sending emails</strong>, and uncheck <strong>Rrequire SSL for incoming emails</strong> and <strong>Requie SSL for outgoing emails</strong>.</p><p>And now, you have setup your ProtonMail account on UWP Mail client!</p>]]></content>
          268     
          269     <summary type="html">
          270     
          271       
          272       
          273         &lt;h2 id=&quot;tldr&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#tldr&quot;&gt;&lt;/a&gt; TL;DR&lt;/h2&gt;
          274 &lt;p&gt;This is a quick guide on how you can setup your Protonmail Bridge
          275       
          276     
          277     </summary>
          278     
          279     
          280     
          281       <category term="Windows 10" scheme="https://patrickwu.space/tags/Windows-10/"/>
          282     
          283   </entry>
          284   
          285   <entry>
          286     <title>Build Your Own Debian Repository: The quick way</title>
          287     <link href="https://patrickwu.space/2020/06/07/deb-repo-from-stratch/"/>
          288     <id>https://patrickwu.space/2020/06/07/deb-repo-from-stratch/</id>
          289     <published>2020-06-07T12:15:08.000Z</published>
          290     <updated>2021-06-19T14:13:15.351Z</updated>
          291     
          292     <content type="html"><![CDATA[<h2 id="tldr"><a class="markdownIt-Anchor" href="#tldr"></a> TL;DR</h2><p>This is a quick little article to get you started with the Debian repository. I have been setting up Debian repositories for <code>wslu</code> and some other packages. You can check out my Debian and Kali Linux repository for wslu <a href="https://access.patrickwu.space/wslu/debian/" target="_blank" rel="noopener">here</a> and <a href="https://access.patrickwu.space/wslu/kali/" target="_blank" rel="noopener">here</a>.</p><h2 id="setup"><a class="markdownIt-Anchor" href="#setup"></a> Setup</h2><p>We will set up the repository using <code>reprepro</code>. You can install <code>reprepro</code> using your distro’s package manager, for example,  <code>sudo apt install reprepro</code> for debian-based operating systems.</p><p>Now, you can create Create a directory for your repository. Here, I will call it <code>repo</code>. Create a folder <code>conf</code> under the <code>repo</code> folder, and under <code>conf</code> folder, create a file called <code>distributions</code> with the following content:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">Origin: repo.example.com</span><br><span class="line">Label: repo.example.com</span><br><span class="line">Codename: trusty</span><br><span class="line">Architectures: i386 amd64 source</span><br><span class="line">Components: main</span><br><span class="line">Description: example repo</span><br><span class="line">SignWith: Yes</span><br></pre></td></tr></table></figure><p>Here is a quick reference of this file:</p><ul><li><strong>Origin</strong>: This field is used to identify where this repository is coming from. Usually, it is a URL.</li><li><strong>Label</strong>: Similar to Origin</li><li><strong>Codename</strong>: This is usually the codename for the distribution like <em>focal</em>, <em>buster</em> and <em>kali-rolling</em>.</li><li><strong>Architectures</strong>: The architectures.</li><li><strong>Components</strong>: The names of the components that packages can be imported into. Usually, it is <code>main</code>.</li><li><strong>Description</strong>: This field is optional, but useful for end-users.</li><li><strong>SignWith</strong>: This field can be either <code>yes</code>, <code>default</code>, or have the GPG key ID of a GPG key that should be used to sign the repository metadata. If “yes” or “default” are specified, reprepro will use the default GPG key available when signing repository metadata.</li></ul><p>More detailed documentation can be found <a href="https://manpages.debian.org/jessie/reprepro/reprepro.1.en.html#conf/distributions" target="_blank" rel="noopener">here</a>, or check <code>man reprepro</code> under <strong>conf/distributions</strong> section.</p><p>Now, you have complete the Debian repository. Now Let’s try to import a Debian package.</p><h2 id="sign-and-import"><a class="markdownIt-Anchor" href="#sign-and-import"></a> Sign and Import</h2><p>You need to get your private key and Debian package ready. I have an article talking about a simple way you can build a Debian package: <a href="https://patrickwu.space/2018/05/25/make-deb-packing-simple/">Packaging .deb using a simple script: Explained</a></p><p>Now let’s prepare our signing environment by running <code>export GPG_TTY=$(tty)</code>, or include this line in your shell configuration file. This allows GPG-signing running in the terminal without throw out errors.</p><p>Now, import your GPG key using <code>‌gpg --import &lt;key&gt;</code>. You can now sign packages with <code>dpkg-sig -k &lt;key&gt; --sign builder /path/to/package.deb</code> or <code>dpkg-sig --sign builder /path/to/package.deb</code> if your signing the package with default key.</p><p>Now you can import packages using <code>reprepro -S &lt;category&gt; -b repo/ includedeb &lt;codename&gt; /path/to/package.deb</code>. <code>-S</code> is always required.</p>]]></content>
          293     
          294     <summary type="html">
          295     
          296       
          297       
          298         &lt;h2 id=&quot;tldr&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#tldr&quot;&gt;&lt;/a&gt; TL;DR&lt;/h2&gt;
          299 &lt;p&gt;This is a quick little article to get you started with the Debian
          300       
          301     
          302     </summary>
          303     
          304     
          305     
          306       <category term="Linux" scheme="https://patrickwu.space/tags/Linux/"/>
          307     
          308       <category term="Linux Packaging" scheme="https://patrickwu.space/tags/Linux-Packaging/"/>
          309     
          310       <category term="Ubuntu" scheme="https://patrickwu.space/tags/Ubuntu/"/>
          311     
          312       <category term="Debian" scheme="https://patrickwu.space/tags/Debian/"/>
          313     
          314   </entry>
          315   
          316   <entry>
          317     <title>Microsoft Build 2020: My Tiny Little Summary</title>
          318     <link href="https://patrickwu.space/2020/05/31/build-2020/"/>
          319     <id>https://patrickwu.space/2020/05/31/build-2020/</id>
          320     <published>2020-05-31T11:30:37.000Z</published>
          321     <updated>2021-06-19T14:13:15.351Z</updated>
          322     
          323     <content type="html"><![CDATA[<h2 id="tl-dr"><a class="markdownIt-Anchor" href="#tl-dr"></a> TL; DR</h2><p>Another year, another Microsoft Build; but this year, it’s all virtual due to coronavirus. Last year’s build is such a fun experience for me; I even have written a summary for that <a href="https://patrickwu.space/2019/05/10/build-2019/">here</a>. And this year’s build is not only unique but also free, and it is the 48-hour never-ending fun.</p><p>Also, here is my setup for the build 2020:<br /><img src="https://cdn.patrickwu.space/posts/dev/build-2020-setup.jpeg" alt="My Setup for Build 2020" /></p><h2 id="wsl"><a class="markdownIt-Anchor" href="#wsl"></a> WSL</h2><p>As WSL2 will be available for everyone on Windows 10 version 2004, 3 new features for WSL is also announced for WSL, and got highlighted by Satya Nadella and Scott Hanselman:</p><ul><li>Added support for graphics processing unit (GPU) compute workflows;</li><li>Support for Linux graphical user interface (GUI) apps with Audio Support;</li><li>Support a simplified install experience by running the command <code>wsl.exe – install</code>.</li></ul><p>For <strong>GPU Support</strong>, Microsoft uses a special kernel driver <code>dxgkrnl</code> to expose <code>/dev/dxg</code> in user mode Linux that allows mimicking the service layer provided on Windows. This method made the following things possible to run on WSL:</p><ul><li>DxCore (<code>libdxcore</code>) &amp; D3D12 (<code>libd3d12</code>);</li><li>DirectML (<code>libdirectml</code>) based on D3D12;</li><li>OPENGL/OpenCL/Vulkan (<code>mesa</code>) based on D3D12;</li><li>NVIDIA CUDA (<code>libcuda</code>) based on DxCore.</li></ul><p>There are also some discussions happening on <a href="https://lkml.org/lkml/2020/5/19/742" target="_blank" rel="noopener">Linux Kernel Mailing List</a> and <a href="https://lists.freedesktop.org/archives/dri-devel/2020-May/266629.html" target="_blank" rel="noopener">Direct Rendering Modules Mailing List</a>. The feature is coming very soon in June for Insiders.</p><p>A more detailed article can be found here: <a href="https://devblogs.microsoft.com/directx/directx-heart-linux/" target="_blank" rel="noopener">DirectX ❤ Linux</a></p><p>For <strong>GUI support</strong>, according to the session, the GUI layer for WSL will be a Wayland layer implemented as a daemon called <code>wlwsld</code> that will (possibly) land as a startup daemon. It uses a custom-built RDP client (<code>rdclientwsl.exe</code>) <a href="https://wayland.freedesktop.org/xserver.html" target="_blank" rel="noopener">Xwayland</a>, FreeRDP v2.1.0 and a Wayland compositor <a href="https://github.com/wayland-project/weston" target="_blank" rel="noopener">Weston</a> (<code>libweston</code>) currently from the demo:</p><p><img src="https://cdn.patrickwu.space/posts/dev/build-2020-wsl-wayland-gui.png" alt="Sneak peek of the daemon" /></p><p>It is right now proposed to be released in December with the <strong>audio support</strong>.</p><p>However, <code>systemd</code> support is not likely to come any soon since it is still being working on.</p><h2 id="windows-terminal"><a class="markdownIt-Anchor" href="#windows-terminal"></a> Windows Terminal</h2><p>Windows Terminal is finally getting 1.0! It finally gets <a href="https://aka.ms/terminal-docs" target="_blank" rel="noopener">proper documentation</a>, and now stable and preview release are separated: <a href="https://aka.ms/terminal" target="_blank" rel="noopener">Stable</a> and <a href="https://aka.ms/terminal-preview" target="_blank" rel="noopener">Preview</a>. Also during the session, it showed new features like coloring tab and renaming tab, which will be coming in a few weeks; they also demoed the coming Terminal Settings, which is still super beta:</p><div class="twitter-wrapper"><blockquote class="twitter-tweet"><a href="https://twitter.com/callmepkwu/status/1262924009047560193" target="_blank" rel="noopener"></a></blockquote></div><script async defer src="//platform.twitter.com/widgets.js" charset="utf-8"></script><h2 id="project-reunion"><a class="markdownIt-Anchor" href="#project-reunion"></a> Project Reunion</h2><p><a href="https://github.com/microsoft/ProjectReunion" target="_blank" rel="noopener">Project Reunion</a> is an exciting new concept, since I am previously a UWP/Windows Phone developer, and merging the win32 and UWP API is finally started to happen. Project Reunion includes WinUI 3 for unified controls, .NET MAUI for unifying all system UI (Although currently there seems to be a legal issue for the name that caused confliction with KDE MAUI and the Linux community).</p><p>As a webmaster during my university time, I am also super interested on what will the new WebView (WebView2) brings for developers and the latest status of Microsoft Edge. For WebView2 and he new Chromium-based Microsoft Edge, we not only got a sneak peek of Microsoft Edge on Linux on Azure session; but WebView2 will also have a plan to be brought to Linux on the long-term roadmap.</p><h2 id="c-90"><a class="markdownIt-Anchor" href="#c-90"></a> C# 9.0</h2><p>In Microsoft Build 2019, they announced C# 8.0 and showed what’s next. In Build 2020, they shared about what will be coming for C# 9.0. Here are just some takeaways.</p><p>You can initial a new object using the With-expressions:</p><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> b = a with &#123;con = <span class="string">"some other content"</span>&#125;;</span><br></pre></td></tr></table></figure><p>In Microsoft Build 2019, they demonstrated a lot of awesome improvements in pattern matching. There are some further improvements in pattern matching, including:<br />- Type patterns<br />- Relational patterns (<code>&lt;=</code>)<br />- Logical patterns (<code>not</code>)</p><p>Now in C# 9.0, there is a new target-typed “new” so you can init an object using the following:</p><figure class="highlight csharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">a_random_type x = <span class="keyword">new</span> (<span class="string">"a"</span>, <span class="string">"b"</span>);</span><br></pre></td></tr></table></figure><p>Also, it now allows parameter null checking inline with <code>!</code>:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Public a_random_type(string name!, string con!) &#123; ... &#125;</span><br></pre></td></tr></table></figure><p>There is also a feature of covariant returns such that you can ovreride a feature to return another object easily:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">public virtual a_random_type GetStuff() &#123; ... &#125;</span><br><span class="line">public override another_random_type GetStuff() &#123; ... &#125;</span><br></pre></td></tr></table></figure><p>There is also a more detailed article about what’s new, which a lot of them are not mentioned in the session: <a href="https://devblogs.microsoft.com/dotnet/welcome-to-c-9-0/" target="_blank" rel="noopener">Welcome to C# 9.0</a></p><h2 id="other"><a class="markdownIt-Anchor" href="#other"></a> Other</h2><ul><li><a href="https://github.com/microsoft/winget-cli" target="_blank" rel="noopener">Windows Package Manager</a>; This sure is a surprise to me. Windows is finally getting an official package manager, although it is pretty rough for now. It is also confirmed it will be deeply integrated with Microsoft Store, and you can build your repository besides the <a href="https://github.com/microsoft/winget-pkgs" target="_blank" rel="noopener">main one</a>, which is sure exciting</li><li>GitHub Actions integration with Azure DevOps coming, but it is not ready right now</li></ul>]]></content>
          324     
          325     <summary type="html">
          326     
          327       
          328       
          329         &lt;h2 id=&quot;tl-dr&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#tl-dr&quot;&gt;&lt;/a&gt; TL; DR&lt;/h2&gt;
          330 &lt;p&gt;Another year, another Microsoft Build; but this year, it’s all
          331       
          332     
          333     </summary>
          334     
          335     
          336     
          337       <category term="C#" scheme="https://patrickwu.space/tags/C/"/>
          338     
          339       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
          340     
          341       <category term="WSL2" scheme="https://patrickwu.space/tags/WSL2/"/>
          342     
          343       <category term="Microsoft Build" scheme="https://patrickwu.space/tags/Microsoft-Build/"/>
          344     
          345   </entry>
          346   
          347   <entry>
          348     <title>iSoft Desktop: What’s the deal?</title>
          349     <link href="https://patrickwu.space/2020/03/28/idesktop-review/"/>
          350     <id>https://patrickwu.space/2020/03/28/idesktop-review/</id>
          351     <published>2020-03-28T23:29:16.000Z</published>
          352     <updated>2021-06-19T14:13:15.351Z</updated>
          353     
          354     <content type="html"><![CDATA[<p>Some times earlier, I noticed a piece of news: iSoft Desktop (普华桌面操作系统) is now the required Linux Distro for learning the standards of Linux in Mainland China according to multiple resources <sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup> <sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>.</p><p>This news arouses my interest, as most so-called “Made-in-China Operating System” are based on Linux while being close-sourced. Good examples are StartOS and Redflag OS, where both the systems are Linux-based but not open-sourced.</p><p>On the contrary, Linux distributions made by private corporations in Mainland China are not only well-made but also properly following open source licenses. Deepin Linux and Ubuntu Kylin (Ubuntu Kylin is the collaboration project between Kylin Inc. and Canonical China) are two great examples.</p><p>To find out, I tried to get this Linux distribution. It is tough to download this distribution. The download link for the distribution is hidden deep in the company website.</p><p>As expected from a nation-backed product, I found that you need to provide the email, name, phone number, and location to download the image of the distribution, which is much information needed.</p><p>What’s worse, the download speed of the ISO is slow. This slowness doesn’t depend on your local network speed; the culprit is their server bandwidth. So I made it easy for you and hosted it on my CDN. You can click <a href="https://cdn.patrickwu.space/posts/dev/linux-review/idesktop/isoft-desktop-v4.1-x86_64.iso" target="_blank" rel="noopener">here</a> to download the image.</p><p><img src="https://cdn.patrickwu.space/posts/dev/linux-review/idesktop/1.png" alt="You need to fill the information before downloading" /></p><p>The latest version of iSoft Desktop is 4.1, and the image size is 3.6 GB. I used the automatic detection feature from Parallels Desktop to figure out its base distribution. Unfortunately, Parallels Desktop failed to do so, which means at least this is not just a simple fork of an existing Linux distribution (I was wrong here as I found later that it’s based on Fedora).</p><p>During installation, I notice a very interesting thing: It has the mention of GPLv2 in their EULA, while not providing the source code:</p><p><img src="https://cdn.patrickwu.space/posts/dev/linux-review/idesktop/2.png" alt="Mention of GPLv2 during installation" /></p><p>I won’t comment on their behavior, but I believe this is a possible violation of the GPL License.  One evidence is undeniable in this possibility: They didn’t disclose the source code.</p><p>Apart from that, the installation is straightforward and simple. After installing, you can see the distribution is using KDE environment:</p><p><img src="https://cdn.patrickwu.space/posts/dev/linux-review/idesktop/3.png" alt="Desktop Environment" /></p><p>This Linux distribution uses not software that can be normally found in common Linux distributions but its China alternatives; For example, WPS is used instead of LibreOffice that used in most distributions. Very interestingly, the distribution is fully translated to Simplified Chinese, unlike other nation-backed OS like Redflag OS, where a lot of English remains everywhere on the UI. The primary issue I have for the distribution that there is no package repository included in the system, while the package server is also down.</p><p><img src="https://cdn.patrickwu.space/posts/dev/linux-review/idesktop/4.png" alt="No Available repository" /></p><p>It’s a unique Linux distribution overall, and you can try it on your own, but always keep in mind: As a closed-source Linux distribution, although no clear evidence of spying, you should always use with caution.</p><hr class="footnotes-sep" /><section class="footnotes"><ol class="footnotes-list"><li id="fn1" class="footnote-item"><p><a href="https://www.cnbeta.com/articles/tech/912899.htm" target="_blank" rel="noopener">https://www.cnbeta.com/articles/tech/912899.htm</a> <a href="#fnref1" class="footnote-backref">↩︎</a></p></li><li id="fn2" class="footnote-item"><p><a href="https://linux.cn/article-11596-1.html" target="_blank" rel="noopener">https://linux.cn/article-11596-1.html</a> <a href="#fnref2" class="footnote-backref">↩︎</a></p></li></ol></section>]]></content>
          355     
          356     <summary type="html">
          357     
          358       
          359       
          360         &lt;p&gt;Some times earlier, I noticed a piece of news: iSoft Desktop (普华桌面操作系统) is now the required Linux Distro for learning the standards of Li
          361       
          362     
          363     </summary>
          364     
          365     
          366     
          367       <category term="Linux" scheme="https://patrickwu.space/tags/Linux/"/>
          368     
          369   </entry>
          370   
          371   <entry>
          372     <title>Blursed WSL: use WSL on Mac via Parallels Desktop</title>
          373     <link href="https://patrickwu.space/2020/02/14/wsl-on-mac/"/>
          374     <id>https://patrickwu.space/2020/02/14/wsl-on-mac/</id>
          375     <published>2020-02-14T23:40:20.000Z</published>
          376     <updated>2021-06-19T14:13:15.355Z</updated>
          377     
          378     <content type="html"><![CDATA[<h2 id="some-background"><a class="markdownIt-Anchor" href="#some-background"></a> Some background…</h2><p>I recently switched to Mac because of something requires me to use MacOS. I got a 2019 16 inch model of MacBook Pro, and I am pretty satisfied with it<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>.</p><p>As I am still developing for WSL (and also UWP), I used Parallels Desktop for running Windows on Mac, because I hate Boot Camp. After setting up Windows 10 on Parallels Desktop with come tweaks, successfully set up WSL/WSL2 with Mac.</p><div class="twitter-wrapper"><blockquote class="twitter-tweet"><a href="https://twitter.com/callmepkwu/status/1199257722270601216" target="_blank" rel="noopener"></a></blockquote></div><script async defer src="//platform.twitter.com/widgets.js" charset="utf-8"></script><h2 id="use-parallels-feature-wisely"><a class="markdownIt-Anchor" href="#use-parallels-feature-wisely"></a> Use Parallels feature wisely</h2><p>Two important feature in Parallels Desktop is used: Coherence Mode and Nested Virtualization.</p><p>Using Coherence mode, you can use Windows applications and UWPs such as Windows Terminal just like native apps:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/1.png" alt="Windows Terminal on Mac" /></p><p>Using Nested Virtualization is essential to use WSL2 and the brand new Windows Docker for WSL2. Some people might afraid that enabling it has little impact on my laptop. You can enable the feature here in Parallels Desktop:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/2.png" alt="Nested virtualization in Parallels Configure Menu" /></p><h2 id="auto-mounting-mac-partition-on-wsl"><a class="markdownIt-Anchor" href="#auto-mounting-mac-partition-on-wsl"></a> Auto-mounting Mac partition on WSL</h2><p>WSL has been providing drive mounting feature using <strong>DrvFs</strong> for some times<sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>. Mounting with <strong>DrvFs</strong> is super easy; Without mounting your Windows drive, you can just:</p><ul><li>use <code>sudo mkdir /mnt/d &amp;&amp; sudo mount -t drvfs D: /mnt/d/</code> to mount your D drive;</li><li>use <code>sudo mount -t drvfs '\\server\share' /mnt/share</code> to mount netowork location <code>\\server\share</code>.</li></ul><p>You can even auto-mount using <code>fstab</code>.</p><p>However, auto-mounting with Mac partition requires something more than documentation provided, otherwise you might have trouble accessing the files.</p><p>Before mounting, the file-sharing should be enabled in Parallels Configuration:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/3.png" alt="Files Sharing in Parallels Configure Menu" /></p><p>It is suggested to use just the network location as drives can be unmounted automatically by Parallels and thus unpredictable.</p><p>Now, check the folder you want to mount. In my case, I tried to mount <code>\\Mac\Home\</code>. So I created a folder <code>/mnt/mac</code> and in my <code>/etc/fstab</code>, I input the following:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">\\Mac\Home\      &#x2F;mnt&#x2F;mac        drvfs   metadata,uid&#x3D;1000,gid&#x3D;1000,umask&#x3D;0022,fmask&#x3D;11,case&#x3D;off 0       0</span><br></pre></td></tr></table></figure><p>Restart the distribution by using <code>wsl -t</code>, and drive will automatically be mounted:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/4.png" alt="Mounted drive in /mnt/mac" /></p><h2 id="opening-websitefile-from-wsl-to-mac-browser"><a class="markdownIt-Anchor" href="#opening-websitefile-from-wsl-to-mac-browser"></a> Opening website/file from WSL to Mac browser</h2><p>This one is pretty easy to configure. If you used my <a href="https://github.com/wslutilities/wslu" target="_blank" rel="noopener">WSL Utilities</a>, you can already open website using <code>wslview</code>. Then setup <strong>Web pages</strong> to <strong>Open in Mac</strong> in the Parallels Configuration:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/5.png" alt="Webpage pages option in Parallels Desktop Configuration " /></p><p>Then everything is now ready. When you launch a website using <code>wslview</code>, it will open in the default Mac web browser.</p><p>Here is a little demo:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/6.gif" alt="Demo for Opening website in Mac from WSL" /></p><h2 id="wsl-desktop-shortcut-on-mac"><a class="markdownIt-Anchor" href="#wsl-desktop-shortcut-on-mac"></a> WSL Desktop Shortcut On Mac</h2><p>The component <code>wslusc</code> in my <a href="https://github.com/wslutilities/wslu" target="_blank" rel="noopener">WSL Utilities</a> allows you to create shortcuts on Windows Desktop. Combining with Parallels Desktop’s feature, you can launch WSL GUI application right from your Mac Desktop.</p><p>Here is how it looks:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/7.gif" alt="Demo for Windows Shortcut on Mac" /></p><p>To achieve this, We should enable Desktop Mapping in the Parallels Desktop with the following steps:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/8.png" alt="Step 1 for enabling Desktop Mapping" /><br /><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/9.png" alt="Step 2 for enabling Desktop Mapping" /></p><p>Afterward, the desktop should show the shortcut created on the Windows 10 Desktop. However, they won’t look good; But we can do some small modification to make it better like the following:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/10.png" alt="Effects on Icon edition" /></p><p>Here is how to modify it:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/mac/11.png" alt="Steps on how to change the icon" /></p><h2 id="to-conclude"><a class="markdownIt-Anchor" href="#to-conclude"></a> To conclude…</h2><p>The experience is not perfect, but this allows me to use Ubuntu without creating extra Virtual Machine on my MBP, which means a save on system memory when I need to run Windows and Ubuntu at the same time.</p><p>This sure is a great experience using WSL on Mac.</p><p>I am also going to present a session on WSLConf 😉</p><hr class="footnotes-sep" /><section class="footnotes"><ol class="footnotes-list"><li id="fn1" class="footnote-item"><p>A review is coming 😉 <a href="#fnref1" class="footnote-backref">↩︎</a></p></li><li id="fn2" class="footnote-item"><p>Good place to start with <strong>DrvFs</strong>: <a href="https://docs.microsoft.com/en-gb/archive/blogs/wsl/file-system-improvements-to-the-windows-subsystem-for-linux" target="_blank" rel="noopener">https://docs.microsoft.com/en-gb/archive/blogs/wsl/file-system-improvements-to-the-windows-subsystem-for-linux</a> <a href="#fnref2" class="footnote-backref">↩︎</a></p></li></ol></section>]]></content>
          379     
          380     <summary type="html">
          381     
          382       
          383       
          384         &lt;h2 id=&quot;some-background&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#some-background&quot;&gt;&lt;/a&gt; Some background…&lt;/h2&gt;
          385 &lt;p&gt;I recently switched to Mac becau
          386       
          387     
          388     </summary>
          389     
          390     
          391     
          392       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
          393     
          394       <category term="WSL2" scheme="https://patrickwu.space/tags/WSL2/"/>
          395     
          396       <category term="OSX" scheme="https://patrickwu.space/tags/OSX/"/>
          397     
          398   </entry>
          399   
          400   <entry>
          401     <title>An even better motherf**king website</title>
          402     <link href="https://patrickwu.space/2020/01/04/a-even-better-motherfing-website/"/>
          403     <id>https://patrickwu.space/2020/01/04/a-even-better-motherfing-website/</id>
          404     <published>2020-01-04T16:07:25.000Z</published>
          405     <updated>2021-06-19T14:13:15.351Z</updated>
          406     
          407     <content type="html"><![CDATA[<p>The one thing I hate about the modern Internet is that it fills with too many fancy CSS elements, long-running JavaScripts, cookies to “<em>improve your browsing experiences</em>”, random popup to “<strong>SUBSCRIBE NOW!</strong>” They just made my brain hurt.</p><p>One day, I found a website called, uh, <a href="http://motherfuckingwebsite.com" target="_blank" rel="noopener">Motherf**king Website</a><sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>. It’s an extrmly simple website with only the following CSS:</p><figure class="highlight css"><figcaption><span>OwO whewe iws the css</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">⠀</span><br></pre></td></tr></table></figure><p>Yeah, it doesn’t even have a CSS<sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>! But it really did just work. Then, unsurprisingly, I found a sequel to that website called <a href="http://bettermotherfuckingwebsite.com" target="_blank" rel="noopener">Better Motherf**cking Website</a>.</p><p>The heck?</p><p>But it did look better than the previous one. Well, I dig it although I know both of the sites are satire. Here is the original CSS source for the second one:</p><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">body</span>&#123;</span><br><span class="line">  <span class="attribute">margin</span>:<span class="number">40px</span> auto;</span><br><span class="line">  <span class="attribute">max-width</span>:<span class="number">650px</span>;</span><br><span class="line">  <span class="attribute">line-height</span>:<span class="number">1.6</span>;</span><br><span class="line">  <span class="attribute">font-size</span>:<span class="number">18px</span>;</span><br><span class="line">  <span class="attribute">color</span>:<span class="number">#444</span>;</span><br><span class="line">  <span class="attribute">padding</span>:<span class="number">0</span> <span class="number">10px</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-tag">h1</span>,<span class="selector-tag">h2</span>,<span class="selector-tag">h3</span>&#123;</span><br><span class="line">  <span class="attribute">line-height</span>:<span class="number">1.2</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>However, as the author of the website stated:</p><blockquote><p>I love what the creator of this site’s inspiration did. What I’m saying is that it’s so, so simple to make sites easier to read. Websites are broken by default, they are functional, high-performing, and accessible, but they’re also fucking ugly. You and all the other web designers out there need to make them not total shit.</p></blockquote><p>How about… no?</p><p>Nah, actually he(or she)'s definitely right, it will need more CSS extension. But first, I need somewhere to test it first before putting on the main site, and the <a href="https://access.patrickwu.space" target="_blank" rel="noopener">Access</a> is the perfect place. It actually doesn’t look bad! So I started to make a fork of this CSS. Here is what I have done:</p><p>For the base, I just add an extra <code>background-color</code> property in <code>body</code>, just for helping the dynamic dark/light theme on my website:</p><figure class="highlight css"><figcaption><span>original.css</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">body</span> &#123;</span><br><span class="line">  <span class="attribute">margin</span>: <span class="number">40px</span> auto;</span><br><span class="line">  <span class="attribute">max-width</span>: <span class="number">650px</span>;</span><br><span class="line">  <span class="attribute">line-height</span>: <span class="number">1.6</span>;</span><br><span class="line">  <span class="attribute">font-size</span>: <span class="number">18px</span>;</span><br><span class="line">  <span class="attribute">background-color</span>: <span class="number">#DDD</span>;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#333</span>;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">0</span> <span class="number">10px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">h1</span>,</span><br><span class="line"><span class="selector-tag">h2</span>,</span><br><span class="line"><span class="selector-tag">h3</span> &#123;</span><br><span class="line">  <span class="attribute">line-height</span>: <span class="number">1.2</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>To make heading more obvious, I did some content appending in CSS:</p><figure class="highlight css"><figcaption><span>header.css</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">h1</span><span class="selector-pseudo">:before</span> &#123;</span><br><span class="line">  <span class="attribute">content</span>: <span class="string">"# "</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">h2</span><span class="selector-pseudo">:before</span> &#123;</span><br><span class="line">  <span class="attribute">content</span>: <span class="string">"## "</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">h3</span><span class="selector-pseudo">:before</span> &#123;</span><br><span class="line">  <span class="attribute">content</span>: <span class="string">"### "</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">h4</span><span class="selector-pseudo">:before</span> &#123;</span><br><span class="line">  <span class="attribute">content</span>: <span class="string">"#### "</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">h5</span><span class="selector-pseudo">:before</span> &#123;</span><br><span class="line">  <span class="attribute">content</span>: <span class="string">"##### "</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">h6</span><span class="selector-pseudo">:before</span> &#123;</span><br><span class="line">  <span class="attribute">content</span>: <span class="string">"###### "</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">h1</span> <span class="selector-tag">a</span><span class="selector-pseudo">:hover</span>,</span><br><span class="line"><span class="selector-tag">h1</span> <span class="selector-tag">a</span><span class="selector-pseudo">:active</span> &#123;</span><br><span class="line">  <span class="attribute">text-decoration</span>: none;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>This part is the extension on link to make it less ugly compared to default:</p><figure class="highlight css"><figcaption><span>link.css</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">a</span><span class="selector-pseudo">:link</span> &#123;</span><br><span class="line">  <span class="attribute">text-decoration</span>: underline;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#555</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">a</span><span class="selector-pseudo">:visited</span> &#123;</span><br><span class="line">  <span class="attribute">text-decoration</span>: none;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#777</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">a</span><span class="selector-pseudo">:hover</span>,</span><br><span class="line"><span class="selector-tag">a</span><span class="selector-pseudo">:active</span> &#123;</span><br><span class="line">  <span class="attribute">text-decoration</span>: underline;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#77beec</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>I also try to fix some distortedly-rendered element in Hexo:</p><figure class="highlight css"><figcaption><span>general.css</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">img</span> &#123;</span><br><span class="line">  <span class="attribute">outline</span>: none;</span><br><span class="line">  <span class="attribute">border</span>: none;</span><br><span class="line">  <span class="attribute">max-width</span>: <span class="number">100%</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">table</span> &#123;</span><br><span class="line">  <span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">blockquote</span> &#123;</span><br><span class="line">  <span class="attribute">border-left-width</span>: <span class="number">2px</span>;</span><br><span class="line">  <span class="attribute">border-left-color</span>: gray;</span><br><span class="line">  <span class="attribute">border-left-style</span>: solid;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">0</span> <span class="number">10px</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>I also made some improvements on post tag cloud on the homepage to better distinguish them:</p><figure class="highlight css"><figcaption><span>tag.css </span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.hometag</span> &#123;</span><br><span class="line">  <span class="attribute">border</span>: <span class="number">1px</span> solid <span class="number">#555</span>;</span><br><span class="line">  <span class="attribute">margin</span>: <span class="number">5px</span>;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">0</span> <span class="number">5px</span>;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#555</span>;</span><br><span class="line">  <span class="attribute">border-radius</span>: <span class="number">5px</span>;</span><br><span class="line">  <span class="attribute">display</span>: inline-block;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>By default, these code block generated is distorted and not good for viewing. I styled them here:</p><figure class="highlight css"><figcaption><span>codeblock.css</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">pre</span> &#123;</span><br><span class="line">  <span class="attribute">font</span>: <span class="number">0.8em</span>/<span class="number">1.0em</span> <span class="string">"Courier New"</span>, Courier;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#222</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">code</span> &#123;</span><br><span class="line">  <span class="attribute">font</span>: <span class="string">"Courier New"</span>, Courier;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#AAA</span>;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#444</span>;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">4px</span>;</span><br><span class="line">  <span class="attribute">font-size</span>: <span class="number">16px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.highlight</span> &#123;</span><br><span class="line">  <span class="attribute">border-color</span>: <span class="number">#555</span>;</span><br><span class="line">  <span class="attribute">border-style</span>: solid;</span><br><span class="line">  <span class="attribute">border-width</span>: <span class="number">0.5px</span>;</span><br><span class="line">  <span class="attribute">border-radius</span>: <span class="number">5px</span>;</span><br><span class="line">  <span class="attribute">overflow</span>: auto;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#DDD</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.highlight</span> <span class="selector-class">.gutter</span> &#123;</span><br><span class="line">  <span class="attribute">border-right-color</span>: <span class="number">#555</span>;</span><br><span class="line">  <span class="attribute">border-right-style</span>: solid;</span><br><span class="line">  <span class="attribute">border-right-width</span>: <span class="number">0.5px</span>;</span><br><span class="line">  <span class="attribute">padding-left</span>: <span class="number">10px</span>;</span><br><span class="line">  <span class="attribute">padding-right</span>: <span class="number">10px</span>;</span><br><span class="line">  <span class="attribute">text-align</span>: right;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.highlight</span> <span class="selector-class">.code</span> &#123;</span><br><span class="line">  <span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">  <span class="attribute">padding-left</span>: <span class="number">10px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.highlight</span> <span class="selector-tag">figcaption</span> &#123;</span><br><span class="line">  <span class="attribute">border-bottom-color</span>: <span class="number">#555</span>;</span><br><span class="line">  <span class="attribute">border-bottom-style</span>: solid;</span><br><span class="line">  <span class="attribute">border-bottom-width</span>: <span class="number">0.5px</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.highlight</span> <span class="selector-tag">figcaption</span> <span class="selector-tag">span</span> &#123;</span><br><span class="line">  <span class="attribute">margin</span>: <span class="number">5px</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>This is to improve the look of scrollbar as the default one is problematic with dark theme I implemented later:</p><figure class="highlight css"><figcaption><span>scrollbar</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-pseudo">::-webkit-scrollbar</span> &#123;</span><br><span class="line">  <span class="attribute">width</span>: <span class="number">10px</span>;</span><br><span class="line">  <span class="attribute">height</span>: <span class="number">10px</span></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-button</span> &#123;</span><br><span class="line">  <span class="attribute">width</span>: <span class="number">0</span>;</span><br><span class="line">  <span class="attribute">height</span>: <span class="number">0</span></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-button</span><span class="selector-pseudo">:end</span><span class="selector-pseudo">:decrement</span>,</span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-button</span><span class="selector-pseudo">:start</span><span class="selector-pseudo">:increment</span> &#123;</span><br><span class="line">  <span class="attribute">display</span>: none</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-corner</span> &#123;</span><br><span class="line">  <span class="attribute">display</span>: block</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-thumb</span> &#123;</span><br><span class="line">  <span class="attribute">border-radius</span>: <span class="number">8px</span>;</span><br><span class="line">  <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, .<span class="number">2</span>)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-thumb</span><span class="selector-pseudo">:hover</span> &#123;</span><br><span class="line">  <span class="attribute">border-radius</span>: <span class="number">8px</span>;</span><br><span class="line">  <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, .<span class="number">5</span>)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-track</span><span class="selector-pseudo">:hover</span> &#123;</span><br><span class="line">  <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, .<span class="number">15</span>)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-thumb</span>,</span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-track</span> &#123;</span><br><span class="line">  <span class="attribute">border-right</span>: <span class="number">1px</span> solid transparent;</span><br><span class="line">  <span class="attribute">border-left</span>: <span class="number">1px</span> solid transparent;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-button</span><span class="selector-pseudo">:end</span>,</span><br><span class="line"><span class="selector-pseudo">::-webkit-scrollbar-button</span><span class="selector-pseudo">:start</span> &#123;</span><br><span class="line">  <span class="attribute">width</span>: <span class="number">10px</span>;</span><br><span class="line">  <span class="attribute">height</span>: <span class="number">10px</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>Lastly, I added dark/light theme support using <code>prefers-color-scheme</code>, and it looks good at night:</p><figure class="highlight css"><figcaption><span>dynamic_theme.css</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">@media</span> (<span class="attribute">prefers-color-scheme:</span> dark) &#123;</span><br><span class="line">  <span class="selector-tag">body</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="number">#222</span>;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#CCC</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-tag">a</span><span class="selector-pseudo">:link</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#AAA</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-tag">a</span><span class="selector-pseudo">:visited</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#999</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-tag">pre</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#999</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-tag">code</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#222</span>;</span><br><span class="line">    <span class="attribute">background</span>: <span class="number">#AAA</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-class">.tag</span> &#123;</span><br><span class="line">    <span class="attribute">border-color</span>: <span class="number">#AAA</span>;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#AAA</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-class">.highlight</span> &#123;</span><br><span class="line">    <span class="attribute">border-color</span>: <span class="number">#DDD</span>;</span><br><span class="line">    <span class="attribute">background</span>: <span class="number">#222</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-class">.highlight</span> <span class="selector-class">.gutter</span> &#123;</span><br><span class="line">    <span class="attribute">border-right-color</span>: <span class="number">#DDD</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-class">.highlight</span> <span class="selector-tag">figcaption</span> &#123;</span><br><span class="line">    <span class="attribute">border-bottom-color</span>: <span class="number">#DDD</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-pseudo">::-webkit-scrollbar-thumb</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(<span class="number">255</span>, <span class="number">255</span>, <span class="number">255</span>, .<span class="number">2</span>)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-pseudo">::-webkit-scrollbar-thumb</span><span class="selector-pseudo">:hover</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(<span class="number">255</span>, <span class="number">255</span>, <span class="number">255</span>, .<span class="number">5</span>)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-pseudo">::-webkit-scrollbar-track</span><span class="selector-pseudo">:hover</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(<span class="number">255</span>, <span class="number">255</span>, <span class="number">255</span>, .<span class="number">15</span>)</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">@media</span> (<span class="attribute">prefers-color-scheme:</span> light) &#123;</span><br><span class="line">  <span class="selector-tag">body</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="number">#DDD</span>;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#333</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-tag">a</span><span class="selector-pseudo">:link</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#555</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-tag">a</span><span class="selector-pseudo">:visited</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#777</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-tag">pre</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#222</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-tag">code</span> &#123;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#999</span>;</span><br><span class="line">    <span class="attribute">background</span>: <span class="number">#222</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-class">.tag</span> &#123;</span><br><span class="line">    <span class="attribute">border-color</span>: <span class="number">#555</span>;</span><br><span class="line">    <span class="attribute">color</span>: <span class="number">#555</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-class">.highlight</span> &#123;</span><br><span class="line">    <span class="attribute">border-color</span>: <span class="number">#555</span>;</span><br><span class="line">    <span class="attribute">background</span>: <span class="number">#DDD</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-class">.highlight</span> <span class="selector-class">.gutter</span> &#123;</span><br><span class="line">    <span class="attribute">border-right-color</span>: <span class="number">#555</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-class">.highlight</span> <span class="selector-tag">figcaption</span> &#123;</span><br><span class="line">    <span class="attribute">border-bottom-color</span>: <span class="number">#555</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-pseudo">::-webkit-scrollbar-thumb</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, .<span class="number">2</span>)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-pseudo">::-webkit-scrollbar-thumb</span><span class="selector-pseudo">:hover</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, .<span class="number">5</span>)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="selector-pseudo">::-webkit-scrollbar-track</span><span class="selector-pseudo">:hover</span> &#123;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">rgba</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, .<span class="number">15</span>)</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>Thanks for taking your time to read this random pointless article that possibly not going to help you 😉</p><hr class="footnotes-sep" /><section class="footnotes"><ol class="footnotes-list"><li id="fn1" class="footnote-item"><p>Censored f-words in this article for good. My blog is family friendly (well, technically, but this is not YouTube). <a href="#fnref1" class="footnote-backref">↩︎</a></p></li><li id="fn2" class="footnote-item"><p>I used a special space here called <a href="https://en.wiktionary.org/wiki/%E2%A0%80" target="_blank" rel="noopener">BRAILLE PATTERN BLANK</a>, <code>U+2800</code> if anyone need it <a href="#fnref2" class="footnote-backref">↩︎</a></p></li></ol></section>]]></content>
          408     
          409     <summary type="html">
          410     
          411       
          412       
          413         &lt;p&gt;The one thing I hate about the modern Internet is that it fills with too many fancy CSS elements, long-running JavaScripts, cookies to “&lt;
          414       
          415     
          416     </summary>
          417     
          418     
          419     
          420       <category term="Web" scheme="https://patrickwu.space/tags/Web/"/>
          421     
          422       <category term="CSS" scheme="https://patrickwu.space/tags/CSS/"/>
          423     
          424       <category term="HTML" scheme="https://patrickwu.space/tags/HTML/"/>
          425     
          426   </entry>
          427   
          428   <entry>
          429     <title>2019:淚與笑</title>
          430     <link href="https://patrickwu.space/2019/12/25/review-2019/"/>
          431     <id>https://patrickwu.space/2019/12/25/review-2019/</id>
          432     <published>2019-12-25T21:05:21.000Z</published>
          433     <updated>2021-06-19T14:13:15.351Z</updated>
          434     
          435     <content type="html"><![CDATA[<h2 id="2019我做到了嗎"><a class="markdownIt-Anchor" href="#2019我做到了嗎"></a> 2019,我做到了嗎?</h2><p>2018年,我為自己訂下了這些目標:</p><ul><li>寫完《和平路書報攤》和《WSL指北》;</li><li>認真的去找個女朋友;</li><li>繼續保持鍛鍊,瘦下來。</li></ul><p>所以,我做到了嗎?</p><h3 id="寫完和平路書報攤和wsl指北"><a class="markdownIt-Anchor" href="#寫完和平路書報攤和wsl指北"></a> 寫完《和平路書報攤》和《WSL指北》</h3><p>很遺憾,我一個字都沒動過。</p><h3 id="認真的去找個女朋友"><a class="markdownIt-Anchor" href="#認真的去找個女朋友"></a> 認真的去找個女朋友</h3><p>很遺憾,我連踏出這一步的勇氣都沒有。</p><h3 id="繼續保持鍛鍊瘦下來"><a class="markdownIt-Anchor" href="#繼續保持鍛鍊瘦下來"></a> 繼續保持鍛鍊,瘦下來</h3><p>唯一做到的事⋯⋯我瘦了7公斤!</p><h2 id="今年做了什麼"><a class="markdownIt-Anchor" href="#今年做了什麼"></a> 今年,做了什麼?</h2><p>2019, 這是一個我完全沒有預料到的一年。</p><p>1月,大四春季學期。這是我在香港科技大學的最有一個學期。在混亂與煎熬中,我終於完成了畢業設計。</p><p>5月,參加微軟開發者大會(Microsoft Build 2019),並與 Hayden 一起參與了講演。</p><p>6月,北京歷史夏令營。很榮幸能夠認識幾位大佬,讓我度過了個難忘的最後的大學生活。</p><p>7月,日本🇯🇵與新加坡🇸🇬之旅。</p><p>8月,入職。</p><p>9月,畢業申請通過。</p><p>10月,離職。在父母的鼓勵下,又去日本🇯🇵散心。</p><p>11月,畢業。</p><p>人生,就是這麼喜歡開玩笑。現在,在這個空氣中瀰漫着催淚彈氣味的寒冷的12月,我已經不知道我是在笑着哭,還是在哭着笑。</p><h2 id="讀了些啥"><a class="markdownIt-Anchor" href="#讀了些啥"></a> 讀了些啥?</h2><p>我從來沒有想象過,我在一年裏可以看這麼多的書。往年,我每年只會看兩到三本書,而今年,我看了20本書。沒時間不是不看書的理由,把自己花在社交媒體上的時間花在看書上,你會發現一個新的世界。</p><p>我統計了今年看得所有非工具書,共20本:</p><ul><li><strong>宇宙簡史:起源與歸宿 | The Theory of Everything: The Origin and Fate of the Universe</strong> by <em>Steven Hawking</em></li><li><strong>卓有成效的管理者 | The Effective Executive</strong> by <em>Peter F. Drucker</em></li><li><strong>拒絕藉口 | Never Excuse</strong> by <em>Orison</em></li><li><strong>詩説茶文化 | Tea Culture: From the Perspective of Poems</strong> by <em>劉景文</em></li><li><strong>帝國崛起病</strong> by <em>黃鐘</em></li><li><strong>夢的釋義 | Die Traumdeutung</strong> by <em>Sigmund Freud</em></li><li><strong>教父 | Godfather</strong> by <em>Mario Puzo</em></li><li><strong>北韓:從遊擊革命的金日成到迷霧籠罩的金正恩 | 조선민주주의인민공화국</strong> by <em>和田春樹</em></li><li><strong>What Money Can’t Buy: The Moral Limits of Markets</strong> by <em>Michael J. Sandel</em></li><li><strong>醜陋的中國人</strong> by <em>柏楊</em></li><li><strong>人生不設限:我那好得不像話的生命體驗 | Life Without Limits: Inspiration for a Ridiculously Good Life</strong> by <em>Nicholas James Vujicic</em></li><li><strong>The Maze Runner</strong> by <em>James Dashner</em></li><li><strong>David Copperfield</strong> by <em>Charles Dickens</em></li><li><strong>從0到1:開啟商業與未來的祕密 | Zero to One: Notes on Startups, or How to Build the Future</strong> by <em>Peter Thiel/Blake Masters</em></li><li><strong>戴維斯王朝 | Davis Dynasty: Fifty Tears of Successful Investing on Wall Street</strong> by <em>John Rothchild</em></li><li><strong>人間便利店 | コンビニ人間</strong> by <em>村田沙耶香</em></li><li><strong>刷新:重新發現商業與未來 | Hit Refresh: The Quest to Rediscover Microsoft’s Soul and Imagine a Better Future for Everyone</strong> by <em>Satya Nadella</em></li><li><strong>人間失格</strong> by <em>太宰治</em></li><li><strong>悲劇人偶 | 十字屋敷のピエロ</strong> by <em>東野圭吾</em></li><li><strong>What If?: Serious Scientific Answers to Absurd Hypothetical Questions</strong> by <em>Randall Munroe</em></li></ul><h2 id="我創造了啥"><a class="markdownIt-Anchor" href="#我創造了啥"></a> 我創造了啥?</h2><p>我開始使用 Unsplash 來展示我的攝影作品。新拍攝的作品意外的沒有我的舊照片這麼受歡迎。</p><p>我的 WSL Utilities 愈發的受到關注。在 GitHub 上項目已經超過600 Stars。 WSL Utilities 已經內建於 Ubuntu, Pengwin 以及 Fedora Remix,我也自行提交安裝包至 Alpine Linux,最近 Kali Linux 也提出了想要收錄 WSL Utilities 的意願。這是讓我最開心的,着意味着這兩年的工作我並沒有白費。</p><p>我開始了新的漫畫合集 “Jokes On Me”, 但是覺得畫得不是很好,暫時先撤下了。2020年,將會是這個系列的全新開始。</p><h2 id="2020干啥"><a class="markdownIt-Anchor" href="#2020干啥"></a> 2020,干啥?</h2><h3 id="開始做音樂"><a class="markdownIt-Anchor" href="#開始做音樂"></a> 開始做音樂</h3><p>這幾年來,我都沒有創造任何的音樂。不過隨着老的筆記本淘汰以及拿到了Macbook Pro,我雪藏在 iCloud 里的音樂將重獲新生。</p><h3 id="寫和平路書報攤和wsl指北"><a class="markdownIt-Anchor" href="#寫和平路書報攤和wsl指北"></a> 寫《和平路書報攤》和《WSL指北》</h3><p>不用寫完。寫完是一個很苛刻的要求。我不善寫作,這會給我很大的壓力。</p><h3 id="認真的去找個女朋友-2"><a class="markdownIt-Anchor" href="#認真的去找個女朋友-2"></a> 認真的去找個女朋友</h3><p>這個已經成爲了我的 Annual To-Do 了。不過,我真的應該找個女友了。再不找,我覺得我要老了。</p><h3 id="繼續鍛鍊"><a class="markdownIt-Anchor" href="#繼續鍛鍊"></a> 繼續鍛鍊</h3><p>不能放棄。</p><h3 id="找到一封工作考研成功"><a class="markdownIt-Anchor" href="#找到一封工作考研成功"></a> 找到一封工作/考研成功</h3><p>希望吧。</p><h2 id="後記"><a class="markdownIt-Anchor" href="#後記"></a> 後記</h2><p>我最近精神崩潰了好幾次。我只希望,我能夠哭着走出2019,笑着走出2020。</p><p>希望吧。</p><p>也只不過是個希望罷了。</p><p>Merry Christmas and Happy New Year.</p><blockquote><p>Patrick Wu J M, 2019年12月25日,聖誕節。</p></blockquote>]]></content>
          436     
          437     <summary type="html">
          438     
          439       
          440       
          441         &lt;h2 id=&quot;2019我做到了嗎&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#2019我做到了嗎&quot;&gt;&lt;/a&gt; 2019,我做到了嗎?&lt;/h2&gt;
          442 &lt;p&gt;2018年,我為自己訂下了這些目標:&lt;/p&gt;
          443 &lt;ul&gt;
          444 &lt;li&gt;寫完《和平路書報攤》和《WSL指北
          445       
          446     
          447     </summary>
          448     
          449     
          450     
          451       <category term="Annual Review" scheme="https://patrickwu.space/tags/Annual-Review/"/>
          452     
          453   </entry>
          454   
          455   <entry>
          456     <title>在WSL2上编译并使用Darling</title>
          457     <link href="https://patrickwu.space/2019/10/29/wsl2-darling-build-cn/"/>
          458     <id>https://patrickwu.space/2019/10/29/wsl2-darling-build-cn/</id>
          459     <published>2019-10-29T10:12:12.000Z</published>
          460     <updated>2021-06-19T14:13:15.355Z</updated>
          461     
          462     <content type="html"><![CDATA[<blockquote><p>翻译并修改自<a href="https://github.com/darlinghq/darling/issues/260#issuecomment-530184521" target="_blank" rel="noopener">darlinghq/darling issue #260 的评论</a></p></blockquote><h1 id="tldr"><a class="markdownIt-Anchor" href="#tldr"></a> TL;DR</h1><p>这篇文章将会讲述如何在 WSL2 上编译并使用<a href="http://www.darlinghq.org/" target="_blank" rel="noopener">Darling</a>,一款可以在 Linux 系统上运行 Darwin (就是 MacOS 的开源内核)的兼容层,就像 WineHQ 一样。</p><h2 id="编译-darling-和-wsl2-kernel"><a class="markdownIt-Anchor" href="#编译-darling-和-wsl2-kernel"></a> 编译 Darling 和 WSL2 Kernel</h2><p>打开 WSL Ubuntu,并依次键入以下指令。以下指令会下载、编译和安装除了 Kernel 以外大部分 Darling 组件,并下载、编译和安装一份修改过的 WSL Kernel并复制到C盘。</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line"># 确保32位依赖能正确安装</span><br><span class="line">sudo dpkg --add-architecture i386</span><br><span class="line">sudo apt-get update</span><br><span class="line"></span><br><span class="line"># 安装必要的安装包</span><br><span class="line">sudo apt-get install cmake clang bison flex xz-utils libfuse-dev libudev-dev pkg-config libc6-dev:i386 linux-headers-generic gcc-multilib libcap2-bin libcairo2-dev libgl1-mesa-dev libtiff5-dev libfreetype6-dev libfreetype6-dev:i386 git libelf-dev libxml2-dev libegl1-mesa-dev libfontconfig1-dev libbsd-dev libssl-dev</span><br><span class="line"></span><br><span class="line"># 克隆并编译 Darling</span><br><span class="line">git clone --recursive https:&#x2F;&#x2F;github.com&#x2F;darlinghq&#x2F;darling.git</span><br><span class="line">cd darling</span><br><span class="line">mkdir build &amp;&amp; cd build</span><br><span class="line">cmake ..</span><br><span class="line"></span><br><span class="line"># 链接一些文件到 &#96;&#x2F;usr&#x2F;include&#96;</span><br><span class="line">sudo ln -s &#x2F;usr&#x2F;include&#x2F;x86_64-linux-gnu&#x2F;jconfig.h &#x2F;usr&#x2F;include&#x2F;jconfig.h</span><br><span class="line">sudo ln -s &#x2F;usr&#x2F;include&#x2F;x86_64-linux-gnu&#x2F;tiffio.h &#x2F;usr&#x2F;include&#x2F;tiffio.h</span><br><span class="line">sudo ln -s &#x2F;usr&#x2F;include&#x2F;x86_64-linux-gnu&#x2F;tiff.h &#x2F;usr&#x2F;include&#x2F;tiff.h</span><br><span class="line">sudo ln -s &#x2F;usr&#x2F;include&#x2F;x86_64-linux-gnu&#x2F;tiffconf.h &#x2F;usr&#x2F;include&#x2F;tiffconf.h</span><br><span class="line">sudo ln -s &#x2F;usr&#x2F;include&#x2F;x86_64-linux-gnu&#x2F;tiffvers.h &#x2F;usr&#x2F;include&#x2F;tiffvers.h</span><br><span class="line">sudo ln -s &#x2F;usr&#x2F;include&#x2F;x86_64-linux-gnu&#x2F;tiffio.hxx &#x2F;usr&#x2F;include&#x2F;tiffio.hxx</span><br><span class="line"></span><br><span class="line"># 编译大部分Darling 组件</span><br><span class="line">make</span><br><span class="line">sudo make install</span><br><span class="line"></span><br><span class="line"># 在编译 Kernel 模块之前,我们需要编译</span><br><span class="line">cd ..</span><br><span class="line"></span><br><span class="line"># 克隆并修改 Kernel</span><br><span class="line">git clone --depth 1 --single-branch --branch master https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;WSL2-Linux-Kernel.git kernel</span><br><span class="line">cd kernel</span><br><span class="line">sed -i &#39;s&#x2F;CONFIG_EMBEDDED&#x3D;y&#x2F;CONFIG_EMBEDDED&#x3D;n&#x2F;g&#39; Microsoft&#x2F;config-wsl</span><br><span class="line"></span><br><span class="line"># 编译并安装 Kernel</span><br><span class="line">make KCONFIG_CONFIG&#x3D;Microsoft&#x2F;config-wsl</span><br><span class="line">sudo make modules_install</span><br><span class="line">sudo make install</span><br><span class="line">sudo update-initramfs -c -k 4.19.67-microsoft-standard+</span><br><span class="line"></span><br><span class="line"># 复制到C盘;当然,你也可以选择复制到任何地方</span><br><span class="line">mkdir &#x2F;mnt&#x2F;c&#x2F;linux-kernels</span><br><span class="line">cp &#x2F;boot&#x2F;vmlinuz-4.19.67-microsoft-standard+ &#x2F;mnt&#x2F;c&#x2F;linux-kernels&#x2F;vmlinuz-4.19.67-microsoft-standard+</span><br></pre></td></tr></table></figure><h2 id="修改-wsl2-使用的-kernel"><a class="markdownIt-Anchor" href="#修改-wsl2-使用的-kernel"></a> 修改 WSL2 使用的 Kernel</h2><p>现在在你 Windows 用户文件夹下创建(或编辑) <code>.wslconfig</code> ,加入以下内容:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[wsl2]</span><br><span class="line">#你的其他设置</span><br><span class="line">kernel&#x3D;C:\\linux-kernels\\vmlinuz-4.19.67-microsoft-standard+</span><br></pre></td></tr></table></figure><p>然后在 PowerShell 或者命令行里输入以下命令关闭所有运行中的 WSL 发行版:</p><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wsl --shutdown</span><br></pre></td></tr></table></figure><h2 id="编译-darling-kernel-模组"><a class="markdownIt-Anchor" href="#编译-darling-kernel-模组"></a> 编译 Darling Kernel 模组</h2><p>重新打开你的 WSL 窗口并执行以下命令。以下指令会编译并安装 Kernel 模组:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># get back to the directory you built Darling in</span></span><br><span class="line"><span class="built_in">cd</span> darling/build</span><br><span class="line">make lkm</span><br><span class="line">sudo make lkm_install</span><br></pre></td></tr></table></figure><h2 id="搞定"><a class="markdownIt-Anchor" href="#搞定"></a> 搞定!</h2><p>目前仍然有一个Bug使<code>darling shell</code> 只能以<code>root</code>用户运行,这意味着你只能用以下命令运行:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo darling shell</span><br></pre></td></tr></table></figure><p>然后享受 Darwin on Linux on Windows 吧!</p>]]></content>
          463     
          464     <summary type="html">
          465     
          466       
          467       
          468         &lt;blockquote&gt;
          469 &lt;p&gt;翻译并修改自&lt;a href=&quot;https://github.com/darlinghq/darling/issues/260#issuecomment-530184521&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;darlin
          470       
          471     
          472     </summary>
          473     
          474     
          475     
          476       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
          477     
          478       <category term="WSL2" scheme="https://patrickwu.space/tags/WSL2/"/>
          479     
          480       <category term="Darwin" scheme="https://patrickwu.space/tags/Darwin/"/>
          481     
          482   </entry>
          483   
          484   <entry>
          485     <title>在WSL上配置输入法</title>
          486     <link href="https://patrickwu.space/2019/10/28/wsl-fcitx-setup-cn/"/>
          487     <id>https://patrickwu.space/2019/10/28/wsl-fcitx-setup-cn/</id>
          488     <published>2019-10-28T22:12:00.000Z</published>
          489     <updated>2021-06-19T14:13:15.355Z</updated>
          490     
          491     <content type="html"><![CDATA[<h1 id="tldr"><a class="markdownIt-Anchor" href="#tldr"></a> TL;DR</h1><p>这篇文章会简述如何在WSL上配置输入法,以进行中日韩输入。安装以 Ubuntu 为例。</p><h2 id="为啥"><a class="markdownIt-Anchor" href="#为啥"></a> 为啥?</h2><p>WSL 在 GUI 下并不支持 Windows CJK 输入法的直接输入,所以要配置独立的输入法。这种方法既适用于Linux桌面环境,也适用于多窗口。</p><h2 id="安装-fcitx-小企鹅输入法"><a class="markdownIt-Anchor" href="#安装-fcitx-小企鹅输入法"></a> 安装 fcitx (小企鹅输入法)</h2><p>输入以下命令:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install fcitx fonts-noto-cjk fonts-noto-color-emoji dbus-x11</span><br></pre></td></tr></table></figure><p>这会安装 CJK 字体和 fcitx 核心。</p><p>然后,安装你想要使用的输入法。下表列出了一些比较常用的 fcitx 输入法:</p><table><thead><tr><th>语言</th><th>输入法</th><th>安装包名称</th></tr></thead><tbody><tr><td>中文</td><td>基于<code>sunpinyin</code>引擎的拼音输入法</td><td><code>fcitx-sunpinyin</code></td></tr><tr><td>中文</td><td>基于<code>libpinyin</code>引擎的拼音输入法</td><td><code>fcitx-libpinyin</code></td></tr><tr><td>中文</td><td>谷歌拼音输入法</td><td><code>fcitx-googlepinyin</code></td></tr><tr><td>中文</td><td>基于<code>rime</code>引擎的输入法</td><td><code>fcitx-rime</code></td></tr><tr><td>中文</td><td>新酷音输入法</td><td><code>fcitx-chewing</code></td></tr><tr><td>日文</td><td>基于<code>Anthy</code>引擎的日文输入法</td><td><code>fcitx-anthy</code></td></tr><tr><td>日文</td><td>基于<code>mozc</code>引擎的日文输入法</td><td><code>fcitx-mozc</code></td></tr><tr><td>日文</td><td>假名-汉字转换器(kkc)日文输入法</td><td><code>fcitx-kkc</code> <code>fcitx-kkc-dev</code></td></tr><tr><td>韩文</td><td>韩语输入法</td><td><code>fcitx-hangul</code></td></tr><tr><td>越南文</td><td>基于<code>unikey</code>引擎的越南文输入法</td><td><code>fcitx-unikey</code></td></tr><tr><td>僧伽罗文</td><td>僧伽罗文输入法</td><td><code>fcitx-sayura</code></td></tr><tr><td>-</td><td>码表类输入法</td><td><code>fcitx-table</code> <code>fcitx-table-all</code></td></tr></tbody></table><p>使用 <code>sudo apt install &lt;安装包名称&gt;</code>进行安装。</p><h2 id="配置输入环境"><a class="markdownIt-Anchor" href="#配置输入环境"></a> 配置输入环境</h2><p>首先使用root账号生成dbus机器码:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">dbus-uuidgen &gt; /var/lib/dbus/machine-id</span><br></pre></td></tr></table></figure><p>用<code>root</code>账号创建<code>/etc/profile.d/fcitx.sh</code>文件, 内容如下:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">!/bin/bash</span></span><br><span class="line">export QT_IM_MODULE=fcitx</span><br><span class="line">export GTK_IM_MODULE=fcitx</span><br><span class="line">export XMODIFIERS=@im=fcitx</span><br><span class="line">export DefaultIMModule=fcitx</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">可选,fcitx 自启</span></span><br><span class="line">fcitx-autostart &amp;&gt;/dev/null</span><br></pre></td></tr></table></figure><h2 id="初期配置"><a class="markdownIt-Anchor" href="#初期配置"></a> 初期配置</h2><p>首先确保你的 X 服务器已启动,并配置好了<code>DISPLAY</code>。WSL2 的话,请确保 WSL2 的公共 IP 可以与 X 服务器建立连接。</p><p>运行以下命令:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">export GTK_IM_MODULE=fcitx</span><br><span class="line">export QT_IM_MODULE=fcitx</span><br><span class="line">export XMODIFIERS=@im=fcitx</span><br><span class="line">export DefaultIMModule=fcitx</span><br><span class="line">fcitx-autostart &amp;&gt;/dev/null</span><br></pre></td></tr></table></figure><p><strong>fcitx</strong> 会启动。</p><p>运行 <code>fcitx-config-gtk3</code>,会出现如图的界面:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/fcitx-1.png" alt="" /></p><p>安装好后,如果没有看见输入法,点击左下角的**+**,搜索安装好的输入法:</p><p><img src="//cdn.patrickwu.space/posts/dev/wsl/fcitx-2.png" alt="" /></p><p>选择点击 OK 即可添加。</p><p>然后选择 <strong>Global Config</strong> ,将 <strong>Trigger Input Method</strong> 与 <strong>Scroll between Input Method</strong> 的快捷键修改掉(与微软拼音输入法快捷键冲突):</p><p><img src="//cdn.patrickwu.space/posts/dev/wsl/fcitx-3.png" alt="" /></p><p>至此,配置完成!</p><h2 id="效果"><a class="markdownIt-Anchor" href="#效果"></a> 效果</h2><p>在任意GUI应用用 <strong>Trigger Input</strong> 设置的快捷键启用输入法,用 <strong>Scroll between Input Method</strong> 的快捷键切换输入法,效果如下:</p><p><img src="//cdn.patrickwu.space/posts/dev/wsl/fcitx-4.png" alt="" /></p>]]></content>
          492     
          493     <summary type="html">
          494     
          495       
          496       
          497         &lt;h1 id=&quot;tldr&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#tldr&quot;&gt;&lt;/a&gt; TL;DR&lt;/h1&gt;
          498 &lt;p&gt;这篇文章会简述如何在WSL上配置输入法,以进行中日韩输入。安装以 Ubuntu 为例。&lt;/p&gt;
          499 &lt;h2 id=&quot;为啥&quot;&gt;&lt;a cl
          500       
          501     
          502     </summary>
          503     
          504     
          505     
          506       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
          507     
          508   </entry>
          509   
          510   <entry>
          511     <title>Setup Input Method for WSL</title>
          512     <link href="https://patrickwu.space/2019/10/28/wsl-fcitx-setup/"/>
          513     <id>https://patrickwu.space/2019/10/28/wsl-fcitx-setup/</id>
          514     <published>2019-10-28T22:12:00.000Z</published>
          515     <updated>2021-06-19T14:13:15.355Z</updated>
          516     
          517     <content type="html"><![CDATA[<h1 id="tldr"><a class="markdownIt-Anchor" href="#tldr"></a> TL;DR</h1><p>This article will talk about how to configure input method for CJK input. Using Ubuntu as example.</p><h2 id="why"><a class="markdownIt-Anchor" href="#why"></a> Why?</h2><p>WSL do not support direct CJK input from Windows input method, so we need to configure input method independently on WSL. This will applies to both multi-window mode and single-window mode on your preferred X Server.</p><h2 id="install-fcitx"><a class="markdownIt-Anchor" href="#install-fcitx"></a> Install fcitx</h2><p>Type the follwing command:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install fcitx fonts-noto-cjk fonts-noto-color-emoji dbus-x11</span><br></pre></td></tr></table></figure><p>This will install CJK fonts and <code>fcitx</code>.</p><p>Then, install the input method you want. Here is a list of common fcitx input method:</p><table><thead><tr><th>Language</th><th>Input Method</th><th>Package</th></tr></thead><tbody><tr><td>Chinese</td><td><code>sunpinyin</code>-based pinyin input</td><td><code>fcitx-sunpinyin</code></td></tr><tr><td>Chinese</td><td><code>libpinyin</code>-based pinyin input</td><td><code>fcitx-libpinyin</code></td></tr><tr><td>Chinese</td><td>Google Pyinyin Input</td><td><code>fcitx-googlepinyin</code></td></tr><tr><td>Chinese</td><td><code>rime</code>-based Chinese input</td><td><code>fcitx-rime</code></td></tr><tr><td>Chinese</td><td>Chewing Input</td><td><code>fcitx-chewing</code></td></tr><tr><td>Japanese</td><td><code>Anthy</code>-based Japanese Input</td><td><code>fcitx-anthy</code></td></tr><tr><td>Japanese</td><td><code>mozc</code>-based Japanese Input</td><td><code>fcitx-mozc</code></td></tr><tr><td>Japanese</td><td>Kana-Kanji Converter (kkc) Japanese Input</td><td><code>fcitx-kkc</code> <code>fcitx-kkc-dev</code></td></tr><tr><td>Korean</td><td>Korean Input</td><td><code>fcitx-hangul</code></td></tr><tr><td>Vietnamese</td><td><code>unikey</code>-based Vietnamese Input</td><td><code>fcitx-unikey</code></td></tr><tr><td>Sinhalese</td><td>Sinhalese Input</td><td><code>fcitx-sayura</code></td></tr><tr><td>-</td><td>Fcitx Tables Input</td><td><code>fcitx-table</code> <code>fcitx-table-all</code></td></tr></tbody></table><p>Install using  <code>sudo apt install &lt;Package&gt;</code>.</p><h2 id="confiure-environment"><a class="markdownIt-Anchor" href="#confiure-environment"></a> Confiure environment</h2><p>generate dbus machine id using <code>root</code> account:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">dbus-uuidgen &gt; /var/lib/dbus/machine-id</span><br></pre></td></tr></table></figure><p>create <code>/etc/profile.d/fcitx.sh</code> file using <code>root</code> account with following content:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">!/bin/bash</span></span><br><span class="line">export QT_IM_MODULE=fcitx</span><br><span class="line">export GTK_IM_MODULE=fcitx</span><br><span class="line">export XMODIFIERS=@im=fcitx</span><br><span class="line">export DefaultIMModule=fcitx</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">optional</span></span><br><span class="line">fcitx-autostart &amp;&gt;/dev/null</span><br></pre></td></tr></table></figure><h2 id="initial-configuration"><a class="markdownIt-Anchor" href="#initial-configuration"></a> Initial Configuration</h2><p>Make sure you X Server is already started and complete configured <code>DISPLAY</code>. For WSL2, make sure public access is granted on your X Server.</p><p>Run following commands:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">export GTK_IM_MODULE=fcitx</span><br><span class="line">export QT_IM_MODULE=fcitx</span><br><span class="line">export XMODIFIERS=@im=fcitx</span><br><span class="line">export DefaultIMModule=fcitx</span><br><span class="line">fcitx-autostart &amp;&gt;/dev/null</span><br></pre></td></tr></table></figure><p>fcitx will start now.</p><p>Run <code>fcitx-config-gtk3</code>, following interface will appear:</p><p><img src="https://cdn.patrickwu.space/posts/dev/wsl/fcitx-1.png" alt="" /></p><p>If you complete input installation but don’t see your input method,press <strong>+</strong> on the bottom left corner and search for the input you installed:</p><p><img src="//cdn.patrickwu.space/posts/dev/wsl/fcitx-2.png" alt="" /></p><p>Press <strong>OK</strong> to add.</p><p>Then choose <strong>Global Config</strong> and change the hotkey to **Trigger Input Method and <strong>Scroll between Input Method</strong> (They are conflict with Microsoft Pinyin Input Hotkey):</p><p><img src="//cdn.patrickwu.space/posts/dev/wsl/fcitx-3.png" alt="" /></p><p>Now, the configuration is complete!</p><h2 id="outcome"><a class="markdownIt-Anchor" href="#outcome"></a> Outcome</h2><p>In any GUI application, use the hotkey set for <strong>Trigger Input</strong> to start input method and use the hotkey set for <strong>Scroll between Input Method</strong> to switch input method, the outcome is like the following:</p><p><img src="//cdn.patrickwu.space/posts/dev/wsl/fcitx-4.png" alt="" /></p>]]></content>
          518     
          519     <summary type="html">
          520     
          521       
          522       
          523         &lt;h1 id=&quot;tldr&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#tldr&quot;&gt;&lt;/a&gt; TL;DR&lt;/h1&gt;
          524 &lt;p&gt;This article will talk about how to configure input method for CJ
          525       
          526     
          527     </summary>
          528     
          529     
          530     
          531       <category term="WSL" scheme="https://patrickwu.space/tags/WSL/"/>
          532     
          533   </entry>
          534   
          535   <entry>
          536     <title>Format drive larger than 2TiB in Alicloud</title>
          537     <link href="https://patrickwu.space/2019/08/28/server-alicloud-format-drive-larger-than-2tib/"/>
          538     <id>https://patrickwu.space/2019/08/28/server-alicloud-format-drive-larger-than-2tib/</id>
          539     <published>2019-08-28T11:02:12.000Z</published>
          540     <updated>2021-06-19T14:13:15.351Z</updated>
          541     
          542     <content type="html"><![CDATA[<h1 id="tldr"><a class="markdownIt-Anchor" href="#tldr"></a> TL;DR</h1><p>This is a quick reference for formatting Alicloud cloud drive that is higher than 2 TiB because the original guide is messy.</p><h2 id="steps"><a class="markdownIt-Anchor" href="#steps"></a> Steps</h2><ol><li>Check <code>parted</code> and <code>e2fsprogs</code> are both installed.</li><li>Usually cloud drive is automatically mounted at <code>/dev/vdb</code>, <code>/dev/vdc</code>, etc. check using <code>fdisk -l</code>.</li><li>Run <code>parted /dev/vdx</code>.</li><li>In new prompt, run <code>mklabel gpt</code>.</li><li>Create partition.<ul><li>For <strong>ext4</strong>: <code>mkpart primary ext4 0 -1</code>.</li><li>For <strong>xfs</strong>: <code>mkpart primary xfs 0 -1</code>.</li></ul></li><li><code>print</code> to check partition then exit by <code>exit</code>.</li><li>Run <code>partprobe</code> to make system re-read the partition table.</li><li>Set property to partion.<ul><li>For <strong>ext4</strong>: <code>mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize /dev/vdb1</code>.</li><li>For <strong>xfs</strong>: <code>mkfs -t xfs /dev/vdb1</code>.</li></ul></li><li><code>mkdir /storage &amp;&amp; mount /dev/vdb1 /storage</code> to mount at <code>/storage</code>.</li><li><code>umount /storage</code> to un-mount.</li></ol><h2 id="startup-setup"><a class="markdownIt-Anchor" href="#startup-setup"></a> Startup Setup</h2><ol><li>Backup fstab by <code>cp /etc/fstab /etc/fstab.bak</code>.</li><li><code>echo /dev/vdb1 /storage ext4 defaults 0 0 &gt;&gt; /etc/fstab</code> for ext4 and <code>echo /dev/vdb1 /storage xfs defaults 0 0 &gt;&gt; /etc/fstab</code> for xfs.</li><li>Verify by <code>cat /etc/fstab</code>.</li></ol>]]></content>
          543     
          544     <summary type="html">
          545     
          546       
          547       
          548         &lt;h1 id=&quot;tldr&quot;&gt;&lt;a class=&quot;markdownIt-Anchor&quot; href=&quot;#tldr&quot;&gt;&lt;/a&gt; TL;DR&lt;/h1&gt;
          549 &lt;p&gt;This is a quick reference for formatting Alicloud cloud drive tha
          550       
          551     
          552     </summary>
          553     
          554     
          555     
          556       <category term="Linux" scheme="https://patrickwu.space/tags/Linux/"/>
          557     
          558       <category term="Ubuntu" scheme="https://patrickwu.space/tags/Ubuntu/"/>
          559     
          560       <category term="Server" scheme="https://patrickwu.space/tags/Server/"/>
          561     
          562   </entry>
          563   
          564 </feed>