feat: add pyright

main
sudo pacman -Syu 2024-02-29 19:29:26 +07:00
parent e14b0fb3ff
commit 6c4262a7dc
38 changed files with 1998 additions and 1853 deletions

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Backup my way</h1>
<a
id="user-content-backup-my-way"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Backup my way"
href="#backup-my-way"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Backup my way
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
First thing first, I want to list my own devices, which I have through the
years:
@ -151,16 +151,16 @@
<strong>How to backup</strong>, the second is
<strong>Recovery strategy</strong>.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">How to backup</h2>
<a
id="user-content-how-to-backup"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: How to backup"
href="#how-to-backup"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>How to backup
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Before I talk about backup, I want to talk about data. In specifically,
which data should I backup?
@ -260,16 +260,16 @@ restic -r rclone:remote:PrivateData restore latest --target <span class="pl-k">~
<li>Store locally in my laptop</li>
<li>Don't store locally in phone (can not keep track easily)</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Backup work related data</h3>
<a
id="user-content-backup-work-related-data"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Backup work related data"
href="#backup-work-related-data"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Backup work related data
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>APIs tools:</p>
<ul>
<li>
@ -283,16 +283,16 @@ restic -r rclone:remote:PrivateData restore latest --target <span class="pl-k">~
Stay away from Postman, it's lag and you can accidentally upload private
data publicly.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Recovery strategy</h2>
<a
id="user-content-recovery-strategy"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Recovery strategy"
href="#recovery-strategy"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Recovery strategy
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
There are many strategies that I process to react as if something strange
is happening to my devices.
@ -314,16 +314,16 @@ restic -r rclone:remote:PrivateData restore latest --target <span class="pl-k">~
master password and OTP from Gmail, which I log in previously.
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Misc</h2>
<a
id="user-content-misc"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Misc"
href="#misc"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Misc
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
To backup everything is hard, so keep it simple and only backup important
things. Pick one then stay away from other cloud services:
@ -332,16 +332,16 @@ restic -r rclone:remote:PrivateData restore latest --target <span class="pl-k">~
<li>TODOis, Evernote, ... -&gt; Google Keep / Notion</li>
<li>Dropbox, OneDrive, ... -&gt; Google Drive</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">The end</h2>
<a
id="user-content-the-end"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: The end"
href="#the-end"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>The end
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>This guide will be updated regularly I promise.</p>
<div>

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Dockerfile for Go</h1>
<a
id="user-content-dockerfile-for-go"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Dockerfile for Go"
href="#dockerfile-for-go"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Dockerfile for Go
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Each time I start a new Go project, I repeat many steps. Like set up
<code>.gitignore</code>, CI configs, Dockerfile, ...
@ -165,16 +165,16 @@
<span class="pl-k">ENTRYPOINT</span> [<span class="pl-s">"/app"</span>]</pre>
</div>
<p>Finally, I copy <code>app</code> to Distroless base image.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a

View File

