From b12f163266d3ac34d61e7314c02f072c0ce0c065 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Sun, 19 Nov 2023 22:59:21 +0700 Subject: [PATCH] feat: re-gen all --- docs/2022-06-08-backup.html | 90 +++-- docs/2022-06-08-dockerfile-go.html | 29 +- docs/2022-07-10-bootstrap-go.html | 510 +++++++++++++++---------- docs/2022-07-12-uuid-or-else.html | 70 ++-- docs/2022-07-19-migrate-to-buf.html | 53 ++- docs/2022-07-31-experiment-go.html | 60 +-- docs/2022-07-31-sql.html | 190 +++++---- docs/2022-08-10-gitignore.html | 52 ++- docs/2022-10-26-reload-config.html | 16 +- docs/2022-12-25-archlinux.html | 454 ++++++++++++++-------- docs/2022-12-25-go-test-asap.html | 48 ++- docs/2023-03-05-incident.html | 48 ++- docs/2023-03-08-ekyc.html | 16 +- docs/2023-03-30-fonts.html | 216 +++++++---- docs/2023-04-01-games.html | 210 +++++++--- docs/2023-04-17-keeb.html | 461 +++++++++++++--------- docs/2023-04-17-naming.html | 48 ++- docs/2023-05-03-neovim.html | 87 +++-- docs/2023-05-08-things-i-like.html | 48 ++- docs/2023-05-23-swagger.html | 29 +- docs/2023-06-06-terminal-workflow.html | 72 ++-- docs/2023-06-10-incident-context.html | 58 +-- docs/2023-06-24-khoan-cat-be-tong.html | 16 +- docs/2023-06-25-useful-tools.html | 214 +++++++---- docs/2023-07-01-pastebin.html | 154 +++++--- docs/2023-07-02-fandroid.html | 29 +- docs/2023-07-06-redis.html | 29 +- docs/2023-07-30-cache-shenanigan.html | 29 +- docs/2023-08-09-vscode.html | 13 +- docs/2023-08-20-hardware.html | 16 +- docs/2023-08-23-real-world-crypto.html | 61 +-- docs/2023-09-14-vietnam-survivor.html | 16 +- docs/2023-09-23-bloguru.html | 13 +- docs/2023-10-02-unrelated.html | 40 +- docs/index.html | 13 +- posts/2023-04-01-games.md | 14 + 36 files changed, 2234 insertions(+), 1288 deletions(-) diff --git a/docs/2022-06-08-backup.html b/docs/2022-06-08-backup.html index c1dff00..f5af6ed 100644 --- a/docs/2022-06-08-backup.html +++ b/docs/2022-06-08-backup.html @@ -28,13 +28,15 @@

~

-

- Backup my way +

+ Backup my way

First thing first, I want to list my own devices, which I have through the @@ -149,13 +151,15 @@ How to backup, the second is Recovery strategy.

-

- How to backup +

+ How to backup

