diff --git a/docs/2022-06-08-backup.html b/docs/2022-06-08-backup.html index 1b1796f..ee7dd38 100644 --- a/docs/2022-06-08-backup.html +++ b/docs/2022-06-08-backup.html @@ -1,4 +1,4 @@ -
First thing first, I want to list my own devices, which I have through the years:
App/Service I use daily:
The purpose is that I want my data to be safe, secure, and can be easily recovered if I lost some devices;
or in the worst situation, I lost all.
Because you know, it is hard to guess what is waiting for us in the future.
There are 2 sections which I want to share, the first is How to backup, the second is Recover strategy.
Before I talk about backup, I want to talk about data.
In specifically, which data should I backup?
I use Arch Linux and macOS, primarily work in the terminal so I have too many dotfiles, for example, ~/.config/nvim/init.lua
.
Each time I reinstall Arch Linux (I like it a lot), I need to reconfigure all the settings, and it is time-consuming.
So for the DE and UI settings, I keep it as default as possible, unless it's getting in my way, I leave the default setting there and forget about it.
The others are dotfiles, which I write my own dotfiles tool to backup and reconfigure easily and quickly.
Also, I know that installing Arch Linux is not easy, despite I install it too many times (Like thousand times since I was in high school).
Not because it is hard, but as life goes on, the official install guide keeps getting new update and covering too many cases for my own personal use, so I write my own guide to quickly capture what I need to do.
I back up all my dotfiles inside my dotfiles tool in GitHub and GitLab as I trust them both.
Also as I travel the Internet, I discover Codeberg and Treehouse and use them as another backup for git repo.
So that is my dotfiles, for my regular data, like Wallpaper or Books, Images, I use Google Drive (Actually I pay for it).
But the step: open the webpage, click the upload button and choose files seems boring and time-consuming.
So I use Rclone, it supports Google Drive, One Drive and many providers but I only use Google Drive for now.
The commands are simple:
# Sync from local to remote
+IndexBackup my way
First thing first, I want to list my own devices, which I have through the years:
- Laptop Samsung NP300E4Z-S06VN (Old laptop which I give to my mom)
- Laptop Dell Inspiron 15 3567 (My mom bought it for me when I go to college, I give it to my sister afterward)
- Laptop Acer Nitro AN515-45 (Gaming laptop which I buy for gaming, of course)
- MacBook Pro M1 2020 (My company laptop)
- Phone Xiaomi Poco X3 NFC (Primary phone which I use daily)
App/Service I use daily:
- Bitwarden
- Aegis Authenticator
- Rclone
- Tailscale
- GitHub / GitLab
- Google Keep / Notion
- Google Drive (I use 200GB plan)
The purpose is that I want my data to be safe, secure, and can be easily recovered if I lost some devices;
or in the worst situation, I lost all.
Because you know, it is hard to guess what is waiting for us in the future.
There are 2 sections which I want to share, the first is How to backup, the second is Recover strategy.
How to backup
Before I talk about backup, I want to talk about data.
In specifically, which data should I backup?
I use Arch Linux and macOS, primarily work in the terminal so I have too many dotfiles, for example, ~/.config/nvim/init.lua
.
Each time I reinstall Arch Linux (I like it a lot), I need to reconfigure all the settings, and it is time-consuming.
So for the DE and UI settings, I keep it as default as possible, unless it's getting in my way, I leave the default setting there and forget about it.
The others are dotfiles, which I write my own dotfiles tool to backup and reconfigure easily and quickly.
Also, I know that installing Arch Linux is not easy, despite I install it too many times (Like thousand times since I was in high school).
Not because it is hard, but as life goes on, the official install guide keeps getting new update and covering too many cases for my own personal use, so I write my own guide to quickly capture what I need to do.
I back up all my dotfiles inside my dotfiles tool in GitHub and GitLab as I trust them both.
Also as I travel the Internet, I discover Codeberg and Treehouse and use them as another backup for git repo.
So that is my dotfiles, for my regular data, like Wallpaper or Books, Images, I use Google Drive (Actually I pay for it).
But the step: open the webpage, click the upload button and choose files seems boring and time-consuming.
So I use Rclone, it supports Google Drive, One Drive and many providers but I only use Google Drive for now.
The commands are simple:
# Sync from local to remote
rclone sync MyBooks remote:MyBooks -P --exclude .DS_Store
# Sync from remote to local
diff --git a/docs/2022-06-08-dockerfile-go.html b/docs/2022-06-08-dockerfile-go.html
index 9386ef2..1dd8c9d 100644
--- a/docs/2022-06-08-dockerfile-go.html
+++ b/docs/2022-06-08-dockerfile-go.html
@@ -1,4 +1,4 @@
-Dockerfile for Go
Each time I start a new Go project, I repeat many steps.
Like set up .gitignore
, CI configs, Dockerfile, ...
So I decide to have a baseline Dockerfile like this:
FROM golang:1.18-bullseye as builder
+IndexDockerfile for Go
Each time I start a new Go project, I repeat many steps.
Like set up .gitignore
, CI configs, Dockerfile, ...
So I decide to have a baseline Dockerfile like this:
FROM golang:1.18-bullseye as builder
RUN go install golang.org/dl/go1.18@latest \
&& go1.18 download
diff --git a/docs/2022-07-10-bootstrap-go.html b/docs/2022-07-10-bootstrap-go.html
index 7c69f40..685f603 100644
--- a/docs/2022-07-10-bootstrap-go.html
+++ b/docs/2022-07-10-bootstrap-go.html
@@ -1,4 +1,4 @@
-Bootstrap Go
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.
Structure
main.go
+IndexBootstrap Go
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.
Structure
main.go
internal
| business_1
| | http
diff --git a/docs/2022-07-12-uuid-or-else.html b/docs/2022-07-12-uuid-or-else.html
index 28b6141..c5a6a73 100644
--- a/docs/2022-07-12-uuid-or-else.html
+++ b/docs/2022-07-12-uuid-or-else.html
@@ -1 +1 @@
-UUID or else
There are many use cases where we need to use a unique ID.
In my experience, I only encouter 2 cases:
- ID to trace request from client to server, from service to service (microservice architecture or nanoservice I don't know).
- Primary key for database.
In my Go universe, there are some libs to help us with this:
First use case is trace ID, or context aware ID
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 care.
When I use that ID to search log , if it pops more than things I care for, it is still no harm to me.
My choice for this use case is rs/xid.
Because it is small (not span too much on log line) and copy friendly.
Second use case is primary key, also hard choice
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 syntax from MySQL, and PostgreSQL and so on.
Every logic I can move to application layer from database layer, I will.
In the past and present, I use google/uuid, specificially I use UUID v4.
In the future I will look to use segmentio/ksuid and oklog/ulid (trial and error of course).
Both are sortable, but google/uuid is not.
The reason I'm afraid because the database is sensitive subject, and I need more testing and battle test proof to trust those libs.
What else?
I think about adding prefix to ID to identify which resource that ID represents.
Thanks
- UUID, SERIAL OR IDENTITY COLUMNS FOR POSTGRESQL AUTO-GENERATED PRIMARY KEYS?
- Identity Crisis: Sequence v. UUID as Primary Key
- Generating good unique ids in Go
- How we used Go 1.18 when designing our Identifiers
- ULIDs and Primary Keys
- On IDs
\ No newline at end of file
+IndexUUID or else
There are many use cases where we need to use a unique ID.
In my experience, I only encouter 2 cases:
- ID to trace request from client to server, from service to service (microservice architecture or nanoservice I don't know).
- Primary key for database.
In my Go universe, there are some libs to help us with this:
First use case is trace ID, or context aware ID
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 care.
When I use that ID to search log , if it pops more than things I care for, it is still no harm to me.
My choice for this use case is rs/xid.
Because it is small (not span too much on log line) and copy friendly.
Second use case is primary key, also hard choice
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 syntax from MySQL, and PostgreSQL and so on.
Every logic I can move to application layer from database layer, I will.
In the past and present, I use google/uuid, specificially I use UUID v4.
In the future I will look to use segmentio/ksuid and oklog/ulid (trial and error of course).
Both are sortable, but google/uuid is not.
The reason I'm afraid because the database is sensitive subject, and I need more testing and battle test proof to trust those libs.
What else?
I think about adding prefix to ID to identify which resource that ID represents.
Thanks
- UUID, SERIAL OR IDENTITY COLUMNS FOR POSTGRESQL AUTO-GENERATED PRIMARY KEYS?
- Identity Crisis: Sequence v. UUID as Primary Key
- Generating good unique ids in Go
- How we used Go 1.18 when designing our Identifiers
- ULIDs and Primary Keys
- On IDs
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
index a0368ed..4dd404b 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1 +1 @@
-Index
This is where I dump my thoughts.
\ No newline at end of file
+IndexIndex
This is where I dump my thoughts.
\ No newline at end of file
diff --git a/templates/post.html b/templates/post.html
index a570380..b9799e9 100644
--- a/templates/post.html
+++ b/templates/post.html
@@ -12,6 +12,7 @@
+ Index
{{.Body}}