@ -28,32 +28,32 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Bootstrap Go</h1>
<a
id="user-content-bootstrap-go"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Bootstrap Go"
href="#bootstrap-go"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Bootstrap Go
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
It is hard to write bootstrap tool to quickly create Go service. So I
write this guide instead. This is a quick checklist for me every damn time
I need to write a Go service from scratch. Also, this is my personal
opinion, so feel free to comment.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Structure</h2>
<a
id="user-content-structure"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Structure"
href="#structure"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Structure
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-text-adblock">
<pre>
main.go
@ -135,16 +135,16 @@ internal
<code>business</code>.
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Do not repeat!</h2>
<a
id="user-content-do-not-repeat"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Do not repeat!"
href="#do-not-repeat"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Do not repeat!
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>If we have too many services, some of the logic will be overlapped.</p>
<p>
For example, service A and service B both need to make POST call API to
@ -157,26 +157,26 @@ internal
Another bad practice is adapter service. No need to write a new service if
what we need is just common pkg libs.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Taste on style guide</h2>
<a
id="user-content-taste-on-style-guide"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Taste on style guide"
href="#taste-on-style-guide"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Taste on style guide
</h2>
<h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h3 class="heading-element">Stop using global var</h3>
<a
id="user-content-stop-using-global-var"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Stop using global var"
href="#stop-using-global-var"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Stop using global var
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
If I see someone using global var, I swear I will shoot them twice in the
face.
@ -186,16 +186,18 @@ internal
<li>Can not write unit test.</li>
<li>Is not thread safe.</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Use functional options, but don't overuse it!
</h3>
<a
id="user-content-use-functional-options-but-dont-overuse-it"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use functional options, but don't overuse it!"
href="#use-functional-options-but-dont-overuse-it"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use functional options, but don't overuse it!
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
For simple struct with 1 or 2 fields, no need to use functional options.
</p>
@ -240,20 +242,22 @@ internal
<code>WithB</code> option. No need to pass direct field inside
<code>s</code>.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Use
<a href="https://pkg.go.dev/golang.org/x/sync/errgroup" rel="nofollow"
>errgroup</a
>
as much as possible
</h3>
<a
id="user-content-use-errgroup-as-much-as-possible"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use errgroup as much as possible"
href="#use-errgroup-as-much-as-possible"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use
<a href="https://pkg.go.dev/golang.org/x/sync/errgroup" rel="nofollow"
>errgroup</a
>
as much as possible
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
If business logic involves calling too many APIs, but they are not depend
on each other. We can fire them parallel :)
@ -285,36 +289,40 @@ internal
<span class="pl-c">// Handle error</span>
}</pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Use
<a href="https://pkg.go.dev/golang.org/x/sync/semaphore" rel="nofollow"
>semaphore</a
>
when need to implement WorkerPool
</h3>
<a
id="user-content-use-semaphore-when-need-to-implement-workerpool"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use semaphore when need to implement WorkerPool"
href="#use-semaphore-when-need-to-implement-workerpool"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use
<a href="https://pkg.go.dev/golang.org/x/sync/semaphore" rel="nofollow"
>semaphore</a
>
when need to implement WorkerPool
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Please don't use external libs for WorkerPool, I don't want to deal with
dependency hell.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Use
<a href="https://pkg.go.dev/sync#Pool" rel="nofollow">sync.Pool</a> when
need to reuse object, mainly for <code>bytes.Buffer</code>
</h3>
<a
id="user-content-use-syncpool-when-need-to-reuse-object-mainly-for-bytesbuffer"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use sync.Pool when need to reuse object, mainly for bytes.Buffer"
href="#use-syncpool-when-need-to-reuse-object-mainly-for-bytesbuffer"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use
<a href="https://pkg.go.dev/sync#Pool" rel="nofollow">sync.Pool</a> when
need to reuse object, mainly for <code>bytes.Buffer</code>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Example:</p>
<div class="highlight highlight-source-go">
<pre><span class="pl-k">var</span> <span class="pl-s1">bufPool</span> <span class="pl-c1">=</span> sync.<span class="pl-smi">Pool</span>{
@ -343,18 +351,21 @@ internal
<span class="pl-k">return</span> <span class="pl-s1">result</span>, <span class="pl-c1">nil</span>
}</pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
<a href="https://go.dev/doc/tutorial/generics" rel="nofollow"
>Generics</a
>
with some tricks
</h3>
<a
id="user-content-generics-with-some-tricks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Generics with some tricks"
href="#generics-with-some-tricks"
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
<a href="https://go.dev/doc/tutorial/generics" rel="nofollow">Generics</a>
with some tricks
</h3>
</div>
<p>
Take value then return pointer, useful with database struct full of
pointers:
@ -372,40 +383,42 @@ internal
<span class="pl-k">return</span> <span class="pl-s1">zero</span>
}</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">External libs</h2>
<a
id="user-content-external-libs"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: External libs"
href="#external-libs"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>External libs
</h2>
<h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h3 class="heading-element">No need <code>vendor</code></h3>
<a
id="user-content-no-need-vendor"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: No need vendor"
href="#no-need-vendor"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>No need <code>vendor</code>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Only need if you need something from <code>vendor</code>, to generate mock
or something else.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Use <code>build.go</code> to include build tools in go.mod
</h3>
<a
id="user-content-use-buildgo-to-include-build-tools-in-gomod"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use build.go to include build tools in go.mod"
href="#use-buildgo-to-include-build-tools-in-gomod"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use <code>build.go</code> to include build tools in go.mod
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>To easily control version of build tools.</p>
<p>For example <code>build.go</code>:</p>
<div class="highlight highlight-source-go">
@ -427,19 +440,21 @@ internal
We always get the version of build tools in <code>go.mod</code> each time
we install it. Future contributors will not cry anymore.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Don't use cli libs (<a href="https://github.com/spf13/cobra"
>spf13/cobra</a
>, <a href="https://github.com/urfave/cli">urfave/cli</a>) just for Go
service
</h3>
<a
id="user-content-dont-use-cli-libs-spf13cobra-urfavecli-just-for-go-service"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Don't use cli libs (spf13/cobra, urfave/cli) just for Go service"
href="#dont-use-cli-libs-spf13cobra-urfavecli-just-for-go-service"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Don't use cli libs (<a href="https://github.com/spf13/cobra"
>spf13/cobra</a
>, <a href="https://github.com/urfave/cli">urfave/cli</a>) just for Go
service
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
What is the point to pass many params (<code>do-it</code>,
<code>--abc</code>, <code>--xyz</code>) when what we only need is start
@ -451,19 +466,21 @@ internal
<a href="https://12factor.net/" rel="nofollow">The Twelve Factors</a>
guide.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Don't use
<a href="https://github.com/grpc-ecosystem/grpc-gateway"
>grpc-ecosystem/grpc-gateway</a
>
</h3>
<a
id="user-content-dont-use-grpc-ecosystemgrpc-gateway"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Don't use grpc-ecosystem/grpc-gateway"
href="#dont-use-grpc-ecosystemgrpc-gateway"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Don't use
<a href="https://github.com/grpc-ecosystem/grpc-gateway"
>grpc-ecosystem/grpc-gateway</a
>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Just don't.</p>
<p>
Use
@ -475,32 +492,37 @@ internal
Write 1 for both gRPC, REST sounds good, but in the end, it is not worth
it.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Don't use
<a href="https://github.com/uber/prototool">uber/prototool</a>, use
<a href="https://github.com/bufbuild/buf">bufbuild/buf</a>
</h3>
<a
id="user-content-dont-use-uberprototool-use-bufbuildbuf"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Don't use uber/prototool, use bufbuild/buf"
href="#dont-use-uberprototool-use-bufbuildbuf"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Don't use <a href="https://github.com/uber/prototool">uber/prototool</a>,
use <a href="https://github.com/bufbuild/buf">bufbuild/buf</a>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
prototool is deprecated, and buf can generate, lint, format as good as
prototool.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Use <a href="https://github.com/gin-gonic/gin">gin-gonic/gin</a> for
REST.
</h3>
<a
id="user-content-use-gin-gonicgin-for-rest"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use gin-gonic/gin for REST."
href="#use-gin-gonicgin-for-rest"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use <a href="https://github.com/gin-gonic/gin">gin-gonic/gin</a> for
REST.
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>With <code>c *gin.Context</code>:</p>
<ul>
<li>
@ -520,17 +542,19 @@ internal
}
}()</pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
If you want log, just use
<a href="https://github.com/uber-go/zap">uber-go/zap</a>
</h3>
<a
id="user-content-if-you-want-log-just-use-uber-gozap"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: If you want log, just use uber-go/zap"
href="#if-you-want-log-just-use-uber-gozap"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>If you want log, just use
<a href="https://github.com/uber-go/zap">uber-go/zap</a>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>It is fast!</p>
<ul>
<li>
@ -552,17 +576,19 @@ internal
for easily debug.
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
To read config, use
<a href="https://github.com/spf13/viper">spf13/viper</a>
</h3>
<a
id="user-content-to-read-config-use-spf13viper"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: To read config, use spf13/viper"
href="#to-read-config-use-spf13viper"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>To read config, use
<a href="https://github.com/spf13/viper">spf13/viper</a>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Only init config in main or cmd layer. Do not use
<code>viper.Get...</code> in business layer or inside business layer.
@ -576,16 +602,18 @@ internal
Also, be careful if config value is empty. You should decide to continue
or stop the service if there is empty config.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Don't overuse ORM libs, no need to handle another layer above SQL.
</h3>
<a
id="user-content-dont-overuse-orm-libs-no-need-to-handle-another-layer-above-sql"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Don't overuse ORM libs, no need to handle another layer above SQL."
href="#dont-overuse-orm-libs-no-need-to-handle-another-layer-above-sql"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Don't overuse ORM libs, no need to handle another layer above SQL.
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Each ORM libs has each different syntax. To learn and use those libs
correctly is time consuming. So just stick to plain SQL. It is easier to
@ -606,17 +634,19 @@ internal
those cases. I hear that
<a href="https://github.com/go-gorm/gorm">go-gorm/gorm</a> is good.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Connect Redis with
<a href="https://github.com/redis/go-redis">redis/go-redis</a>
</h3>
<a
id="user-content-connect-redis-with-redisgo-redis"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Connect Redis with redis/go-redis"
href="#connect-redis-with-redisgo-redis"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Connect Redis with
<a href="https://github.com/redis/go-redis">redis/go-redis</a>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Be careful when use
<a href="https://redis.io/commands/hgetall/" rel="nofollow">HGETALL</a>.
@ -677,17 +707,19 @@ internal
<ul>
<li><code>ReadTimeout</code>, <code>WriteTimeout</code></li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Connect MySQL with
<a href="https://github.com/go-sql-driver/mysql">go-sql-driver/mysql</a>
</h3>
<a
id="user-content-connect-mysql-with-go-sql-drivermysql"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Connect MySQL with go-sql-driver/mysql"
href="#connect-mysql-with-go-sql-drivermysql"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Connect MySQL with
<a href="https://github.com/go-sql-driver/mysql">go-sql-driver/mysql</a>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Remember to config:</p>
<ul>
<li><code>SetConnMaxLifetime</code></li>
@ -698,19 +730,21 @@ internal
<li><code>CheckConnLiveness</code> to true.</li>
<li><code>ReadTimeout</code>, <code>WriteTimeout</code></li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Connect SQLite with
<a href="https://gitlab.com/cznic/sqlite" rel="nofollow"
>modernc.org/sqlite</a
>
</h3>
<a
id="user-content-connect-sqlite-with-moderncorgsqlite"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Connect SQLite with modernc.org/sqlite"
href="#connect-sqlite-with-moderncorgsqlite"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Connect SQLite with
<a href="https://gitlab.com/cznic/sqlite" rel="nofollow"
>modernc.org/sqlite</a
>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Remember to config:</p>
<ul>
<li>Write-Ahead Logging: <code>PRAGMA journal_mode=WAL</code></li>
@ -723,16 +757,19 @@ internal
<a href="https://github.com/mattn/go-sqlite3">mattn/go-sqlite3</a>, it's
required <code>CGO_ENABLED</code>.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Connect Kafka with
<a href="https://github.com/IBM/sarama">IBM/sarama</a>
</h3>
<a
id="user-content-connect-kafka-with-ibmsarama"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Connect Kafka with IBM/sarama"
href="#connect-kafka-with-ibmsarama"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Connect Kafka with <a href="https://github.com/IBM/sarama">IBM/sarama</a>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Use <code>sarama.V1_0_0_0</code>, because IBM decide to upgrade default
version.
@ -743,33 +780,37 @@ internal
>confluentinc/confluent-kafka-go</a
>, it's required <code>CGO_ENABLED</code>.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
If you want test, just use
<a href="https://github.com/stretchr/testify">stretchr/testify</a>.
</h3>
<a
id="user-content-if-you-want-test-just-use-stretchrtestify"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: If you want test, just use stretchr/testify."
href="#if-you-want-test-just-use-stretchrtestify"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>If you want test, just use
<a href="https://github.com/stretchr/testify">stretchr/testify</a>.
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
It is easy to write a suite test, thanks to testify. Also, for mocking,
there are many options out there. Pick 1 then sleep peacefully.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
If need to mock, choose
<a href="https://github.com/matryer/moq">matryer/moq</a> or
<a href="https://github.com/uber/mock">uber/mock</a>
</h3>
<a
id="user-content-if-need-to-mock-choose-matryermoq-or-ubermock"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: If need to mock, choose matryer/moq or uber/mock"
href="#if-need-to-mock-choose-matryermoq-or-ubermock"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>If need to mock, choose
<a href="https://github.com/matryer/moq">matryer/moq</a> or
<a href="https://github.com/uber/mock">uber/mock</a>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
The first is easy to use but not powerful as the later. If you want to
make sure mock func is called with correct times, use the later.
@ -780,16 +821,18 @@ internal
<span class="pl-c">// https://jonwillia.ms/2019/12/22/conditional-gomock-mockgen</span>
<span class="pl-c">//go:generate sh -c "test service_mock_generated.go -nt $GOFILE &amp;&amp; exit 0; moq -rm -out service_mock_generated.go . Service"</span></pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Be careful with <a href="https://github.com/spf13/cast">spf13/cast</a>
</h3>
<a
id="user-content-be-careful-with-spf13cast"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Be careful with spf13/cast"
href="#be-careful-with-spf13cast"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Be careful with <a href="https://github.com/spf13/cast">spf13/cast</a>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Don't cast proto enum:</p>
<div class="highlight highlight-source-go">
<pre><span class="pl-c">// Bad</span>
@ -798,22 +841,24 @@ internal
<span class="pl-c">// Good</span>
<span class="pl-s1">a</span> <span class="pl-c1">:=</span> <span class="pl-en">int32</span>(<span class="pl-s1">servicev1</span>.<span class="pl-c1">ReasonCode_ABC</span>)</pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Use
<a
href="https://pkg.go.dev/golang.org/x/tools/cmd/stringer"
rel="nofollow"
>stringer</a
>
if you want your type enum can be print as string
</h3>
<a
id="user-content-use-stringer-if-you-want-your-type-enum-can-be-print-as-string"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use stringer if you want your type enum can be print as string"
href="#use-stringer-if-you-want-your-type-enum-can-be-print-as-string"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use
<a
href="https://pkg.go.dev/golang.org/x/tools/cmd/stringer"
rel="nofollow"
>stringer</a
>
if you want your type enum can be print as string
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-go">
<pre><span class="pl-k">type</span> <span class="pl-smi">Drink</span> <span class="pl-smi">int</span>
@ -829,52 +874,58 @@ internal
<span class="pl-c"><span class="pl-c">#</span> Run inside directory which contains Drink</span>
stringer -type=Drink</pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Don't waste your time rewrite rate limiter if your use case is simple,
use
<a href="https://pkg.go.dev/golang.org/x/time/rate" rel="nofollow"
>rate</a
>
or
<a href="https://github.com/go-redis/redis_rate">go-redis/redis_rate</a>
</h3>
<a
id="user-content-dont-waste-your-time-rewrite-rate-limiter-if-your-use-case-is-simple-use-rate-or-go-redisredis_rate"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Don't waste your time rewrite rate limiter if your use case is simple, use rate or go-redis/redis_rate"
href="#dont-waste-your-time-rewrite-rate-limiter-if-your-use-case-is-simple-use-rate-or-go-redisredis_rate"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Don't waste your time rewrite rate limiter if your use case is simple,
use
<a href="https://pkg.go.dev/golang.org/x/time/rate" rel="nofollow"
>rate</a
>
or
<a href="https://github.com/go-redis/redis_rate">go-redis/redis_rate</a>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<strong>rate</strong> if you want rate limiter locally in your single
instance of service. <strong>redis_rate</strong> if you want rate limiter
distributed across all your instances of service.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Replace <code>go fmt</code>, <code>goimports</code> with
<a href="https://github.com/mvdan/gofumpt">mvdan/gofumpt</a>.
</h3>
<a
id="user-content-replace-go-fmt-goimports-with-mvdangofumpt"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Replace go fmt, goimports with mvdan/gofumpt."
href="#replace-go-fmt-goimports-with-mvdangofumpt"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Replace <code>go fmt</code>, <code>goimports</code> with
<a href="https://github.com/mvdan/gofumpt">mvdan/gofumpt</a>.
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p><code>gofumpt</code> provides more rules when format Go codes.</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
Use
<a href="https://github.com/golangci/golangci-lint"
>golangci/golangci-lint</a
>.
</h3>
<a
id="user-content-use-golangcigolangci-lint"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use golangci/golangci-lint."
href="#use-golangcigolangci-lint"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use
<a href="https://github.com/golangci/golangci-lint"
>golangci/golangci-lint</a
>.
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>No need to say more. Lint or get the f out!</p>
<p>
If you get <code>fieldalignment</code> error, use
@ -892,16 +943,16 @@ go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignme
<span class="pl-c"><span class="pl-c">#</span> Fix</span>
fieldalignment -fix ./internal/business/<span class="pl-k">*</span>.go</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Snippet/script</h2>
<a
id="user-content-snippetscript"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Snippet/script"
href="#snippetscript"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Snippet/script
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Change import:</p>
<div class="highlight highlight-source-shell">
<pre>gofmt -w -r <span class="pl-s"><span class="pl-pds">'</span>"github.com/Sirupsen/logrus" -&gt; "github.com/sirupsen/logrus"<span class="pl-pds">'</span></span> <span class="pl-k">*</span>.go</pre>
@ -910,16 +961,16 @@ fieldalignment -fix ./internal/business/<span class="pl-k">*</span>.go</pre>
<div class="highlight highlight-source-shell">
<pre>go clean -cache -testcache -modcache -fuzzcache -x</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">UUID or else</h1>
<a
id="user-content-uuid-or-else"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: UUID or else"
href="#uuid-or-else"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>UUID or else
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
There are many use cases where we need to use a unique ID. In my
experience, I only encouter 2 cases:
@ -56,16 +56,18 @@
<li><a href="https://github.com/segmentio/ksuid">segmentio/ksuid</a></li>
<li><a href="https://github.com/oklog/ulid">oklog/ulid</a></li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
First use case is trace ID, or context aware ID
</h2>
<a
id="user-content-first-use-case-is-trace-id-or-context-aware-id"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: First use case is trace ID, or context aware ID"
href="#first-use-case-is-trace-id-or-context-aware-id"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>First use case is trace ID, or context aware ID
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
The ID is used only for trace and log. If same ID is generated twice
(because maybe the possibilty is too small but not 0), honestly I don't
@ -76,16 +78,18 @@
My choice for this use case is <strong>rs/xid</strong>. Because it is
small (not span too much on log line) and copy friendly.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
Second use case is primary key, also hard choice
</h2>
<a
id="user-content-second-use-case-is-primary-key-also-hard-choice"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Second use case is primary key, also hard choice"
href="#second-use-case-is-primary-key-also-hard-choice"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Second use case is primary key, also hard choice
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Why I don't use auto increment key for primary key? The answer is simple,
I don't want to write database specific SQL. SQLite has some different
@ -101,30 +105,30 @@
database is sensitive subject, and I need more testing and battle test
proof to trust those libs.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">What else?</h2>
<a
id="user-content-what-else"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: What else?"
href="#what-else"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>What else?
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
I think about adding prefix to ID to identify which resource that ID
represents.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a

