From 5895dd7283e6e2549a83aefdfd290f043786f555 Mon Sep 17 00:00:00 2001 From: Shueh Chou Lu Date: Tue, 22 Aug 2023 10:01:30 +0800 Subject: [PATCH] tcp-rst-incident: resize thumbnail --- lib/README.md | 2 +- lib/evan361425/figcaption.py | 18 ++++++++++++------ src/essay/2022-ai-review.md | 8 ++++---- .../tcp-socket-loss-after-dhcp.md | 7 +++++-- src/essay/web/tcp-reset-docker.md | 19 ------------------- .../future-of-fusion-energy/energy.md | 2 +- .../incident-response.md | 4 ++-- src/latest-works.md | 2 +- 8 files changed, 26 insertions(+), 36 deletions(-) delete mode 100644 src/essay/web/tcp-reset-docker.md diff --git a/lib/README.md b/lib/README.md index a11c9eb9..de119e46 100755 --- a/lib/README.md +++ b/lib/README.md @@ -27,7 +27,7 @@ Add caption in table by next blockquote, for example: | -------- | -------- | | a | b | -> The caption text, it will ignore any html effect include [links](this will ignored) +> The caption text, it will ignore any html effect include [links](this will be ignored) ``` Using `/` as prefix will ignore using caption, for example: diff --git a/lib/evan361425/figcaption.py b/lib/evan361425/figcaption.py index 0e4a330c..f065d29f 100644 --- a/lib/evan361425/figcaption.py +++ b/lib/evan361425/figcaption.py @@ -12,6 +12,8 @@ # Constants and utilities # ------------------------ IGNORE_PREFIX = "!" +IGNORE_FIRST_CHAR = "/" + # ------------------------ # Plugin @@ -59,12 +61,16 @@ def on_post_page(self, output_content, **_kwargs): caption = image.attrs["alt"] if quote and quote.name == "blockquote": - caption = ( - caption - + "
來源於:" - + quote.findChild("p").encode_contents().decode("utf-8") - ) - quote.extract() + quoted = quote.findChild("p").encode_contents().decode("utf-8") + if not quoted.startswith(IGNORE_FIRST_CHAR): + if quoted.startswith("{"): + index = quoted.index("}") + width, height = quoted[1:index].split("x") + image.attrs["width"] = width + image.attrs["height"] = height + quoted = quoted[index + 1 :] + caption = caption + "
來源於:" + quoted.strip() + quote.extract() figcaption.append(BeautifulSoup(caption, "html.parser")) diff --git a/src/essay/2022-ai-review.md b/src/essay/2022-ai-review.md index 2cdcb8e5..536ac905 100644 --- a/src/essay/2022-ai-review.md +++ b/src/essay/2022-ai-review.md @@ -14,7 +14,7 @@ ![ChatGPT 能夠理解語意,也能進行「創作」][chat-image] -> Sourced from [Yahoo!][chat-image-src] +> [Yahoo!][chat-image-src] 今年最後一個月,OpenAI 推出了 [ChatGPT][chat-ui],這次推出完全顛覆了我對 AI 的想像。 其帶給我的震撼,更甚當初 AlphaGo 下圍棋,而且正是因為它,我才有撰寫這篇文章的動力。 @@ -41,7 +41,7 @@ ChatGPT 能做到的事情太多了,以下幾個有趣案例: ![AI 繪圖能做的事遠超當初推出時的想像][draw-image] -> Sourced from [metaphysic][draw-image-src] +> [metaphysic][draw-image-src] AI 繪圖無疑在今年大放異彩,不只是 [Stable Diffusion][draw-stablef],還有 OpenAI 的 [DALL-E][draw-dalle]。隨著發展,網路也出現越來越多奇耙應用,例如圖片動漫化等等。 @@ -57,7 +57,7 @@ AI 繪圖無疑在今年大放異彩,不只是 [Stable Diffusion][draw-stablef ![顏色越藍代表準確性越高,蛋白質的中心部分通常準確率較高,而外圍則會很複雜且準確率較低。由此也看得出蛋白質的構造是三維且沒有固定格式][alphafold-i-base] -> 本圖來源於[科技新報][alphafold-tecnews] +> [科技新報][alphafold-tecnews] 這裡要注意的是,AlphaFold 做的事情是 *預測*。 換句話說,如果我們要驗證這個預測,方式仍然是使用傳統的 [X 射線、核磁共振或冷凍電鏡等][alphafold-comment]。 @@ -67,7 +67,7 @@ AI 繪圖無疑在今年大放異彩,不只是 [Stable Diffusion][draw-stablef ![科學家和 AlphaFold2 合作建構出的蛋白質繪圖][alphafold-i-app] -> 本圖來源於[科技新報][alphafold-cytoplasmic] +> [科技新報][alphafold-cytoplasmic] 有了蛋白質的構造,我們就可以依此發展相對應的藥物和治療方法,所以蛋白質構造預測才會這麼重要。 diff --git a/src/essay/architecture/tcp-socket-loss-after-dhcp.md b/src/essay/architecture/tcp-socket-loss-after-dhcp.md index edf6e68c..c26d58fc 100644 --- a/src/essay/architecture/tcp-socket-loss-after-dhcp.md +++ b/src/essay/architecture/tcp-socket-loss-after-dhcp.md @@ -16,7 +16,7 @@ image: https://i.imgur.com/fRevWCC.png ![列出狀態連線](https://i.imgur.com/2Wo5cac.png) -> 我們使用 [netstat](https://man7.org/linux/man-pages/man8/netstat.8.html), +> /我們使用 [netstat](https://man7.org/linux/man-pages/man8/netstat.8.html), > 但也可以使用更現代的 [ss](https://man7.org/linux/man-pages/man8/ss.8.html)。 ```bash @@ -168,7 +168,7 @@ tcp 6 110 TIME_WAIT src=172.0.0.1 dst=172.0.0.4 sport=40286 dport=80 src=172.0.0 - `UNREPLIED` 代表這個 UDP「連線」沒有收到回覆,這是 [UDP 特有的狀態](https://elixir.bootlin.com/linux/v5.19.17/source/include/net/netns/conntrack.h#L37); - IP 和 Port - mark,根據商務邏輯標記這個連線,例如 iptables 的阻擋等等; -- [use](https://elixir.bootlin.com/linux/v5.19.17/source/include/net/netfilter/nf_conntrack.h#L60) 是 counter用來記錄 GC 狀態。 +- [use](https://elixir.bootlin.com/linux/v5.19.17/source/include/net/netfilter/nf_conntrack.h#L60) 是 counter 用來記錄 GC 狀態。 在第二行中,TCP 連線最後進入 [`ASSURED`](https://thermalcircle.de/doku.php?id=blog:linux:connection_tracking_3_state_and_examples#nfconnstatus_detail) 狀態, 代表這個連線已經建立起來不會被因為倒數計時而被回收,但是它仍會在 TCP 結束連線後被回收。 @@ -277,3 +277,6 @@ Jul 4 10:52:38 my-host systemd-networkd[913]: ens3: DHCPv4 address 172.1.0.1/20 既然排查出是 client 的問題,我們也可以試著在相同環境的其他節點看看是否有連線錯誤問題。 最後就是雖然非系統管理者無法在線上環境中操作相關節點,但是當進入排查的流程時, 需要盡快讓相關人員可以進到節點進行各種實驗,否則每次做操作都需要大家約時間,簡直曠日費時。 + +最後,這段的排查很大程度是同事 Angus 做的,在這邊僅作簡單紀錄, +若未來有任何人因為這篇文章得到幫助,僅以此表達對 Angus 的感謝。 diff --git a/src/essay/web/tcp-reset-docker.md b/src/essay/web/tcp-reset-docker.md deleted file mode 100644 index c7f9447e..00000000 --- a/src/essay/web/tcp-reset-docker.md +++ /dev/null @@ -1,19 +0,0 @@ -# Docker Bridge 環境下的 TCP Reset - -查找 [conntrack](https://arthurchiao.art/blog/conntrack-design-and-implementation-zh/) 設定: - -```bash -sysctl -a | grep 'conntrack' -``` - -查找 conntrack 下的網路資訊: - -```bash -conntrack -S -``` - -查找 kernel 資訊 - -```bash -dmesg -T -``` diff --git a/src/feedback/future-of-fusion-energy/energy.md b/src/feedback/future-of-fusion-energy/energy.md index 5910f09b..e2d7dd3d 100644 --- a/src/feedback/future-of-fusion-energy/energy.md +++ b/src/feedback/future-of-fusion-energy/energy.md @@ -204,7 +204,7 @@ ![全球儲電使用技術比例][ES-global-rate] -> 來源於 [2021 年中國能源局的儲能產業白皮書](https://static1.squarespace.com/static/55826ab6e4b0a6d2b0f53e3d/t/60d2fff40aec596dc9e5cd65/1624440841870/CNESA+White+Paper+2021-PDF),臺灣的政治立場常常會讓大家忽視中國的優點,值得注意的是儲能產業中使用率最高的分別是中國、美國、歐洲、南韓和日本。 +> [2021 年中國能源局的儲能產業白皮書](https://static1.squarespace.com/static/55826ab6e4b0a6d2b0f53e3d/t/60d2fff40aec596dc9e5cd65/1624440841870/CNESA+White+Paper+2021-PDF),臺灣的政治立場常常會讓大家忽視中國的優點,值得注意的是儲能產業中使用率最高的分別是中國、美國、歐洲、南韓和日本。 最常被使用的儲電機制是利用水位差,也就是當製造多餘的電能時,透過馬達把下游水庫的水送往上游水庫,這時電能就會被轉換成重力位能差,這方式的整體能量轉換率為相當高的 75%。 然而即使我們把地球上所有河流和湖泊的水都往上抬昇 30 公尺來儲存位能差[^1],也不足以滿足人類一年所需的 5%,這也回應了我們前面說水力僅能供應約人類所需的 10%。 diff --git a/src/feedback/site-reliability-workbook/incident-response.md b/src/feedback/site-reliability-workbook/incident-response.md index 6056668b..320c1c83 100644 --- a/src/feedback/site-reliability-workbook/incident-response.md +++ b/src/feedback/site-reliability-workbook/incident-response.md @@ -80,7 +80,7 @@ Jasper 開票追蹤這個異常狀態,並備註短時間的存取量來到一 最終專案管理員再一次請求提高限流後,問題被舒緩,同時開發者也在集中溝通的情況下暸解彼此狀況, 並進一步排查出根因。 -### 事後分析 +### Google Home 事件的事後分析 因為開發者在週末仍致力於處理這個問題,所以即使在週末,這問題仍被解決了, 但這並不是一個好的處理問題方式,因為最終我們都希望公司成為一個能替員工平衡工作和生活的地方。 @@ -90,7 +90,7 @@ Jasper 開票追蹤這個異常狀態,並備註短時間的存取量來到一 當錯誤狀況被紓緩時,應該要專注於排查問題的根因,而不是繼續推廣新版本。 最後,當問題排查不清時,應該將錯誤提升到事件,並召集相關人士一起來處理,這樣可以避免: -- 溝通壁壘,錯誤追蹤系統並不是良好的溝通橋樑; +- 溝通壁壘,缺陷追蹤系統(e.g. JIRA)並不是良好的溝通橋樑; - 不同角度的看待事情,會加速錯誤的排查; - 讓不同部門的同仁面對線上錯誤有進一步的心理準備。 diff --git a/src/latest-works.md b/src/latest-works.md index 3ee6b32d..184261bb 100644 --- a/src/latest-works.md +++ b/src/latest-works.md @@ -6,6 +6,6 @@ ![TCP socket 連線被清除的錯誤排查](https://i.imgur.com/fRevWCC.png) -> [DALL·E](https://openai.com/dall-e-2) +> {384x461}[DALL·E](https://openai.com/dall-e-2) [TCP socket 連線被清除的錯誤排查](essay/architecture/tcp-socket-loss-after-dhcp.md),連線會在一段時間後關閉,發生什麼事了?