Skip to content

Instantly share code, notes, and snippets.

View weihanglo's full-sized avatar

Weihang Lo weihanglo

View GitHub Profile
@weihanglo
weihanglo / k8s-autoscaling.md
Last active March 31, 2020 14:53
Kuberenetes Autoscaling 相關知識小整理

Kuberenetes Autoscaling 相關知識小整理

K8s 有好用的 autoscaling 功能,但你知道除了 pod 之外,node 也可以 auto scaling 嗎?帥,你知道就不用分享了啊 🚬

本文以重點整理的方式,先介紹目前常見的 Autoscaler,再介紹一些防止 pod 被亂殺的 config。

(撰於 2020-03-23,基於 Kubernetes 1.17,但 Api Versions 太多請自行查閱手冊)

@weihanglo
weihanglo / rustconf-2019-1.md
Last active January 25, 2024 10:18
RustConf 2019 雲參訪錄(1)

RustConf 2019 雲參訪錄(1)

RustConf 是 Rust 社群年度最重要的研討會之一,從 [Rust 在 2015 年 1.0 版正式發布][rust-1.0]之後,[2016][2016]、[2017][2017]、[2018][2018] 連續三年都在美國舉辦,今年當然不例外,八月底在 NBA 球迷稱作 Rip City 的波特蘭舉行。由於歷史悠久,加上 Rust 社群在美國較為活躍,許多 Rust Core Team 成員都會共襄盛舉,這場研討會是 Rust 開發者絕對不能錯過的盛事。

RustConf 歷年來皆由 [Tilde Inc.][tilde] 旗下的 [Skylight][skylight] 主辦,Skylight 是一個 Rails profiler in production 的解決方案,產品中關鍵的模組用了不少 Rust。

好了,介紹完背景,這篇文章主要是紀錄小弟我「在 YouTube 上」觀看演講的心得分享,當然,RustConf 除了主要的演講軌,還有不少場邊工作坊等小活動,這就留給看倌明年到實地考察啦!

@weihanglo
weihanglo / xor_shift64.rs
Last active August 26, 2020 07:34
Single pseudo-random generator in Rust
pub struct XorShift64 {
a: u64,
}
impl XorShift64 {
pub fn next(&mut self) -> u64 {
let mut x = self.a;
x ^= x << 13;
x ^= x >> 7;
x ^= x << 17;
@weihanglo
weihanglo / rust-ownership-and-references.md
Last active February 18, 2021 08:50
Rust: Ownership and References

Rust: Ownership and References

This is a series of quick notes about the fundamentals of the Rust programming language. It would cover parts of basic concepts and patterns in Rust. As a Rust begineer and a non-native English speaker, I may make some silly mistakes in my notes. Please contact me if there are some misleading words.

(written on 2018-09-30)

Ownership and References

Keybase proof

I hereby claim:

  • I am weihanglo on github.
  • I am weihanglo (https://keybase.io/weihanglo) on keybase.
  • I have a public key whose fingerprint is 7D84 EA07 47C1 240C 2A16 D2A6 D7DB F189 825E 82E7

To claim this, I am signing this object:

@weihanglo
weihanglo / rust-vs-go.md
Last active January 28, 2024 06:56
【譯】Rust vs. Go

【譯】Rust vs. Go

本文譯自 Julio Merino 2018 年七月撰寫的 Rust vs. Go 一文。Julio Merino 是 G 社僱員,在 G 社工作超過 8 年,無論工作內外,都接觸開發不少 Go 語言,並撰寫 [Rust 點評][rust-review]系列文,來聽聽他對 Rust 與 Go 的想法吧。

Thanks Julio Merino for this awesome article!


@weihanglo
weihanglo / 4-podcasts-software-engineers-may-love.md
Last active March 31, 2021 12:07
4 Podcasts Software Engineers May Love

4 Podcasts Software Engineers May Love

Image by Nick Youngson CC BY-SA 3.0

As a non-native English speaker, I often try several methods to improve my English skills. Listening to podcasts is one of the most interesting way to practice English, especially with fascinating topics I indulge in.

Therefore, I pick some of my favorite podcasts about software engineering to share with you. Enjoy these awesome shows and don't forget to give them some feedback.

@weihanglo
weihanglo / tokio-internals.md
Last active March 14, 2024 15:48
【譯】Tokio 內部機制:從頭理解 Rust 非同步 I/O 框架

本文譯自 [Tokio internals: Understanding Rust's asynchronous I/O framework from the bottom up][tokio-internals]。
Thanks [David Simmons][david-simmons] for this awesome article!

[Tokio][tokio] 是 Rust 的開發框架,用於開發非同步 I/O 程式(asynchronous I/O,一種事件驅動的作法,可實現比傳統同步 I/O 更好的延伸性、效能與資源利用)。可惜的是,Tokio 過於精密的抽象設計,招致難以學習的惡名。即使我讀完教程後,依然不認為自己充分內化這些抽象層,以便推斷實際發生的事情。

從前的非同步 I/O 相關開發經驗甚至阻礙我學習 Tokio。我習慣使用作業系統提供的 selection 工具(例如 Linux epoll)當作起點,再轉移至 dispatch、state machine 等等。倘若直接從 Tokio 抽象層出發,卻沒有清楚了解 epoll_wait() 在何處及如何發生,我會覺得難以連結每個概念。Tokio 與 future-driven 的方法就好像一個黑盒子。

@weihanglo
weihanglo / days-with-internet-explorer-2.md
Last active February 3, 2020 06:20
與 IE 相處的日子二:淺談網頁相容性

與 IE 相處的日子二:淺談網頁相容性

還記得之前整理的 [IE 相容性][days-with-internet-explorer] 一文嗎?筆者最近參與公司新版 Web App 架構規劃與開發,又遇到許多相容性的問題,連新版瀏覽器也無法倖免。就讓我們再次探討瀏覽器相容性吧!

(撰於 2017-12-09,基於各種莫名其妙的狀況)

@weihanglo
weihanglo / openssl-cheatsheet.sh
Last active December 5, 2020 02:01
OpenSSL CheatSheet
# Create X509 self-signed certificate.
openssl req \
-newkey rsa:2048 -nodes -keyout cert.key \
-x509 -days 365 -out cert.pem
# Convert from PEM format to DER.
openssl pkcs12 \
-inkey cert.key -in cert.pem \
-export -out cert.pfx