View File

@ -28,16 +28,18 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">
Migrate to <code>buf</code> from <code>prototool</code>
</h1>
<a
id="user-content-migrate-to-buf-from-prototool"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Migrate to buf from prototool"
href="#migrate-to-buf-from-prototool"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Migrate to <code>buf</code> from <code>prototool</code>
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Why? Because <code>prototool</code> is outdated, and can not run on M1
mac.
@ -146,16 +148,16 @@
sed -i "" -e "s/import \"marshal-zap\.proto\";//g" ./raw/api.proto
sed -i "" -e "s/\[(marshal_zap\.mask) = true]//g" ./raw/api.proto</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">FAQ</h2>
<a
id="user-content-faq"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: FAQ"
href="#faq"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>FAQ
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Remember <code>bufbuild/protoc-gen-validate</code>,
<code>kei2100/protoc-gen-marshal-zap</code>,
@ -204,16 +206,16 @@
compatibility.
</li>
</ul>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Tips</h1>
<a
id="user-content-tips"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Tips"
href="#tips"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Tips
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Some experience I got after writing proto files for a living:</p>
<ul>
<li>
@ -225,16 +227,16 @@
<code>sed</code> to fix the damn things.
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li><a href="https://github.com/uber/prototool">uber/prototool</a></li>
<li><a href="https://github.com/bufbuild/buf">bufbuild/buf</a></li>

View File