Before I talk about backup, I want to talk about data. In specifically, @@ -256,13 +260,15 @@ restic -r rclone:remote:PrivateData restore latest --target ~

  • Store locally in my laptop
  • Don't store locally in phone (can not keep track easily)
  • -

    + Backup work related data

    APIs tools:

    -

    - Misc +

    + Misc

    To backup everything is hard, so keep it simple and only backup important @@ -319,10 +332,15 @@ restic -r rclone:remote:PrivateData restore latest --target ~

  • TODOis, Evernote, ... -> Google Keep / Notion
  • Dropbox, OneDrive, ... -> Google Drive
  • -

    - The end +

    + The end

    This guide will be updated regularly I promise.

    diff --git a/docs/2022-06-08-dockerfile-go.html b/docs/2022-06-08-dockerfile-go.html index bcd4be2..df13364 100644 --- a/docs/2022-06-08-dockerfile-go.html +++ b/docs/2022-06-08-dockerfile-go.html @@ -28,13 +28,15 @@

    ~

    -

    - Dockerfile for Go +

    + Dockerfile for Go

    Each time I start a new Go project, I repeat many steps. Like set up @@ -163,10 +165,15 @@ ENTRYPOINT ["/app"]

    Finally, I copy app to Distroless base image.

    -

    - Thanks +

    + Thanks

    -

    - Do not repeat! +

    + Do not repeat!

    If we have too many services, some of the logic will be overlapped.

    @@ -148,21 +157,25 @@ internal Another bad practice is adapter service. No need to write a new service if what we need is just common pkg libs.

    -

    - Taste on style guide +

    + Taste on style guide

    -

    - Stop using global var +

    + Stop using global var

    If I see someone using global var, I swear I will shoot them twice in the @@ -173,13 +186,15 @@ internal

  • Can not write unit test.
  • Is not thread safe.
  • -

    - Use functional options, but don't overuse it! +

    + Use functional options, but don't overuse it!

    For simple struct with 1 or 2 fields, no need to use functional options. @@ -225,15 +240,19 @@ internal WithB option. No need to pass direct field inside s.

    -

    - Use + Use + errgroup - as much as possible + as much as possible

    If business logic involves calling too many APIs, but they are not depend @@ -266,33 +285,35 @@ internal // Handle error } -

    +

    Use + semaphore - when need to implement WorkerPool + when need to implement WorkerPool

    Please don't use external libs for WorkerPool, I don't want to deal with dependency hell.

    -

    +

    sync.Pool when + >Use + sync.Pool when need to reuse object, mainly for bytes.Buffer -

    Example:

    @@ -322,15 +343,17 @@ internal return result, nil }
    -

    - Generics - with some tricks + + Generics + with some tricks

    Take value then return pointer, useful with database struct full of @@ -349,33 +372,39 @@ internal return zero } -

    - External libs +

    + External libs

    -

    - No need vendor - +

    + No need vendor

    Only need if you need something from vendor, to generate mock or something else.

    -

    +

    + >Use build.go to include build tools in go.mod

    To easily control version of build tools.

    For example build.go:

    @@ -398,16 +427,18 @@ internal We always get the version of build tools in go.mod each time we install it. Future contributors will not cry anymore.

    -

    +

    spf13/cobra, - urfave/cli) just for Go - service + >Don't use cli libs (spf13/cobra, urfave/cli) just for Go + service

    What is the point to pass many params (do-it, @@ -420,13 +451,18 @@ internal The Twelve Factors guide.

    -

    - Don't use + Don't use + grpc-ecosystem/grpc-gateway -

    Just don't.

    @@ -439,21 +475,31 @@ internal Write 1 for both gRPC, REST sounds good, but in the end, it is not worth it.

    -

    - Don't use uber/prototool, use - bufbuild/buf - +

    + Don't use uber/prototool, + use bufbuild/buf

    prototool is deprecated, and buf can generate, lint, format as good as prototool.

    -

    - Use gin-gonic/gin for - REST. +

    + Use gin-gonic/gin for + REST.

    With c *gin.Context:

    -

    - Heathcheck +

    + Heathcheck

    Use SELECT 1 to check if database failed yet.

    -

    - Tools +

    + Tools

    -

    - Thanks +

    + Thanks

    -

    - + List of applications + >

    -

    - + pacman + >

    Uncomment in /etc/pacman.conf:

    @@ -577,11 +687,17 @@ systemctl enable gdm.service Color ParallelDownloads
    -

    - + Pipewire (WIP) + >

    @@ -601,22 +717,34 @@ pacman -Syu pipewire wireplumber \
         
    pacman -Syu sof-firmware
    -

    - + Flatpak (WIP) + >

    pacman -Syu flatpak
    -

    - + Improving performance + >

    • @@ -679,13 +807,15 @@ pacman -Syu pipewire wireplumber \
      # https://lwn.net/Articles/911219/
       kernel.split_lock_mitigate = 0
    -

    - Hardware dependent +

    + Hardware dependent

    -

    - Experiment +

    + Experiment

    Do it at your own risk!!!

    -

    - In the end +

    + In the end

    This guide is updated regularly I promise.

    diff --git a/docs/2022-12-25-go-test-asap.html b/docs/2022-12-25-go-test-asap.html index 25492ec..6c09fe0 100644 --- a/docs/2022-12-25-go-test-asap.html +++ b/docs/2022-12-25-go-test-asap.html @@ -28,13 +28,15 @@

    ~

    -

    - Speed up writing Go test ASAP +

    + Speed up writing Go test ASAP

    Imagine your project currently have 0% unit test code coverage. And your @@ -55,13 +57,15 @@ 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.

    -

    - First, rewrite the impossible (to test) out +

    + First, rewrite the impossible (to test) out

    When I learn programming, I encounter very interesting idea, which become @@ -85,13 +89,15 @@ all global var to fields inside some struct. -

    - Let the fun (writing test) begin +

    + Let the fun (writing test) begin

    If you code Go long enough, you know table driven tests and how is that so diff --git a/docs/2023-03-05-incident.html b/docs/2023-03-05-incident.html index ef3d087..80d60a1 100644 --- a/docs/2023-03-05-incident.html +++ b/docs/2023-03-05-incident.html @@ -28,22 +28,26 @@

    ~

    -

    - Incident come and go +

    + Incident come and go

    This is collect of all incidents I created in the past :(

    -

    - Service starts with empty port +

    + Service starts with empty port

    Because all configs is read from file.

    @@ -54,13 +58,15 @@ Solution: For some configs, make sure to failed first if it's empty.

    -

    - Race condition of series of APIs +

    + Race condition of series of APIs

    For example I have 2 APIs:

    -

    - Thanks +

    + Thanks

    -

    - Fold +

    + Fold

    -

    - Keymap +

    + Keymap

    Use both \ and ; as leader key:

    @@ -305,13 +324,15 @@ vim.keymap.set( -

    - References / Thanks +

    + References / Thanks

    • diff --git a/docs/2023-05-08-things-i-like.html b/docs/2023-05-08-things-i-like.html index 9142810..19f0a16 100644 --- a/docs/2023-05-08-things-i-like.html +++ b/docs/2023-05-08-things-i-like.html @@ -28,21 +28,25 @@

      ~

      -

      - Things I like +

      + Things I like

      -

      - Discord (old) naming +

      + Discord (old) naming

      The way Discord naming user likeJoker#1234 is so interesting. @@ -54,13 +58,15 @@ Why it's interesting? Each time I join a new platform, all names I want are taken :D

      -

      - Interesting website +

      + Interesting website

      • deskto.ps
      • diff --git a/docs/2023-05-23-swagger.html b/docs/2023-05-23-swagger.html index de95567..dc70490 100644 --- a/docs/2023-05-23-swagger.html +++ b/docs/2023-05-23-swagger.html @@ -28,13 +28,15 @@

        ~

        -

        - Swagger or OpenAPI +

        + Swagger or OpenAPI

        My company currently use Swagger 2 to document API.

        @@ -63,10 +65,15 @@ bunx prettier --write ./docs/swagger.yaml ./docs/swagger.json # Render locally bunx @redocly/cli preview-docs ./docs/swagger.json

    -

    - Thanks +

    + Thanks

    -

    - Use wez/wezterm - +

    + Use wez/wezterm

    -

    - Use nnn - +

    + Use nnn