Posts
All the articles I've posted.
-
MySQL 在 Y2K38 問題上的修正
MySQL 在 Y2K38 問題上的修正 前言 最近瀏覽 Year 2038 problem 維基百科條目時,發現其中列出了各種作業系統和軟體的解決方案。特別注意到 MySQL 8.0.28(2022 年 1 月釋出)終於修正了 FROM_UNIXTIME()、UNIX_TIMESTAMP()、CONVERT_TZ() 三個函式處理 64 位元數值的問題。 什麼是 Y2K38 問題? 背景說明 在 32
-
用 brew 安裝 PostgreSQL client
只需用 homebrew 安裝 libpq formula brew installl libpq 安裝完成訊息,把 libpq 的 bin 目錄加進 PATH 環境變數後 reload shell 即可使用 ==> libpq libpq is keg-only, which means it was not symlinked into /opt/homebrew, because confl
-
利用 ssh ProxyJump 直接連上內部 ssh server
可以在 ssh 使用 -J 參數指定 bastion server 和 internal server 就可以直接連上內部 ssh server % ssh -J bastion-server-hostname internal-server-hostname 如果是用 public key 認證,而且 key 有設定 passphrase 的話,可以先執行 ssh-add ~/.ssh/priv
-
利用 kubectl port-forward 和 socat 轉導 local 流量至 Kubernetes 內部
利用 alpine/socat 配合 kubectl port-forward 就可以把 local 機器的 port 和遠端 Kubernetes 內部的 port 串起來,可以開一個 pod 向只開放內部 VPC 存取的 Database 或 API server 連線。 可以參考這個 GitHub issue 的兩個 comment: Specify remote host for kub
-
EKS 每個 instance node 上所能運行的 pod 數量上限
由於每個 pod 上都會被 assign 一個 VPC subnet IP,所以每個 instance node 上的 pod 數量上限,取決於該 instance type 最多能接上的 network interface 張數及每張 network interface 上能 bind 的 IP 數量,可參考 IP addresses per network interface per inst
-
Global gitignore
專案的 .gitignore 應只放專案相關的忽略規則,個人開發工具產生的檔案(如 .idea、.DS_Store)應透過 git global ignore 在全域層級處理,避免汙染團隊的 .gitignore。
-
Time-based One-time Password algorithm (TOTP)
Basic Time-based One-time Password algorithm TOTP: Time-Based One-Time Password Algorithm, RFC 6238 Authenticator FreeOTP Google Authenticator Authy Microsoft Authenticator Article 為什麼我拋棄 Google Au
-
Docker Multi-Stage build 的 intermediate image 留存問題
Docker 在版本 17.05 後,新推出了 multi-stage build 的功能,主要目的是讓最終的 docker image 盡可能地保持乾淨,使用最少的儲存空間,只把最為必要的 artifact 放到最終要執行使用的 docker image 上,建置和打包時產生的不必要檔案則留存在中繼 image 上。 但用 multi-stage build 會讓 intermediate i
-
使用 ssh-copy-id 將 ssh public key 存到遠端 ssh server 上
如果 ssh key 不是預設的 RSA 演算法產生,例如 ed25519 或是儲存位置不是在預設的 ~/.ssh/ 下,可以用 -i 參數另外指定。 如果遠端 SSH server 的 port 不是預設的 22 port,可以用 -p 參數指定。 範例如下: % ssh-copy-id -i .ssh/id_ed25519.pub -p 22222 remote_user_name@192.
-
定時發送 database table 總筆數至 Slack 上
首先,寫隻 xxx.sql 計算資料筆數,假定 table name 是 xxx: SELECT COUNT(1) FROM xxx; 再寫個 xxx.sh 去執行剛寫好的 sql,假定資料庫是用 MySQL: #!/bin/shmysql -D xxx_database < xxx.sql | grep -v "COUNT(1)" | awk -v date="$(date +"%Y-%m-%d