@ -28,30 +28,32 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Experiment Go</h1>
<a
id="user-content-experiment-go"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Experiment Go"
href="#experiment-go"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Experiment Go
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
There come a time when you need to experiment new things, new style, new
approach. So this post serves as it is named.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
Design API by trimming down the interface/struct or whatever
</h2>
<a
id="user-content-design-api-by-trimming-down-the-interfacestruct-or-whatever"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Design API by trimming down the interface/struct or whatever"
href="#design-api-by-trimming-down-the-interfacestruct-or-whatever"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Design API by trimming down the interface/struct or whatever
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Instead of:</p>
<div class="highlight highlight-source-go">
<pre><span class="pl-k">type</span> <span class="pl-smi">Client</span> <span class="pl-k">interface</span> {
@ -104,17 +106,19 @@
This pattern is used by
<a href="https://github.com/google/go-github">google/go-github</a>.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
Find alternative to
<a href="https://github.com/grpc/grpc-go">grpc/grpc-go</a>
</h2>
<a
id="user-content-find-alternative-to-grpcgrpc-go"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Find alternative to grpc/grpc-go"
href="#find-alternative-to-grpcgrpc-go"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Find alternative to
<a href="https://github.com/grpc/grpc-go">grpc/grpc-go</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Why?
<a
@ -146,16 +150,16 @@
<li><a href="https://github.com/twitchtv/twirp">twitchtv/twirp</a></li>
<li><a href="https://github.com/storj/drpc">storj/drpc</a></li>
</ul>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Thanks</h1>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">SQL</h1>
<a
id="user-content-sql"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: SQL"
href="#sql"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>SQL
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Previously in my fresher software developer time, I rarely write SQL, I
always use ORM to wrap SQL. But time past and too much abstraction bites
@ -48,30 +48,30 @@
This guide is not kind of guide which cover all cases. Just my little
tricks when I work with SQL.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Stay away from database unique id</h2>
<a
id="user-content-stay-away-from-database-unique-id"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Stay away from database unique id"
href="#stay-away-from-database-unique-id"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Stay away from database unique id
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Use UUID instead. If you can, and you should, choose UUID type which can
be sortable.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Stay away from database timestamp</h2>
<a
id="user-content-stay-away-from-database-timestamp"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Stay away from database timestamp"
href="#stay-away-from-database-timestamp"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Stay away from database timestamp
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Stay away from all kind of database timestamp (MySQL timestmap, SQLite
timestamp, ...) Just use int64 then pass the timestamp in service layer
@ -89,16 +89,16 @@
[Business] time, data -&gt; convert to unix timestamp milliseconds -&gt; [Database] int64</pre
>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Extra field for extra things</h2>
<a
id="user-content-extra-field-for-extra-things"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Extra field for extra things"
href="#extra-field-for-extra-things"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Extra field for extra things
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Create new column in database is scary, so I suggest avoid it if you can.
How to avoid, first design table with extra field. It is black hole, put
@ -126,16 +126,16 @@
Use <code>JSON_EXTRACT(col, '$.key') IS NULL</code> to check json field
exist or not.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Use index!!!</h2>
<a
id="user-content-use-index"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use index!!!"
href="#use-index"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use index!!!
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
You should use index for faster query, but not too much. Don't create
index for every fields in table. Choose wisely!
@ -177,16 +177,16 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Be careful with UTF-8</h2>
<a
id="user-content-be-careful-with-utf-8"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Be careful with UTF-8"
href="#be-careful-with-utf-8"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Be careful with UTF-8
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>TLDR with MySQL:</p>
<div class="highlight highlight-source-sql">
<pre><span class="pl-k">CREATE</span> <span class="pl-k">TABLE</span> <span class="pl-en">ekyc_approved</span>
@ -196,16 +196,16 @@
) ENGINE <span class="pl-k">=</span> InnoDB
DEFAULT CHARSET <span class="pl-k">=</span> utf8mb4;</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Be careful with NULL</h2>
<a
id="user-content-be-careful-with-null"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Be careful with NULL"
href="#be-careful-with-null"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Be careful with NULL
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
If compare with field which can be NULL, remember to check NULL for
safety.
@ -224,47 +224,48 @@ SELECT <span class="pl-k">*</span>
<span class="pl-k">WHERE</span> (field_something IS <span class="pl-k">NULL</span> <span class="pl-k">OR</span> field_something <span class="pl-k">!=</span> <span class="pl-c1">1</span>)</pre>
</div>
<p>Need clarify why this happpen? Idk :(</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element"><code>VARCHAR</code> or <code>TEXT</code></h2>
<a
id="user-content-varchar-or-text"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: VARCHAR or TEXT"
href="#varchar-or-text"
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
<code>VARCHAR</code> or <code>TEXT</code>
</h2>
</div>
<p>
Prefer <code>VARCHAR</code> if you need to query and of course use index,
and make sure size of value will never hit the limit. Prefer
<code>TEXT</code> if you don't care, just want to store something.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element"><code>LIMIT</code></h2>
<a
id="user-content-limit"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: LIMIT"
href="#limit"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><code>LIMIT</code>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Prefer <code>LIMIT 10 OFFSET 5</code> to <code>LIMIT 5, 10</code> to avoid
misunderstanding.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
Be super careful when migrate, update database on production and
online!!!
</h2>
<a
id="user-content-be-super-careful-when-migrate-update-database-on-production-and-online"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Be super careful when migrate, update database on production and online!!!"
href="#be-super-careful-when-migrate-update-database-on-production-and-online"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Be super careful when migrate, update database on production and
online!!!
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Plase read docs about online ddl operations before do anything online
(keep database running the same time update it, for example create index,
@ -296,27 +297,27 @@ SELECT <span class="pl-k">*</span>
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Heathcheck</h2>
<a
id="user-content-heathcheck"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Heathcheck"
href="#heathcheck"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Heathcheck
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Use <code>SELECT 1</code> to check if database failed yet.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Tools</h2>
<a
id="user-content-tools"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Tools"
href="#tools"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Tools
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
Use
@ -328,16 +329,16 @@ SELECT <span class="pl-k">*</span>
database reality :)
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://use-the-index-luke.com/" rel="nofollow"

View File

@ -28,27 +28,27 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">gitignore</h1>
<a
id="user-content-gitignore"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: gitignore"
href="#gitignore"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>gitignore
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>My quick check for <code>.gitignore</code>.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Base</h2>
<a
id="user-content-base"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Base"
href="#base"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Base
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-text-adblock">
<pre><span class="pl-c"># macOS</span>
.DS_Store
@ -62,16 +62,16 @@
<span class="pl-c"># VSCode</span>
.vscode/</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Go</h2>
<a
id="user-content-go"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Go"
href="#go"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Go
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-text-adblock">
<pre><span class="pl-c"># Go</span>
<span class="pl-c"># Test coverage</span>
@ -80,16 +80,16 @@ coverage.out
<span class="pl-c"># Should ignore vendor</span>
vendor</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Python</h2>
<a
id="user-content-python"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Python"
href="#python"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Python
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-text-adblock"><pre>venv</pre></div>
<div>

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Reload config</h1>
<a
id="user-content-reload-config"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Reload config"
href="#reload-config"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Reload config
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>This serves as design draft of reload config system</p>
<div class="highlight highlight-source-wsd">
<pre><span class="pl-k">@startuml</span> Reload config

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Install Arch Linux</h1>
<a
id="user-content-install-arch-linux"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Install Arch Linux"
href="#install-arch-linux"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Install Arch Linux
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Install Arch Linux is thing I always want to do for my laptop/PC since I
had my laptop in ninth grade.
@ -46,30 +46,32 @@
This is not a guide for everyone, this is just save for myself in a future
and for anyone who want to walk in my shoes.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a
href="https://wiki.archlinux.org/index.php/Installation_guide"
rel="nofollow"
>Installation guide</a
>
</h2>
<a
id="user-content-installation-guide"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Installation guide"
href="#installation-guide"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a
href="https://wiki.archlinux.org/index.php/Installation_guide"
rel="nofollow"
>Installation guide</a
>
</h2>
<h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h3 class="heading-element">Pre-installation</h3>
<a
id="user-content-pre-installation"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Pre-installation"
href="#pre-installation"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Pre-installation
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Check disks carefully:</p>
<div class="highlight highlight-source-shell"><pre>lsblk</pre></div>
<p>
@ -79,44 +81,44 @@
>USB flash installation medium</a
>
</p>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Verify the boot mode</h4>
<a
id="user-content-verify-the-boot-mode"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Verify the boot mode"
href="#verify-the-boot-mode"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Verify the boot mode
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Check UEFI mode:</p>
<div class="highlight highlight-source-shell">
<pre>ls /sys/firmware/efi/efivars</pre>
</div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Connect to the internet</h4>
<a
id="user-content-connect-to-the-internet"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Connect to the internet"
href="#connect-to-the-internet"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Connect to the internet
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
For wifi, use
<a href="https://wiki.archlinux.org/index.php/Iwd" rel="nofollow">iwd</a>.
</p>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Partition the disks</h4>
<a
id="user-content-partition-the-disks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Partition the disks"
href="#partition-the-disks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Partition the disks
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<a href="https://wiki.archlinux.org/index.php/GPT_fdisk" rel="nofollow"
>GPT fdisk</a
@ -240,16 +242,16 @@ mount --mkdir /dev/efi_system_partition /mnt/efi
<span class="pl-c"><span class="pl-c">#</span> boot</span>
mount --mkdir /dev/extended_boot_loader_partition /mnt/boot</pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Installation</h3>
<a
id="user-content-installation"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Installation"
href="#installation"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Installation
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>pacstrap -K /mnt base linux linux-firmware
@ -268,54 +270,56 @@ pacstrap -K /mnt lvm2
<span class="pl-c"><span class="pl-c">#</span> Text editor</span>
pacstrap -K /mnt neovim</pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Configure</h3>
<a
id="user-content-configure"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Configure"
href="#configure"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Configure
</h3>
<h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h4 class="heading-element">
<a href="https://wiki.archlinux.org/index.php/Fstab" rel="nofollow"
>fstab</a
>
</h4>
<a
id="user-content-fstab"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: fstab"
href="#fstab"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://wiki.archlinux.org/index.php/Fstab" rel="nofollow"
>fstab</a
>
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>genfstab -U /mnt <span class="pl-k">&gt;&gt;</span> /mnt/etc/fstab</pre>
</div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Chroot</h4>
<a
id="user-content-chroot"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Chroot"
href="#chroot"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Chroot
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>arch-chroot /mnt</pre>
</div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Time zone</h4>
<a
id="user-content-time-zone"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Time zone"
href="#time-zone"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Time zone
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
@ -323,16 +327,16 @@ ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc</pre
>
</div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Localization:</h4>
<a
id="user-content-localization"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Localization:"
href="#localization"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Localization:
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Edit <code>/etc/locale.gen</code>:</p>
<div class="highlight highlight-text-adblock">
<pre><span class="pl-c"># Uncomment en_US.UTF-8 UTF-8</span></pre>
@ -343,28 +347,28 @@ hwclock --systohc</pre
<div class="highlight highlight-text-adblock">
<pre>LANG=en_US.UTF-8</pre>
</div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Network configuration</h4>
<a
id="user-content-network-configuration"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Network configuration"
href="#network-configuration"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Network configuration
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Edit <code>/etc/hostname</code>:</p>
<div class="highlight highlight-text-adblock"><pre>myhostname</pre></div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Initramfs</h4>
<a
id="user-content-initramfs"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Initramfs"
href="#initramfs"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Initramfs
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Edit <code>/etc/mkinitcpio.conf</code>:</p>
<div class="highlight highlight-text-adblock">
<pre><span class="pl-c"># LVM</span>
@ -375,39 +379,41 @@ HOOKS=(base udev ... block lvm2 filesystems)
<span class="pl-c"># Replace udev with systemd</span></pre>
</div>
<div class="highlight highlight-source-shell"><pre>mkinitcpio -P</pre></div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Root password</h4>
<a
id="user-content-root-password"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Root password"
href="#root-password"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Root password
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell"><pre>passwd</pre></div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Addition</h4>
<a
id="user-content-addition"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Addition"
href="#addition"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Addition
</h4>
<h5>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h5 class="heading-element">
<a href="https://wiki.archlinux.org/title/NetworkManager" rel="nofollow"
>NetworkManager (WIP)</a
>
</h5>
<a
id="user-content-networkmanager-wip"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: NetworkManager (WIP)"
href="#networkmanager-wip"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://wiki.archlinux.org/title/NetworkManager" rel="nofollow"
>NetworkManager (WIP)</a
>
</h5>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>pacman -Syu networkmanager dhcpcd iwd
systemctl <span class="pl-c1">enable</span> NetworkManager.service
@ -441,57 +447,59 @@ noarp
nohook resolv.conf</pre
>
</div>
<h5>
<div class="markdown-heading">
<h5 class="heading-element">Bluetooth</h5>
<a
id="user-content-bluetooth"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Bluetooth"
href="#bluetooth"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Bluetooth
</h5>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>pacman -Syu bluez
systemctl <span class="pl-c1">enable</span> bluetooth.service</pre>
</div>
<h5>
<div class="markdown-heading">
<h5 class="heading-element">Clock</h5>
<a
id="user-content-clock"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Clock"
href="#clock"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Clock
</h5>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>timedatectl set-ntp <span class="pl-c1">true</span></pre>
</div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Boot loader</h4>
<a
id="user-content-boot-loader"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Boot loader"
href="#boot-loader"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Boot loader
</h4>
<h5>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h5 class="heading-element">
<a
href="https://wiki.archlinux.org/index.php/Systemd-boot"
rel="nofollow"
>systemd-boot</a
>
</h5>
<a
id="user-content-systemd-boot"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: systemd-boot"
href="#systemd-boot"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a
href="https://wiki.archlinux.org/index.php/Systemd-boot"
rel="nofollow"
>systemd-boot</a
>
</h5>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Install using XBOOTLDR:</p>
<div class="highlight highlight-source-shell">
<pre>bootctl --esp-path=/efi --boot-path=/boot install
@ -538,34 +546,36 @@ initrd /initramfs-linux.img
<span class="pl-c"># nvidia-drm.modeset=1</span>
options root="LABEL=ROOT" rw</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a
href="https://wiki.archlinux.org/index.php/General_recommendations"
rel="nofollow"
>General recommendations</a
>
</h2>
<a
id="user-content-general-recommendations"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: General recommendations"
href="#general-recommendations"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a
href="https://wiki.archlinux.org/index.php/General_recommendations"
rel="nofollow"
>General recommendations</a
>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Always remember to check <strong>dependencies</strong> when install
packages.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">System administration</h3>
<a
id="user-content-system-administration"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: System administration"
href="#system-administration"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>System administration
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<a href="https://wiki.archlinux.org/index.php/sudo" rel="nofollow">Sudo</a
>:
@ -604,16 +614,16 @@ homectl update joker --shell=/usr/bin/zsh</pre>
<strong>Note</strong>: Can not run <code>homectl</code> when install Arch
Linux. Should run on the first boot.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Desktop Environment</h3>
<a
id="user-content-desktop-environment"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Desktop Environment"
href="#desktop-environment"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Desktop Environment
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Install
<a href="https://wiki.archlinux.org/index.php/Xorg" rel="nofollow">Xorg</a
@ -622,18 +632,20 @@ homectl update joker --shell=/usr/bin/zsh</pre>
<div class="highlight highlight-source-shell">
<pre>pacman -Syu xorg-server</pre>
</div>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">
<a href="https://wiki.archlinux.org/index.php/GNOME" rel="nofollow"
>GNOME</a
>
</h4>
<a
id="user-content-gnome"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: GNOME"
href="#gnome"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://wiki.archlinux.org/index.php/GNOME" rel="nofollow"
>GNOME</a
>
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>pacman -Syu gnome-shell \
gnome-control-center gnome-system-monitor power-profiles-daemon \
@ -655,50 +667,56 @@ systemctl <span class="pl-c1">enable</span> gdm.service</pre>
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a
href="https://wiki.archlinux.org/index.php/List_of_applications"
rel="nofollow"
>List of applications</a
>
</h2>
<a
id="user-content-list-of-applications"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: List of applications"
href="#list-of-applications"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a
href="https://wiki.archlinux.org/index.php/List_of_applications"
rel="nofollow"
>List of applications</a
>
</h2>
<h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h3 class="heading-element">
<a href="https://wiki.archlinux.org/index.php/pacman" rel="nofollow"
>pacman</a
>
</h3>
<a
id="user-content-pacman"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: pacman"
href="#pacman"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://wiki.archlinux.org/index.php/pacman" rel="nofollow"
>pacman</a
>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Uncomment in <code>/etc/pacman.conf</code>:</p>
<div class="highlight highlight-text-adblock">
<pre><span class="pl-c"># Misc options</span>
Color
ParallelDownloads</pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
<a href="https://wiki.archlinux.org/title/PipeWire" rel="nofollow"
>Pipewire (WIP)</a
>
</h3>
<a
id="user-content-pipewire-wip"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Pipewire (WIP)"
href="#pipewire-wip"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://wiki.archlinux.org/title/PipeWire" rel="nofollow"
>Pipewire (WIP)</a
>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>
pacman -Syu pipewire wireplumber \
@ -717,35 +735,39 @@ pacman -Syu pipewire wireplumber \
<div class="highlight highlight-source-shell">
<pre>pacman -Syu sof-firmware</pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
<a href="https://wiki.archlinux.org/title/Flatpak" rel="nofollow"
>Flatpak (WIP)</a
>
</h3>
<a
id="user-content-flatpak-wip"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Flatpak (WIP)"
href="#flatpak-wip"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://wiki.archlinux.org/title/Flatpak" rel="nofollow"
>Flatpak (WIP)</a
>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>pacman -Syu flatpak</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a
href="https://wiki.archlinux.org/index.php/improving_performance"
rel="nofollow"
>Improving performance</a
>
</h2>
<a
id="user-content-improving-performance"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Improving performance"
href="#improving-performance"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a
href="https://wiki.archlinux.org/index.php/improving_performance"
rel="nofollow"
>Improving performance</a
>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a
@ -807,16 +829,16 @@ pacman -Syu pipewire wireplumber \
<pre><span class="pl-c"># https://lwn.net/Articles/911219/</span>
kernel.split_lock_mitigate = 0</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Hardware dependent</h2>
<a
id="user-content-hardware-dependent"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Hardware dependent"
href="#hardware-dependent"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Hardware dependent
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://wiki.archlinux.org/title/Laptop" rel="nofollow"
@ -834,16 +856,16 @@ kernel.split_lock_mitigate = 0</pre>
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Experiment</h2>
<a
id="user-content-experiment"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Experiment"
href="#experiment"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Experiment
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Do it at your own risk!!!</p>
<ul>
<li>
@ -864,16 +886,16 @@ kernel.split_lock_mitigate = 0</pre>
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">In the end</h2>
<a
id="user-content-in-the-end"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: In the end"
href="#in-the-end"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>In the end
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>This guide is updated regularly I promise.</p>
<div>

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Speed up writing Go test ASAP</h1>
<a
id="user-content-speed-up-writing-go-test-asap"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Speed up writing Go test ASAP"
href="#speed-up-writing-go-test-asap"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Speed up writing Go test ASAP
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Imagine your project currently have 0% unit test code coverage. And your
boss keep pushing it to 80% or even 90%? What do you do? Give up?
@ -57,16 +57,18 @@
just make sure your code is running excatly as you intent it to be. If you
don't think about edge case before, unit test won't help you.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
First, rewrite the impossible (to test) out
</h2>
<a
id="user-content-first-rewrite-the-impossible-to-test-out"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: First, rewrite the impossible (to test) out"
href="#first-rewrite-the-impossible-to-test-out"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>First, rewrite the impossible (to test) out
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
When I learn programming, I encounter very interesting idea, which become
mainly my mindset when I dev later. I don't recall it clearly, kinda like:
@ -89,16 +91,16 @@
all global var to fields inside some struct.
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Let the fun (writing test) begin</h2>
<a
id="user-content-let-the-fun-writing-test-begin"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Let the fun (writing test) begin"
href="#let-the-fun-writing-test-begin"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Let the fun (writing test) begin
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
If you code Go long enough, you know table driven tests and how is that so
useful. You set up test data, then you test. Somewhere in the future, you

View File

@ -28,27 +28,27 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Incident come and go</h1>
<a
id="user-content-incident-come-and-go"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Incident come and go"
href="#incident-come-and-go"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Incident come and go
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>This is collect of all incidents I created in the past :(</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Service starts with empty port</h2>
<a
id="user-content-service-starts-with-empty-port"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Service starts with empty port"
href="#service-starts-with-empty-port"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Service starts with empty port
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Because all configs is read from file.</p>
<p>
But the port config is empty -&gt; So when service inits, it use that
@ -58,16 +58,16 @@
<strong>Solution</strong>: For some configs, make sure to failed first if
it's empty.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Race condition of series of APIs</h2>
<a
id="user-content-race-condition-of-series-of-apis"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Race condition of series of APIs"
href="#race-condition-of-series-of-apis"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Race condition of series of APIs
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>For example I have 2 APIs:</p>
<ul>
<li>API upload: allow user to upload image</li>

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">EKYC - The battle never ends</h1>
<a
id="user-content-ekyc---the-battle-never-ends"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: EKYC - The battle never ends"
href="#ekyc---the-battle-never-ends"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>EKYC - The battle never ends
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>TODO</p>
<div>

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Fonts</h1>
<a
id="user-content-fonts"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Fonts"
href="#fonts"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Fonts
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
I always want the best fonts for my terminal, my text editor, my ... But
I'm not satisfied easily, so I keep trying new fonts. Prefer free fonts of
@ -64,16 +64,18 @@
</li>
</ul>
<p>Always choose <strong>OTF</strong> over <strong>TTF</strong> format.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/JetBrains/JetBrainsMono">JetBrains Mono</a>
</h2>
<a
id="user-content-jetbrains-mono"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: JetBrains Mono"
href="#jetbrains-mono"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/JetBrains/JetBrainsMono">JetBrains Mono</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>JetBrains branding font.</p>
<ul>
<li>Support Vietnamese</li>
@ -86,16 +88,18 @@
<code>cv16</code>, <code>cv18</code>, <code>cv19</code>,
<code>cv20</code>.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/be5invis/Iosevka">Iosevka</a>
</h2>
<a
id="user-content-iosevka"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Iosevka"
href="#iosevka"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/be5invis/Iosevka">Iosevka</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>I often choose SS08 variant because I also love PragmataPro too.</p>
<ul>
<li>Support Vietnamese</li>
@ -108,16 +112,18 @@
Font is narrow, can display much more on small screen. But too much
config/variant for ligatures scares me.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/arrowtype/recursive">Recursive</a>
</h2>
<a
id="user-content-recursive"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Recursive"
href="#recursive"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/arrowtype/recursive">Recursive</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>I often choose Casual variant.</p>
<ul>
<li>Support Vietnamese</li>
@ -135,16 +141,18 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/blobject/agave">agave</a>
</h2>
<a
id="user-content-agave"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: agave"
href="#agave"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/blobject/agave">agave</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>No Vietnamese</li>
<li>Support bold</li>
@ -156,16 +164,18 @@
Font is small, can display much more on small screen. I like its curved
look.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/jenskutilek/sudo-font">Sudo</a>
</h2>
<a
id="user-content-sudo"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Sudo"
href="#sudo"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/jenskutilek/sudo-font">Sudo</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Small fonts, saving space.</p>
<ul>
<li>Support Vietnamese</li>
@ -178,36 +188,39 @@
Unique to me. Strange <code>#</code>, looks same as <code>4</code> (I
don't like it for now).
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/belluzj/fantasque-sans"
>Fantasque Sans Mono</a
>
</h2>
<a
id="user-content-fantasque-sans-mono"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Fantasque Sans Mono"
href="#fantasque-sans-mono"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/belluzj/fantasque-sans"
>Fantasque Sans Mono</a
>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Comic vibe. Look smoothly and too much curve.</p>
<ul>
<li>No Vietnamese</li>
<li>Support bold, italic</li>
<li>Support ligatures</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://apl385.com/fonts/index.htm" rel="nofollow">APL-385</a>
and <a href="https://github.com/abrudz/APL386">APL386</a>
</h2>
<a
id="user-content-apl-385-and-apl386"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: APL-385 and APL386"
href="#apl-385-and-apl386"
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
<a href="https://apl385.com/fonts/index.htm" rel="nofollow">APL-385</a>
and <a href="https://github.com/abrudz/APL386">APL386</a>
</h2>
</div>
<ul>
<li>No Vietnamese</li>
<li>No bold, italic</li>
@ -215,16 +228,18 @@
<li>Has display font (APL333)</li>
</ul>
<p>I love its wide look, also it's feel nostalgic.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/IBM/plex">IBM Plex</a>
</h2>
<a
id="user-content-ibm-plex"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: IBM Plex"
href="#ibm-plex"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/IBM/plex">IBM Plex</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
IBM branding font, good alternative for Inter, has both monospace and
display variant.
@ -237,44 +252,50 @@
<li>Has display font</li>
</ul>
<p>Looks fancy. Strange <code>#</code>.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/pcaro90/hermit">Hermit</a>
</h2>
<a
id="user-content-hermit"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Hermit"
href="#hermit"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/pcaro90/hermit">Hermit</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>No Vietnamese</li>
<li>Support bold, italic</li>
<li>No ligatures</li>
</ul>
<p>Looks unique to me, with some sharp look.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/ryanoasis/nerd-fonts">Nerd Fonts</a>
</h2>
<a
id="user-content-nerd-fonts"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Nerd Fonts"
href="#nerd-fonts"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/ryanoasis/nerd-fonts">Nerd Fonts</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>For fancy terminal, only need <code>NerdFontsSymbolsOnly</code></p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
Murr fonts, but I don't use much now (some fonts I already try in the
past)
</h2>
<a
id="user-content-murr-fonts-but-i-dont-use-much-now-some-fonts-i-already-try-in-the-past"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Murr fonts, but I don't use much now (some fonts I already try in the past)"
href="#murr-fonts-but-i-dont-use-much-now-some-fonts-i-already-try-in-the-past"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Murr fonts, but I don't use much now (some fonts I already try in the
past)
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://github.com/tonsky/FiraCode">Fira Code</a>: best
@ -332,16 +353,16 @@
shape.
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Bitmap/Oldschool</h3>
<a
id="user-content-bitmapoldschool"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Bitmap/Oldschool"
href="#bitmapoldschool"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Bitmap/Oldschool
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://terminus-font.sourceforge.net/" rel="nofollow"
@ -383,16 +404,16 @@
>: bitmap vibe but support vector.
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Only display</h3>
<a
id="user-content-only-display"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Only display"
href="#only-display"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Only display
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://github.com/intel/clear-sans">Clear Sans</a>: used to be

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Games 4 fun</h1>
<a
id="user-content-games-4-fun"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Games 4 fun"
href="#games-4-fun"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Games 4 fun
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Just a little note about apps, games, settings for next time playing :D
Please have fun, of course :D
@ -47,16 +47,16 @@
<li>My work laptop (Macbook Pro M1 (2020)).</li>
</ul>
<p>If below links die, I will try to scrape Internet to get a new link.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">PS2 emulator</h2>
<a
id="user-content-ps2-emulator"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: PS2 emulator"
href="#ps2-emulator"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>PS2 emulator
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
I use <a href="https://github.com/PCSX2/pcsx2">PCSX2</a>. Currently it
supports macOS on nightly builds, but it's good enough.
@ -110,18 +110,20 @@
For cover art of games, please use
<a href="https://github.com/xlenore/ps2-covers">xlenore/ps2-covers</a>.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">
<a href="https://wiki.pcsx2.net/Resident_Evil_4" rel="nofollow"
>Resident Evil 4</a
>
</h3>
<a
id="user-content-resident-evil-4"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Resident Evil 4"
href="#resident-evil-4"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://wiki.pcsx2.net/Resident_Evil_4" rel="nofollow"
>Resident Evil 4</a
>
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a
@ -203,16 +205,16 @@ patch=1,EE,2012009C,extended,00000000</pre
style="max-width: 100%"
/></a>
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Mega Man X Collection</h3>
<a
id="user-content-mega-man-x-collection"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Mega Man X Collection"
href="#mega-man-x-collection"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Mega Man X Collection
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a
@ -230,16 +232,16 @@ patch=1,EE,2012009C,extended,00000000</pre
</li>
<li><a href="https://vimm.net/vault/8736" rel="nofollow">vimm</a></li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Mega Man X8</h3>
<a
id="user-content-mega-man-x8"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Mega Man X8"
href="#mega-man-x8"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Mega Man X8
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://cdromance.com/ps2-iso/mega-man-x8-usa/" rel="nofollow"
@ -255,16 +257,16 @@ patch=1,EE,2012009C,extended,00000000</pre
</li>
<li><a href="https://vimm.net/vault/8738" rel="nofollow">vimm</a></li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">God of War</h3>
<a
id="user-content-god-of-war"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: God of War"
href="#god-of-war"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>God of War
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://cdromance.com/ps2-iso/god-of-war-usa/" rel="nofollow"
@ -305,16 +307,16 @@ patch=1,EE,2012009C,extended,00000000</pre
<a href="https://ko-fi.com/pandavenom" rel="nofollow">Panda Venom</a> for
his work.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">God of War II</h3>
<a
id="user-content-god-of-war-ii"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: God of War II"
href="#god-of-war-ii"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>God of War II
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a
@ -357,16 +359,16 @@ patch=1,EE,2012009C,extended,00000000</pre
<a href="https://ko-fi.com/pandavenom" rel="nofollow">Panda Venom</a> for
his work.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Shadow of the Colossus</h3>
<a
id="user-content-shadow-of-the-colossus"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Shadow of the Colossus"
href="#shadow-of-the-colossus"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Shadow of the Colossus
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a
@ -384,16 +386,16 @@ patch=1,EE,2012009C,extended,00000000</pre
</li>
<li><a href="https://vimm.net/vault/9219" rel="nofollow">vimm</a></li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">PS3 emulator</h2>
<a
id="user-content-ps3-emulator"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: PS3 emulator"
href="#ps3-emulator"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>PS3 emulator
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
I use <a href="https://github.com/RPCS3/rpcs3">RPCS3</a>. Currently it
supports macOS on nightly builds.
@ -417,16 +419,16 @@ patch=1,EE,2012009C,extended,00000000</pre
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Windows games</h2>
<a
id="user-content-windows-games"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Windows games"
href="#windows-games"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Windows games
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a

View File

@ -28,53 +28,53 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Keeb</h1>
<a
id="user-content-keeb"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Keeb"
href="#keeb"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Keeb
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>My collection of mechanical keyboards.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Keyboard</h2>
<a
id="user-content-keyboard"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Keyboard"
href="#keyboard"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Keyboard
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
QMK custom keymaps is
<a href="https://github.com/haunt98/qmk_keymaps">here</a>
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">iKBC CD87 Cherry MX Blue</h3>
<a
id="user-content-ikbc-cd87-cherry-mx-blue"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: iKBC CD87 Cherry MX Blue"
href="#ikbc-cd87-cherry-mx-blue"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>iKBC CD87 Cherry MX Blue
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>My first keeb.</p>
<p>Damn it's so loud :D</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">KBDfans X Lazurite D60Lite</h3>
<a
id="user-content-kbdfans-x-lazurite-d60lite"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: KBDfans X Lazurite D60Lite"
href="#kbdfans-x-lazurite-d60lite"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>KBDfans X Lazurite D60Lite
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>I bought it from my friend.</p>
<p>
<a
@ -289,16 +289,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Sofle V2</h3>
<a
id="user-content-sofle-v2"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Sofle V2"
href="#sofle-v2"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Sofle V2
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
I bought it from
<a
@ -314,16 +314,16 @@
<li>Sandwhich style is meh when typing, so I buy Aluminium case.</li>
<li>The left sandwich case is so tight to put switch in.</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Guide</h3>
<a
id="user-content-guide"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Guide"
href="#guide"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Guide
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://val.packett.cool/blog/ergonice/" rel="nofollow"
@ -338,26 +338,26 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Switch</h2>
<a
id="user-content-switch"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Switch"
href="#switch"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Switch
</h2>
<h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h3 class="heading-element">KTT Strawberry</h3>
<a
id="user-content-ktt-strawberry"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: KTT Strawberry"
href="#ktt-strawberry"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>KTT Strawberry
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Buy it from ShopeeVN. I choose this switch because I prefer linear (please
be silent).
@ -408,16 +408,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">SKYLOONG Glacier Silent Red Switch</h3>
<a
id="user-content-skyloong-glacier-silent-red-switch"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: SKYLOONG Glacier Silent Red Switch"
href="#skyloong-glacier-silent-red-switch"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>SKYLOONG Glacier Silent Red Switch
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
I was given this switch by my friend. Currently using for alpha keys. Love
the silent.
@ -452,16 +452,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">JWICK Yellow Linear Switch</h3>
<a
id="user-content-jwick-yellow-linear-switch"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: JWICK Yellow Linear Switch"
href="#jwick-yellow-linear-switch"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>JWICK Yellow Linear Switch
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<a
target="_blank"
@ -492,16 +492,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">C3 Equalz Tangerine V2</h3>
<a
id="user-content-c3-equalz-tangerine-v2"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: C3 Equalz Tangerine V2"
href="#c3-equalz-tangerine-v2"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>C3 Equalz Tangerine V2
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<a
target="_blank"
@ -555,16 +555,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">CHERRY MX2A Black</h3>
<a
id="user-content-cherry-mx2a-black"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: CHERRY MX2A Black"
href="#cherry-mx2a-black"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>CHERRY MX2A Black
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<a
target="_blank"
@ -610,16 +610,16 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Keycap</h2>
<a
id="user-content-keycap"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Keycap"
href="#keycap"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Keycap
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Currently, I use Akko 9009 Cherry Profile and EnjoyPBT 9009 Cherry
Profile. The space of EnjoyPBT 9009 is not straight so I use Akko 9009
@ -633,16 +633,16 @@
</li>
<li>Check is keycap is tight on switch or not.</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">EnjoyPBT 9009</h3>
<a
id="user-content-enjoypbt-9009"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: EnjoyPBT 9009"
href="#enjoypbt-9009"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>EnjoyPBT 9009
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>I buy vim kit first then base later.</p>
<p>
<a
@ -683,16 +683,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">PBTfans BOW</h3>
<a
id="user-content-pbtfans-bow"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: PBTfans BOW"
href="#pbtfans-bow"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>PBTfans BOW
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>I only buy 40s kit.</p>
<p>
<a
@ -715,16 +715,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">JTK iKey</h3>
<a
id="user-content-jtk-ikey"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: JTK iKey"
href="#jtk-ikey"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>JTK iKey
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>I bought Blue version with Base, Novel, Space kit from bidding.</p>
<p>
<a
@ -758,16 +758,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">GMK Mecha-01</h3>
<a
id="user-content-gmk-mecha-01"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: GMK Mecha-01"
href="#gmk-mecha-01"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>GMK Mecha-01
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>I only bought Base kit.</p>
<p>
<a
@ -790,16 +790,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Color I love</h3>
<a
id="user-content-color-i-love"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Color I love"
href="#color-i-love"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Color I love
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a
@ -877,16 +877,16 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Tools</h2>
<a
id="user-content-tools"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Tools"
href="#tools"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Tools
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li><a href="https://github.com/bloznelis/kbt">bloznelis/kbt</a></li>
<li>
@ -901,16 +901,16 @@
</ul>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Buy history</h2>
<a
id="user-content-buy-history"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Buy history"
href="#buy-history"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Buy history
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<table>
<thead>
<tr>
@ -1036,16 +1036,16 @@
</tr>
</tbody>
</table>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://matrixzj.github.io/" rel="nofollow"

View File

@ -28,26 +28,26 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Naming things</h1>
<a
id="user-content-naming-things"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Naming things"
href="#naming-things"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Naming things
</h1>
<h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h2 class="heading-element">Filename in storage (S3, ...)</h2>
<a
id="user-content-filename-in-storage-s3-"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Filename in storage (S3, ...)"
href="#filename-in-storage-s3-"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Filename in storage (S3, ...)
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Always have year, month, day in filename to easily sort it out.</p>
<p>
If file is uploaded by user, add <code>user_id</code> in filename, or some
@ -67,16 +67,16 @@
backup (as they say, idk if true or not, but less folder mean less
complicated to me).
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Time variable</h2>
<a
id="user-content-time-variable"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Time variable"
href="#time-variable"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Time variable
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Add time postfix to make sense.</p>
<p>Instead of <code>create_at</code>, use <code>create_at_ms</code>.</p>

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">My neovim workflow</h1>
<a
id="user-content-my-neovim-workflow"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: My neovim workflow"
href="#my-neovim-workflow"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>My neovim workflow
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<a
target="_blank"
@ -53,16 +53,16 @@
All configs are in
<a href="https://github.com/haunt98/dotfiles">my dotfiles</a>.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Trick or treat</h2>
<a
id="user-content-trick-or-treat"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Trick or treat"
href="#trick-or-treat"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Trick or treat
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Search current word: <code>*</code></p>
<p>Search multiple words:</p>
<div class="highlight highlight-source-viml">
@ -98,16 +98,16 @@
<div class="highlight highlight-source-viml">
<pre>:<span class="pl-k">!</span>column <span class="pl-k">-</span><span class="pl-c1">t</span></pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Jumpo</h2>
<a
id="user-content-jumpo"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Jumpo"
href="#jumpo"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Jumpo
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Basic:</p>
<ul>
<li><code>gg</code>: first line</li>
@ -146,30 +146,30 @@
</ul>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Fold</h2>
<a
id="user-content-fold"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Fold"
href="#fold"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Fold
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li><code>zR</code>: open all folds.</li>
<li><code>za</code>, <code>zA</code>: toggle fold</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Keymap</h2>
<a
id="user-content-keymap"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Keymap"
href="#keymap"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Keymap
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Use both <code>\</code> and <code>;</code> as leader key:</p>
<div class="highlight highlight-source-lua">
<pre>vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>;<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>&lt;Leader&gt;<span class="pl-pds">"</span></span>, { remap <span class="pl-k">=</span> <span class="pl-c1">true</span> })
@ -324,16 +324,16 @@ vim.<span class="pl-smi">keymap</span>.<span class="pl-c1">set</span>(<span clas
</ul>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">References / Thanks</h2>
<a
id="user-content-references--thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: References / Thanks"
href="#references--thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>References / Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
vim docs:

View File

@ -28,26 +28,26 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Things I like</h1>
<a
id="user-content-things-i-like"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Things I like"
href="#things-i-like"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Things I like
</h1>
<h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h2 class="heading-element">Discord (old) naming</h2>
<a
id="user-content-discord-old-naming"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Discord (old) naming"
href="#discord-old-naming"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Discord (old) naming
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
The way Discord naming user like<code>Joker#1234</code> is so interesting.
If user A register first with name <code>ABCXYZ</code>, and later user B
@ -58,16 +58,16 @@
Why it's interesting? Each time I join a new platform, all names I want
are taken :D
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Interesting website</h2>
<a
id="user-content-interesting-website"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Interesting website"
href="#interesting-website"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Interesting website
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li><a href="https://deskto.ps/" rel="nofollow">deskto.ps</a></li>
<li>

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Swagger or OpenAPI</h1>
<a
id="user-content-swagger-or-openapi"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Swagger or OpenAPI"
href="#swagger-or-openapi"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Swagger or OpenAPI
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>My company currently use Swagger 2 to document API.</p>
<p>
I want to work with OpenAPI 3 but too lazy to convert (for now of course).
@ -65,16 +65,16 @@ bunx prettier@latest --write ./docs/swagger.yaml ./docs/swagger.json
<span class="pl-c"><span class="pl-c">#</span> Render locally</span>
bunx @redocly/cli preview-docs ./docs/swagger.json</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li><a href="https://github.com/mikefarah/yq">mikefarah/yq</a></li>
<li><a href="https://github.com/oven-sh/bun">oven-sh/bun</a></li>

View File

@ -28,46 +28,50 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">My terminal workflow</h1>
<a
id="user-content-my-terminal-workflow"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: My terminal workflow"
href="#my-terminal-workflow"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>My terminal workflow
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
All configs are in
<a href="https://github.com/haunt98/dotfiles">my dotfiles</a>.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
Use <a href="https://github.com/junegunn/fzf">junegunn/fzf</a>
</h2>
<a
id="user-content-use-junegunnfzf"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use junegunn/fzf"
href="#use-junegunnfzf"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use <a href="https://github.com/junegunn/fzf">junegunn/fzf</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li><code>CTRL-T</code> to fuzzy find files.</li>
<li><code>ALT-C</code> to fuzzy find directories.</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
Use
<a href="https://github.com/zellij-org/zellij">zellij-org/zellij</a> as
guide keybinding
</h2>
<a
id="user-content-use-zellij-orgzellij-as-guide-keybinding"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Use zellij-org/zellij as guide keybinding"
href="#use-zellij-orgzellij-as-guide-keybinding"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Use
<a href="https://github.com/zellij-org/zellij">zellij-org/zellij</a> as
guide keybinding
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<a
target="_blank"

View File

@ -28,28 +28,28 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Another day another incident #02</h1>
<a
id="user-content-another-day-another-incident-02"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Another day another incident #02"
href="#another-day-another-incident-02"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Another day another incident #02
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Today's incident is all about Go context.</p>
<p>TLDR: context got canceled, but it shouldn't.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">The problem</h2>
<a
id="user-content-the-problem"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: The problem"
href="#the-problem"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>The problem
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Imagine a chain of APIs:</p>
<ul>
<li>Calling API A</li>
@ -123,16 +123,16 @@ doB context deadline exceeded</pre
>
</div>
<p>As you see both <code>doA</code> and <code>doB</code> are canceled.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">The (temporary) solution</h2>
<a
id="user-content-the-temporary-solution"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: The (temporary) solution"
href="#the-temporary-solution"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>The (temporary) solution
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Quick Google search leads me to
<a href="https://github.com/golang/go/issues/40221"
@ -246,16 +246,16 @@ doB</pre
As you see only <code>doA</code> is canceled, <code>doB</code> is done
perfectly. And that what we want in this case.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Khoan cắt bê tông 101</h1>
<a
id="user-content-khoan-cắt-bê-tông-101"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Khoan cắt bê tông 101"
href="#khoan-cắt-bê-tông-101"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Khoan cắt bê tông 101
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>The title is a joke.</p>
<p>
But after digging a few holes on the wall, I think I should leave a few

View File

@ -28,37 +28,37 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Userful tools</h1>
<a
id="user-content-userful-tools"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Userful tools"
href="#userful-tools"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Userful tools
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>This just a raw list.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Tools</h2>
<a
id="user-content-tools"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Tools"
href="#tools"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Tools
</h2>
<h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h3 class="heading-element">Terminal</h3>
<a
id="user-content-terminal"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Terminal"
href="#terminal"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Terminal
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<p>
@ -406,16 +406,16 @@
</ul>
</li>
</ul>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Windows</h4>
<a
id="user-content-windows"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Windows"
href="#windows"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Windows
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://github.com/abbodi1406/KMS_VL_ALL_AIO"
@ -433,16 +433,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">UI</h3>
<a
id="user-content-ui"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: UI"
href="#ui"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>UI
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://github.com/kovidgoyal/kitty"
@ -491,16 +491,16 @@
>
</li>
</ul>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">macOS</h4>
<a
id="user-content-macos"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: macOS"
href="#macos"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>macOS
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://theunarchiver.com/" rel="nofollow"
@ -599,26 +599,26 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Developement</h2>
<a
id="user-content-developement"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Developement"
href="#developement"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Developement
</h2>
<h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h3 class="heading-element">Terminal</h3>
<a
id="user-content-terminal-1"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Terminal"
href="#terminal-1"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Terminal
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://github.com/Schniz/fnm"
@ -682,6 +682,11 @@
>https://github.com/golang/tools/tree/master/gopls</a
>
</li>
<li>
<a href="https://github.com/Microsoft/pyright"
>https://github.com/Microsoft/pyright</a
>
</li>
</ul>
<p>Misc</p>
<ul>
@ -785,16 +790,16 @@
>
</li>
</ul>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">Go</h4>
<a
id="user-content-go"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Go"
href="#go"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Go
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a
@ -861,16 +866,16 @@
>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">UI</h3>
<a
id="user-content-ui-1"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: UI"
href="#ui-1"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>UI
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://httpie.io/desktop" rel="nofollow"
@ -928,16 +933,16 @@
>
</li>
</ul>
<h4>
<div class="markdown-heading">
<h4 class="heading-element">macOS</h4>
<a
id="user-content-macos-1"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: macOS"
href="#macos-1"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>macOS
</h4>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://github.com/orbstack/orbstack"
@ -956,16 +961,16 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Notes</h2>
<a
id="user-content-notes"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Notes"
href="#notes"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Notes
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Prefer <code>nix</code>/<code>go</code>/<code>cargo</code>/<code
>pipx</code
@ -990,27 +995,27 @@
<li>Docker Desktop</li>
<li>Any JetBrains IDE beside DataGrip</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Misc</h2>
<a
id="user-content-misc"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Misc"
href="#misc"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Misc
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Don't enable plugin <code>git</code> in ohmyzsh.</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">macOS</h3>
<a
id="user-content-macos-2"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: macOS"
href="#macos-2"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>macOS
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Use Touch ID in Terminal:</p>
<div class="highlight highlight-source-shell">
<pre>sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local
@ -1071,16 +1076,16 @@ defaults -currentHost write -globalDomain NSStatusItemSpacing -int 6</pre
</ul>
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Firefox</h3>
<a
id="user-content-firefox"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Firefox"
href="#firefox"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Firefox
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p><code>about:config</code>:</p>
<ul>
<li>
@ -1117,16 +1122,16 @@ defaults -currentHost write -globalDomain NSStatusItemSpacing -int 6</pre
</ul>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a

View File

@ -28,27 +28,27 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Throw away pastebin</h1>
<a
id="user-content-throw-away-pastebin"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Throw away pastebin"
href="#throw-away-pastebin"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Throw away pastebin
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Just a place to throw away some text.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element"><code>.gitignore</code></h2>
<a
id="user-content-gitignore"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: .gitignore"
href="#gitignore"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><code>.gitignore</code>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-text-adblock">
<pre><span class="pl-c"># macOS</span>
.DS_Store
@ -69,16 +69,16 @@ vendor
<span class="pl-c"># GoReleaser</span>
dist</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">GitHub Actions</h2>
<a
id="user-content-github-actions"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: GitHub Actions"
href="#github-actions"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>GitHub Actions
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p><code>dependabot.yml</code>:</p>
<div class="highlight highlight-source-yaml">
<pre><span class="pl-ent">version</span>: <span class="pl-c1">2</span>
@ -152,16 +152,16 @@ dist</pre>
<span class="pl-ent">with</span>:
<span class="pl-ent">version</span>: <span class="pl-s">latest</span></pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Go</h2>
<a
id="user-content-go"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Go"
href="#go"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Go
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p><code>.golangci.yml</code>:</p>
<div class="highlight highlight-source-yaml">
<pre><span class="pl-ent">run</span>:
@ -282,32 +282,32 @@ dist</pre>
<span class="pl-ent">skip</span>: <span class="pl-c1">false</span>
<span class="pl-ent">use</span>: <span class="pl-s">github</span></pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Git clean up</h2>
<a
id="user-content-git-clean-up"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Git clean up"
href="#git-clean-up"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Git clean up
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre><span class="pl-c"><span class="pl-c">#</span> Delete untracked</span>
git clean -fdx
git gc</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Delete <code>.DS_Store</code></h2>
<a
id="user-content-delete-ds_store"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Delete .DS_Store"
href="#delete-ds_store"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Delete <code>.DS_Store</code>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
With
<a href="https://stackoverflow.com/q/30483670" rel="nofollow">find</a>:
@ -319,46 +319,52 @@ git gc</pre>
<div class="highlight highlight-source-shell">
<pre>fd -H <span class="pl-s"><span class="pl-pds">'</span>^\.DS_Store$<span class="pl-pds">'</span></span> -tf -X rm</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/chmln/sd">sd</a>
</h2>
<a
id="user-content-sd"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: sd"
href="#sd"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/chmln/sd">sd</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Remove proto options:</p>
<div class="highlight highlight-source-shell">
<pre>sd -F <span class="pl-s"><span class="pl-pds">'</span>import "validate/validate.proto";<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span> api/raw/<span class="pl-k">*</span>.proto
sd -F <span class="pl-s"><span class="pl-pds">'</span>import "marshal-zap.proto";<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span> api/raw/<span class="pl-k">*</span>.proto
sd -f s <span class="pl-s"><span class="pl-pds">'</span>\s\[.*?];<span class="pl-pds">'</span></span> <span class="pl-s"><span class="pl-pds">'</span>;<span class="pl-pds">'</span></span> api/raw/<span class="pl-k">*</span>.proto</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/adrianlopezroche/fdupes">fdupes</a>
</h2>
<a
id="user-content-fdupes"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: fdupes"
href="#fdupes"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/adrianlopezroche/fdupes">fdupes</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Remove duplicated files:</p>
<div class="highlight highlight-source-shell">
<pre>fdupes -rdN <span class="pl-c1">.</span></pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/WayneD/rsync">rsync</a>
</h2>
<a
id="user-content-rsync"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: rsync"
href="#rsync"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/WayneD/rsync">rsync</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre><span class="pl-c"><span class="pl-c">#</span> Result is dst/src</span>
rsync -avzP src dst
@ -387,16 +393,18 @@ rsync -avzP src/ dst</pre>
in <strong>src</strong>, useful to sync dst with src
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/atuinsh/atuin">atuin</a>
</h2>
<a
id="user-content-atuin"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: atuin"
href="#atuin"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/atuinsh/atuin">atuin</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Remove duplicated command:</p>
<div class="highlight highlight-source-sql">
<pre><span class="pl-k">delete</span>
@ -405,31 +413,35 @@ rsync -avzP src/ dst</pre>
<span class="pl-k">from</span> history
<span class="pl-k">group by</span> command);</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/ayoisaiah/f2">F2</a>
</h2>
<a
id="user-content-f2"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: F2"
href="#f2"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/ayoisaiah/f2">F2</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Rename:</p>
<div class="highlight highlight-source-shell">
<pre><span class="pl-c"><span class="pl-c">#</span> If want dry run, remove -x</span>
f2 -r <span class="pl-s"><span class="pl-pds">"</span>{mtime.YYYY}{mtime.MM}{mtime.DD}.{mtime.H}{mtime.mm}{mtime.ss}{ext}<span class="pl-pds">"</span></span> -x</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/instaloader/instaloader">Instaloader</a>
</h2>
<a
id="user-content-instaloader"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Instaloader"
href="#instaloader"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/instaloader/instaloader">Instaloader</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p><code>args.txt</code>:</p>
<div class="highlight highlight-text-adblock">
<pre>
@ -454,32 +466,36 @@ f2 -r <span class="pl-s"><span class="pl-pds">"</span>{mtime.YYYY}{mtime.MM}{mti
<div class="highlight highlight-text-adblock">
<pre>instaloader +login.txt +args.txt +targets.txt</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/fullstorydev/grpcurl">gRPCurl</a>
</h2>
<a
id="user-content-grpcurl"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: gRPCurl"
href="#grpcurl"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/fullstorydev/grpcurl">gRPCurl</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="highlight highlight-source-shell">
<pre>grpcurl -proto path/file.proto \
-d <span class="pl-s"><span class="pl-pds">'</span>{"key": "value", "timestamp": "1997-04-01T00:00:00Z"}<span class="pl-pds">'</span></span> \
internal-social.zalopay.vn:443 \
pkg.Service/GetData</pre>
</div>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://github.com/zed-industries/zed">Zed</a>
</h2>
<a
id="user-content-zed"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Zed"
href="#zed"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://github.com/zed-industries/zed">Zed</a>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Settings:</p>
<div class="highlight highlight-source-json">
<pre>{

View File

@ -28,29 +28,29 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">F(an) android</h1>
<a
id="user-content-fan-android"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: F(an) android"
href="#fan-android"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>F(an) android
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>You know what I mean :D</p>
<p>Just a collection/checklist while using Android phone.</p>
<p>All Android phones are bloat.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Apps</h2>
<a
id="user-content-apps"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Apps"
href="#apps"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Apps
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Use <a href="https://f-droid.org/en/" rel="nofollow">F-Droid</a> with
<a href="https://github.com/Droid-ify/client">Droid-ify</a> to replace

View File

@ -28,27 +28,29 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Redis</h1>
<a
id="user-content-redis"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Redis"
href="#redis"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Redis
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Just to save my noted for future me using Redis again.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
Redis does not store creation time of keys
</h2>
<a
id="user-content-redis-does-not-store-creation-time-of-keys"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Redis does not store creation time of keys"
href="#redis-does-not-store-creation-time-of-keys"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Redis does not store creation time of keys
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Why? Because TODO</p>
<p>
<a

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Cache shenanigan</h1>
<a
id="user-content-cache-shenanigan"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Cache shenanigan"
href="#cache-shenanigan"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Cache shenanigan
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
My notes/mistakes/... when using cache (mainly Redis) from time to time
</p>
@ -84,16 +84,16 @@
database has new value, but cache has old value Then when we read again,
we read cache first with old value, and that is disaster.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">VSCode</h1>
<a
id="user-content-vscode"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: VSCode"
href="#vscode"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>VSCode
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Favortite settings everytime I install VSCode.</p>
<p>
I sort JSON using

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Hardware 101</h1>
<a
id="user-content-hardware-101"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Hardware 101"
href="#hardware-101"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Hardware 101
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Just kidding. It's only my collect data about which hardware to use/buy.
</p>

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Real World Crypto 101</h1>
<a
id="user-content-real-world-crypto-101"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Real World Crypto 101"
href="#real-world-crypto-101"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Real World Crypto 101
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
My notes when reading
<a
@ -46,17 +46,18 @@
>Real-World Cryptography</a
>
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<strong>Hash</strong> function convert from input to digest
</h2>
<a
id="user-content-hash-function-convert-from-input-to-digest"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Hash function convert from input to digest"
href="#hash-function-convert-from-input-to-digest"
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
<strong>Hash</strong> function convert from input to digest
</h2>
</div>
<ul>
<li>Pre-image resistance: Given digest, can not find input</li>
<li>
@ -65,18 +66,19 @@
</li>
<li>Collision resistance: Can not find 2 input produce same digest.</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<strong>MAC</strong> aka Message Authentication Code produce from key,
message to authentication tag.
</h2>
<a
id="user-content-mac-aka-message-authentication-code-produce-from-key-message-to-authentication-tag"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: MAC aka Message Authentication Code produce from key, message to authentication tag."
href="#mac-aka-message-authentication-code-produce-from-key-message-to-authentication-tag"
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
<strong>MAC</strong> aka Message Authentication Code produce from key,
message to authentication tag.
</h2>
</div>
<ul>
<li>A send B message with MAC (generate from message and A key).</li>
<li>
@ -141,16 +143,16 @@
<span class="pl-ent">bob </span><span class="pl-k">--&gt;&gt;</span> <span class="pl-ent">alice</span><span class="pl-k">:</span> <span class="pl-s">return ERROR</span></pre>
</div>
<p><strong>HMAC</strong> is MAC using hash</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">AES (Advanced Encryption Standard)</h2>
<a
id="user-content-aes-advanced-encryption-standard"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: AES (Advanced Encryption Standard)"
href="#aes-advanced-encryption-standard"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>AES (Advanced Encryption Standard)
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Currently (2023) the world using AES-128 which take a key 128 bits == 16
bytes
@ -165,16 +167,16 @@
<strong>block cipher</strong>. AES is deterministic so we can encrypt and
decrypt.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">AES-CBC (Cipher Block Chaining)</h2>
<a
id="user-content-aes-cbc-cipher-block-chaining"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: AES-CBC (Cipher Block Chaining)"
href="#aes-cbc-cipher-block-chaining"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>AES-CBC (Cipher Block Chaining)
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
What if text you want to encrypt longer than 128 bytes ? We add
<strong>padding</strong> for text to become multi block which has 128
@ -220,31 +222,33 @@
<strong>WARNING</strong> If IV become predictable, AES-CBC become
deterministic -&gt; BEAST attack (Browser Exploit Against SSL/TLS).
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
AEAD (Authenticated Encryption with Associated Data)
</h2>
<a
id="user-content-aead-authenticated-encryption-with-associated-data"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: AEAD (Authenticated Encryption with Associated Data)"
href="#aead-authenticated-encryption-with-associated-data"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>AEAD (Authenticated Encryption with Associated Data)
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Because AES-CBC requires IV which shows public -&gt; attacker can change
IV -&gt; lack of authenticity -&gt; use AES-CBC-HMAC or AEAD.
</p>
<p>AEAD provides a way to authenticate <strong>associated data</strong>.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">AES-GCM (Galois/Counter Mode) AEAD</h2>
<a
id="user-content-aes-gcm-galoiscounter-mode-aead"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: AES-GCM (Galois/Counter Mode) AEAD"
href="#aes-gcm-galoiscounter-mode-aead"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>AES-GCM (Galois/Counter Mode) AEAD
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>AES-GCM = AES-CTR (Counter) + GMAC message authentication code</p>
<p>AES-CTR encrypt:</p>
<ul>
@ -266,16 +270,16 @@
</p>
<p>This is stream cipher, differ from block cipher.</p>
<p>GMAC is MAC with GHASH. GHASH resembles CBC mode.</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">ChaCha20-Poly1305 AED</h2>
<a
id="user-content-chacha20-poly1305-aed"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: ChaCha20-Poly1305 AED"
href="#chacha20-poly1305-aed"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>ChaCha20-Poly1305 AED
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>ChaCha20-Poly1305 = ChaCha20 stream cipher + Poly1305 MAC</p>
<div>

View File

@ -28,26 +28,26 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Vietnam survivor</h1>
<a
id="user-content-vietnam-survivor"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Vietnam survivor"
href="#vietnam-survivor"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Vietnam survivor
</h1>
<h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h2 class="heading-element">Giấy tờ</h2>
<a
id="user-content-giấy-tờ"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Giấy tờ"
href="#giấy-tờ"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Giấy tờ
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>Chứng minh nhân dân <strong>CMND</strong></li>
<li>Căn cước công dân <strong>CCCD</strong></li>
@ -56,16 +56,16 @@
<li>Bảo hiểm xã hội <strong>BHXH</strong></li>
<li>Giấy phép lái xe <strong>GPLX</strong></li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">CMND/CCCD</h2>
<a
id="user-content-cmndcccd"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: CMND/CCCD"
href="#cmndcccd"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>CMND/CCCD
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Làm tại Công an quận, huyện, thành phố.</p>
<p>
Sử dụng
@ -84,26 +84,26 @@
Công an ... làm lại.
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Passport</h2>
<a
id="user-content-passport"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Passport"
href="#passport"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Passport
</h2>
<h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h2 class="heading-element">BHXH</h2>
<a
id="user-content-bhxh"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: BHXH"
href="#bhxh"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>BHXH
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<a
href="https://baohiemxahoi.gov.vn/tracuu/Pages/tra-cuu-ho-gia-dinh.aspx"
@ -150,16 +150,16 @@
thất nghiệp: Điều kiện, mức hưởng, thủ tục hưởng)
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">GPLX</h2>
<a
id="user-content-gplx"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: GPLX"
href="#gplx"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>GPLX
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Nếu mất:</p>
<ul>
<li>

View File

@ -28,16 +28,16 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Bloguru</h1>
<a
id="user-content-bloguru"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Bloguru"
href="#bloguru"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Bloguru
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>No intro, this is list of RSS reader I follow:</p>
<p>Not personal blogs:</p>
<div class="highlight highlight-text-adblock">

View File

@ -28,34 +28,36 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Unrelated engineer</h1>
<a
id="user-content-unrelated-engineer"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Unrelated engineer"
href="#unrelated-engineer"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Unrelated engineer
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
This is collect of thoughts after I travel around the Internet. Not
engineering related though.
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a
href="https://signalvnoise.com/posts/3124-give-it-five-minutes"
rel="nofollow"
>Give it five minutes</a
>
</h2>
<a
id="user-content-give-it-five-minutes"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Give it five minutes"
href="#give-it-five-minutes"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a
href="https://signalvnoise.com/posts/3124-give-it-five-minutes"
rel="nofollow"
>Give it five minutes</a
>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<blockquote>
<p>
There are two things in this world that take no skill: 1. Spending other
@ -76,18 +78,20 @@
there too: It may be worth it.
</p>
</blockquote>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">
<a href="https://longform.asmartbear.com/say-yes/" rel="nofollow"
>Never say “no,” but rarely say “yes.”</a
>
</h2>
<a
id="user-content-never-say-no-but-rarely-say-yes"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Never say “no,” but rarely say “yes.”"
href="#never-say-no-but-rarely-say-yes"
><span aria-hidden="true" class="octicon octicon-link"></span></a
><a href="https://longform.asmartbear.com/say-yes/" rel="nofollow"
>Never say “no,” but rarely say “yes.”</a
>
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<blockquote>
<p>
So the principle is straightforward: Set the conditions of “yes” such

View File

@ -28,27 +28,27 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Debounce</h1>
<a
id="user-content-debounce"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Debounce"
href="#debounce"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Debounce
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>TODO</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Thanks</h2>
<a
id="user-content-thanks"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Thanks"
href="#thanks"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Thanks
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a

View File

@ -28,26 +28,26 @@
<h2>
<a href="index.html"><code>~</code></a>
</h2>
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Backend Thinking</h1>
<a
id="user-content-backend-thinking"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Backend Thinking"
href="#backend-thinking"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Backend Thinking
</h1>
<h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<div class="markdown-heading">
<h2 class="heading-element">Backend Role</h2>
<a
id="user-content-backend-role"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Backend Role"
href="#backend-role"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Backend Role
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Transform business requirements to action, which usually involves:</p>
<ul>
<li>
@ -126,28 +126,28 @@
<em>Example</em>: Business requirements says: Must match/compare user EKYC
data with Bank data (name, dob, id, ...).
</p>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Technical side</h2>
<a
id="user-content-technical-side"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Technical side"
href="#technical-side"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Technical side
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Backend services talk to Frontend, and talk to each other.</p>
<p>How do they communicate?</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">API</h3>
<a
id="user-content-api"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: API"
href="#api"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>API
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<strong>First</strong> is through API, this is the direct way, you send a
request then you wait for response.
@ -200,16 +200,16 @@
for switch is mainly performance.
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Message Broker</h3>
<a
id="user-content-message-broker"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Message Broker"
href="#message-broker"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Message Broker
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
<strong>Second</strong> way is by Message Broker, the most well known is
Kafka.
@ -264,16 +264,16 @@
<span class="pl-ent">D </span><span class="pl-k">-&gt;&gt;</span> <span class="pl-ent">Kafka</span><span class="pl-k">:</span> <span class="pl-s">consume message</span>
<span class="pl-ent">D </span><span class="pl-k">-&gt;&gt;</span> <span class="pl-ent">D</span><span class="pl-k">:</span> <span class="pl-s">do something</span></pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Tip</h3>
<a
id="user-content-tip"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Tip"
href="#tip"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Tip
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
Whatever you design, you stick with it consistently. Don't use different
@ -296,16 +296,16 @@
<strong>Pro tip</strong>: Use proto to define models (if you can) to take
advantage of detecting breaking changes.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">References</h3>
<a
id="user-content-references"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: References"
href="#references"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>References
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a
@ -333,32 +333,32 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Coding principle</h2>
<a
id="user-content-coding-principle"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Coding principle"
href="#coding-principle"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Coding principle
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
You should know about DRY, SOLID, KISS, YAGNI, Design Pattern. The basic
is learning which is which when you read code. Truly understand will be
knowing when to use and when to not.
</p>
<p>All of these above are industry standard.</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Write code that is easy delete</h3>
<a
id="user-content-write-code-that-is-easy-delete"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Write code that is easy delete"
href="#write-code-that-is-easy-delete"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Write code that is easy delete
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
The way business moving is fast, so a feature is maybe implemented today,
but gets thrown out of window tomorrow (Like A/B testing, one of them is
@ -408,16 +408,16 @@
And when we do not need send noti anymore, we can delete whole of it which
includes all providers and still not affecting main flow.
</p>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">Write code that is easy to test</h3>
<a
id="user-content-write-code-that-is-easy-to-test"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Write code that is easy to test"
href="#write-code-that-is-easy-to-test"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Write code that is easy to test
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>
Test is not a way to find bug, but to make sure what we code is actually
what we think/expect.
@ -475,16 +475,16 @@
tests are wrong/not enough (tests is missing some code path).
</li>
</ul>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">References</h3>
<a
id="user-content-references-1"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: References"
href="#references-1"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>References
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a
@ -508,16 +508,16 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">System Design Concept</h2>
<a
id="user-content-system-design-concept"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: System Design Concept"
href="#system-design-concept"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>System Design Concept
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>Start with basic: getting data from database.</p>
<div class="highlight highlight-source-mermaid">
<pre><span class="pl-k">sequenceDiagram</span>
@ -562,16 +562,16 @@
<span class="pl-ent">service </span><span class="pl-k">-&gt;&gt;</span> <span class="pl-ent">database</span><span class="pl-k">:</span> <span class="pl-s">set</span>
<span class="pl-ent">service </span><span class="pl-k">-&gt;&gt;</span> <span class="pl-ent">cache</span><span class="pl-k">:</span> <span class="pl-s">set</span></pre>
</div>
<h3>
<div class="markdown-heading">
<h3 class="heading-element">References</h3>
<a
id="user-content-references-2"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: References"
href="#references-2"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>References
</h3>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://apenwarr.ca/log/20201227" rel="nofollow"
@ -603,16 +603,16 @@
>
</li>
</ul>
<h2>
<div class="markdown-heading">
<h2 class="heading-element">Bonus</h2>
<a
id="user-content-bonus"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Bonus"
href="#bonus"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Bonus
</h2>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<ul>
<li>
<a href="https://www.jetbrains.com/idea/download/" rel="nofollow"

View File

@ -25,16 +25,16 @@
}
</style>
<body class="markdown-body">
<h1>
<div class="markdown-heading">
<h1 class="heading-element">Index</h1>
<a
id="user-content-index"
class="anchor"
aria-hidden="true"
tabindex="-1"
class="anchor-element"
aria-label="Permalink: Index"
href="#index"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Index
</h1>
><span aria-hidden="true" class="octicon octicon-link"></span
></a>
</div>
<p>This is where I dump my thoughts.</p>
<ul>
<li><a href="2022-06-08-backup.html">Backup my way</a></li>

View File

@ -145,6 +145,7 @@ Format
Language server
- https://github.com/golang/tools/tree/master/gopls
- https://github.com/Microsoft/pyright
Misc