Hooray~ IT works!

I'm a linux user who has seen two kinds of penguins in the bush!

Who I am

Taiwanese, fullstack developer, one of the IT crowd, on my way of learning to build my own computer.

Recent Posts

In mandarin, 1(yi)7(qi) sounds similiar to together, lets do c++ together!! 此系列文章跟 17 公司沒有任何關係,單純紀錄學習 C++17 XD 我的背景 曾經維護過有點古老,基於 ACE framework + MFC 的 C++ 網路程式。(那時候真的不知道自己在幹麻) 學了一點 C 語言(從 jserv 的線上/下課程),了解基礎的 Linux 系統及網路管理。 讀過 CSAPP 3e,大概知道 C 語言與 X86_64, system programming 的距離。 預期目標 了解 C++17 的關鍵字,以及稱不上現代/modern 但是符合這個時代的 C++ 開發工具、慣例。 主要目標是讓自己成為更好的 Linux system programmer…

Keep Reading →

To interact with Linux, the operating system, we can use shell, a program which parses the commands we input, execute, and return the results. For the history of shell and why people interact in this way, check out this video on early days of computers by MIT. I often think of shell as the outer "shell" while interacting the inner working kernel - operating system. You might ask why not use mouse…

Keep Reading →

Install & hello! Note: This will not work with centos/rhel6, since the curl version is too old and ssl1.2 is not patched. Download it as a script and execute it if you're dealing with such kind of platform. you will need cc(gcc) installed, and of course internet connection. install with default setting, this will add rustc, cargo, rustup into your shell env. cargo new hello, cd hello, cargo run…

Keep Reading →

紀錄一下媽媽喜歡的心經及其相關資訊。 題外話,在澳洲生活的時候遇到的印度大吉嶺朋友也很喜歡分享一些玄奘在印度留下的事蹟,在工作之餘可以聽這些故事讓我開心許多,少點壓力。雖然我還是覺得希臘哲學比較實用,可以把人抽象成狀態機,理性行事。但但佛學似乎又有穩定人心的功用,即便是非常講邏輯的人也需要讓自己靜心才能理性思考。或許人心需要不同的調劑來找到平衡吧,如何在生活中找到平靜同時透過希臘學派創造的機器來達成日常工作或許是一個我想達到的境界(?)。 說實在我覺得這經典在以前大概是流行歌兼心靈寄託的角色吧,念起來實在是蠻順的,玄奘或許是個有才華的大詩人之類的。聽說他在印度的時候帶了很多人進去交流,當地留下很多學校。一個人要通梵文把歌翻唱得這麼流行,真的不簡單啊。 再來題外話,佛經裡面也塞了很多四十二萬億眾生之類的神奇數字,或許之後也可以寫一篇來蒐整那些有趣的數字。 般若波羅蜜多?…

Keep Reading →

2020-03-06 起台灣政府推動口罩實名制政策,因為規則常改,網路上的新聞出現“其餘規則不變”讓我這個記性不好的人很困擾(想不起來其餘規則是啥),於是來整理這篇。 Changelog: 20200307, 參考資料 109-03-02 衛福部 Q&A 區 何時可買? 用健保卡買了以後,七天後始得再買。 Eg: 2020-02-20 買了 2020-02-27 才能買。 能買多少? 成人口罩購買量增加為7天3片,兒童購買口罩購買量增加為7天5片。 一片五元 那裡可買? 全國各據點(含健保特約藥局及衛生所) 查詢:目前覺得 kiang 做的口罩地圖用起來最順手。 English version: Started from 2020-02-06, to buy masks in Taiwan, you need to follow the instructions from Taiwan…

Keep Reading →

Glossary ESD electrostatic discharge, subset of EOS EOS https://cse.nsysu.edu.tw/p/406-1205-167375,r3083.php?Lang=zh-tw stories of ESD https://www.ptt.cc/bbs/Tech_Job/M.1504455297.A.4DB.html https://www.ptt.cc/bbs/Tech_Job/M.1505661716.A.793.html TCL how to compile/install tcl Tcl Basics Commands and variables ** puts, set Substitution and evaluation ** Mathematical operations Procedures…

Keep Reading →

C++ 17 之後開始支援檔案系統的操作 Here comes an example of using filesystem library to "ls" a file. (breaks on first whitespace or newline https://gitlab.com/owlfox/random_things/-/blob/master/ls.cpp A good way of opening file in C++ with RAII/no need to close the file. for different modes of openning a file, see this(in, out, at the end, append, binary, ...) To read/write a file, we can use stream operator to…

Keep Reading →

寫這篇文的原因是這一影片: https://www.youtube.com/watch?v=hMloyp6NI4E 大概 Brain Harvey 教授 是說習慣抄近路、作弊對你的人生習慣的負面影響。 Rev0: 2020020…

Keep Reading →

這一篇用一些 concurreny 的範例來學習 C++17 的 thread library 關於 concurrency 的定義可以參考 Better Embedded system software 20 章。 關鍵字 pthread thread id address space join lock free Synchronization 正文開始 Since C++ 11, there's thread library available to use, before we had to use 3rd party libs like pthread, some comes with more powerful abstractions like boost, POCO, ... etc. bits of pthread We have to cast thread…

Keep Reading →

Changelogs 2020-03-10 新增可能的系統改善作法 前言 2018 年對台灣有點心灰意冷,去了澳洲確認那裡的生活環境,體驗一下過完生活。那裡的環境我覺得挺好的,對基層勞工來說,我覺得可以活得像個人,低標收入 OK 大約 48000 AUD/year ,人的價值相對能得到體現。對比台灣的儒家、從眾、王道文化,我覺得可以活得自由一點。 生活了一陣子聽到家人朋友離開,讓我調整原本想在澳洲拿居留權的想法。心想回台灣發展專業技能,後續如果有更好的機緣再往國外發展也不挺好的。人生不外乎就是做些選擇,別讓自己後悔。自己英文好像也有練習到,應對外國人的反應有提升,即便在台灣也可以做有強度的工作,有意義的事情。 於是 2019 年 Q…

Keep Reading →

Vim files with netrw ref guide dot command scripting configs moves zz to center your page jump to jump back & forward panes , vertical split <C-wh/j/k/l> move around panes shell cmd in vim :! cmd ... turn on/off line number :set number :set number! copy doc to clipboard https://stackoverflow.com/questions/1620018/copy-all-the-lines-to-clipboard move HLM Control - Move back one full screen…

Keep Reading →

因為未來的工作來學習一下 vuejs, quasar, typescript, .... Orz 基本上只想練基本語法、套件跟狀態管理。 CSS 還有 UIUX 那些東西,能力範圍之外,不強求。

Keep Reading →

前言 趁著過年這段時間學習一下網路、分佈系統的基礎知識。至少了解該有的基本知識,相關關鍵字,以及舉得去幾個有趣的例子。 但是翻了一下這些書都非常理論,希望可以找點程式碼來看。 Actor, MPI, CSP examples implementations C++ ref go coroutine https://www.distributed-systems.net/index.php/books/distributed-systems-3rd-edition-2017/ ACTORS: A Model of Concurrent Computation in Distributed Systems Gul A. Agha Communicating Sequential Processes C. A. R. Hoare https://cs.stanford.edu/people…

Keep Reading →

Linear algebra done right resources videos: https://www.youtube.com/watch?v=rk__T8_kVc8 solutions for ref: https://linearalgebras.com/

Keep Reading →

why 當我們需要處理以下議題: Latency, 系統延遲,等候時間, msec Rate, 操作/請求頻率, req/sec Throughput, 頻寬, bit(byte)s/s Utilization, 時間內資源忙碌程度, % Cost, 價格/效能比 他們可能源自:等候系統資源(網路、硬碟、同步鎖)、CPU 運算速度、OS 排程, ... 如何快速找出系統效能瓶頸、評估問題所在、降低營運成本? ebpf(bcc, bpftrace) 可以如何協助我們完成這些事? 安裝 bpftrace 方法請看 readme How 辨別負載特性的流程 誰造成的? pid, process name, UID, IP address 為什麼會有這負載? 程式路徑、 stack trace, flame graph 負載量? IOPS, throughput, type…

Keep Reading →

C++ 與 linux 系統程式開發 作業系統管理硬體資源並提供程式執行環境,我們將以 linux 作為主要的系統程式開發平台。 linux 作為自由軟體界的作業系統代表,在個人電腦、伺服器都有有廣泛應用。 作業系統支援 不同的硬體架構,例如 x86-64, arm, 等不同處理器架構,並提供相同的程式開發介面 API 讓開發人員透過呼叫 system call 跟系統互動。 ABI application binary interface 為不同作業系統間規範執行檔如何包裝及呼叫 system call 以 BIOS 為例子,我們只要在暫存器放入不同資料,並呼叫特定指令即可與硬碟進行互動,不管理底層硬碟、其他同步運行的程式細節。BIOS 將會中斷程式運行,並取得硬碟資料後將控制權交還給當前程式。 中斷處理時的記憶體、暫存器資料拜訪規範即為 ABI。 常見的 system call…

Keep Reading →

Notes of book reading... summary We must understand how our programs getting executed on our process to be a good system programmer. I have been reading this book for years... since 2015 and I am still not feeling a sense of accomplishment. As my new year resolution I decided to finish it. No matter what happens I will finish every problem and every labs of this book to keep one of my promises.

Keep Reading →

Notes of book reading... summary ch1 why kubernetes ch2 docker ch3 how to deploy k8s ch4 cmds to play with k8s ch5 pods ch6 labeling annotation ch7 services ch8 ingress/ load balancing ch9 replicaSet ch10 life cycle of deployment ch11 daemon sets ch12 jobs ch13 config maps, secrets ch14 ? ch15 storage ch16 extending k8s ch17 deploy a REAL app ch18 version control of k8s ch1 why availability…

Keep Reading →

前言 紀錄一些有印象、或是印象中有效的學習方法。 Good 將資訊重新組織成可以輸出的格式,如網誌、程式碼。 將資訊物件的關聯透過心智圖、樹狀圖做整理。 將一個難以複製的技能反覆練習到隨心所欲,可信手拈來。 費曼學習法 給不懂的東西一個好名字 像教小孩一樣寫下筆記 Bad 記住題目的樣式,copy paste。 參考資訊 費曼先生的線上課程 https://www.microsoft.com/en-us/research/project/tuva-richard-feynman/?from=http%3A%2F%2Fresearch.microsoft.com%2Ftuva

Keep Reading →

how-to first get a hackble nswtich prepare your SD https://switch.homebrew.guide/hacking/fuseegelee/sdsetup upgrade system firmware https://switch.homebrew.guide/usingcfw/manualupgrade ISSUES macosx ruined file system sudo chflags -R arch /Volumes/UNTITLED sigpatch https://nxhax.com/Thread-Invalid-NCA-Might-mean-missing-sigpatches-or-a-too-low-firmware-Solution

Keep Reading →

Chapter 12 軟體設計 tags: mutex, concurrency, better-embedded 這裡是對CMU的Philip Koopman教授的著作 Better Embedded System Software 20章 做的翻譯練習。 重點提示 軟體設計藉由總攬全局的上層表示在不給出每一行的規範前提下???? 常見的設計呈現方式有: pseudo code, 流程圖 flowchart, 狀態圖 statecharts。 比起跳過設計階段直接開始寫 code, 先寫出一份軟體設計有助於整理思緒及更有效的找出可能問題。 Model-based design 可以讓我們在設計層級上作業並透過 synthesis 工具自動產出實作的程式碼??? 章節內容: 12.1 章節總覽 12.2 設計扮演的角色 設計裡不應包含任何形式的實作及程式碼 12.…

Keep Reading →

Chapter 20 Mutexes and Data Access Concurrency tags: mutex, concurrency, better-embedded 這裡是對CMU的Philip Koopman教授的著作 Better Embedded System Software 20章 做的翻譯練習。 關於 C 語言提供的 atomic 操作支援或許可以看看: https://en.cppreference.com/w/c/atomic modern C 最後一章 https://gustedt.wordpress.com/2019/09/18/modern-c-second-edition/ 重點提示 各 tasks 共享的變數必須要有保護並行(concurrency)操作的機制來避免臭蟲/bug。 常見的危險動作是 multi-byte…

Keep Reading →

Chapter 27 Security tags: security, embedded, better-embedded 這裡是對CMU的Philip Koopman教授的著作 Better Embedded System Software 27章 做的翻譯練習。 特別聲明:此文是為了幫助工程師建立更可靠的系統,不是教你做壞事XDD。 重點提示: 嵌入式系統近來更常成為攻擊的目標,資安是設計時必須考量的議題。 你的系統必須具有適當的保密、認證機制、完整性、隱私及可用性。(secrecy, authentication, integrity, privacy, and availability) 可靠的系統結合了許多不同資安措施來應對重大的威脅並能與時俱進。 此章節涵蓋內容如下: 27.1 概述 27.2 Embedded security overview…

Keep Reading →

前情提要 這是基於五倍紅寶石課程的 rails 線上課程作業所寫的筆記。目前我還在練習可以在兩個小時內砍出一個功能 OK 的網站。 rails Ruby on Rails 是 Basecamp 公司用 Rbuy 語言開發的網頁系統程式框架 / Framework。框架可以想成建築物的設計/骨幹,使用這套工具可以套用許多既有的工具、know-how 來進行網頁程式的開發,加快產品上市時間。功能諸如: MVC 方式規劃程式碼架構,方便閱讀及管理。 cors 攻擊防護 html template ORM rails generator 等模板程式產生工具 rspec 測試工具整合 6.0 開始新增 webpack 整合 ruby Ruby 是 Yukihiro Matsumoto 設計的程式語言。不同於 C 語言需要經過 GCC/Clang 等需要編譯及預設在有作業系統提供之 Api…

Keep Reading →

前情提要 這篇主要介紹 SSD 的讀寫單位如 page、 block,以及寫入放大 (write amplification) 、 wear leveling 等 SSD 問題及設計。除此之外, Flash Translation Layer (FTL) 及其兩個主要功能 logical block mapping, garbage collection (gc)。也以 hybrid log-block mapping 設計當例子介紹 FTL 如何實際進行一個 flash 的寫入操作。 如果是我的筆記會像這樣加註在 info 欄位。 3. SSD 的基本操作 3.1 讀、寫、抹 因為 nand flash 的物理特性, flash memory 存取時必須要遵循特定規則,如果我們了解這些特性對我們在最佳化資料結構設計時會有幫助。 SSD 讀取以分頁 (page…

Keep Reading →

前情提要 在了解 FTL 之後,這裡將對 TRIM, over-provisioning 作介紹,並探討 clustered block 以及 SSD 不同層級的平行機制。 5 Advanced functionalities 5.1 TRIM 依照 HDD 的慣例,檔案系統刪除資料時不一定要真的下抹除指令到硬碟去(真的要刪的時候只要直接複寫過去就好了)。造成可能有檔案系統回報硬碟是空的、裡面塞滿實質 stale 的資料但 controller 不知情的情況。這會造成 controller 沒法有效 GC,到了發現要複寫了才開始清出空間,最後導致效能低落。 另外一個問題是,controller 快樂的把那些 controller 應該知道要刪除的資料搬來搬去做 wear leveling,但是這些都是做白工,而且干擾了 foreground…

Keep Reading →

前情提要 作者在介紹了 SSD 內部運作原理後,為何同時 (concurrent) 進行的讀寫行為會互相干涉,並介紹如何更好的 SSD 讀寫手法。此篇也涵蓋了一部分可改善效能的檔案系統最佳化手段。 7 Access Patterns 7.1 定義循序及隨機 IO 操作 Sequential/循序:一個 IO 操作的 LBA / Logical block address 開頭接著上一個操作 LBA 的結尾。除此之外皆視為隨機。 值得注意的是即便我們 LBA 是連續的,經過 FTL 之後實際存在 physical block 的資料還是可能會四散各處。 7.2 寫 效能評定報告及廠商規格通常會顯示循序寫入速度慢於隨機寫入。 但作者這類資料是用小於 clustered block size 的資料量(< 32 MB…

Keep Reading →

前情提要 第六篇,這篇就是把五篇的重點做個摘錄。 基礎 SSD(solid state drive) 是基於 flash NAND memory 製作的儲存裝置。資料(Bits)儲存在不同種類的 cell 裡,當時有 SLC, MLC, TLC,分別代表一個 cell 裡面可存 1, 2, 3 個 bit(s),並有不同的讀寫時間、壽命等特性。 每個 Cell 有 P/E (Program/Erase) cycles 次數限制,超過了該 Cell 就不能用了。意味著 SSD 裝置會隨著使用過程損耗、有“可預期”的使用年限。 效能評定 (Benchmarking) 很難做。原廠及第三方的報告都要多看多比較,別輕易相信他們的數字。可以的話自己買了做一次效能測試。並確定你了解效能指標的意義,且該數據有達到你的需求。 Pages and blocks 鄰近的cell…

Keep Reading →

緣由 Emmanuel Goossaert 是 booking.com 的工程師,他因為想拿 SSD 做自己的 key-value store 專案的儲存方案,開始學習 SSD 相關知識。這六篇文是他在 2014 年寫下,裡面很多的參考資訊可能都找不到了,但是我剛好在準備 SSD 相關工作面試,想想還是有參考價值,所以做了簡單翻譯,跟一些筆記,再加一些蔥(個人意見)。 蔥長這樣 原文請參考 1,系列文章請看 coding for SSD tag。 結論 作者對這系列文章的結論可以看第六篇 我的結論 我自己是覺得這系列文章對於入門了解 SSD 還不錯。如果要做到這種程度的最佳化必須要很多人一起投入。 sysadmin 必須確認檔案系統、SSD 型號、作業系統配置。 developer 應用層的程式必須要注意錯誤的寫入/讀取的資料大小/頻率可能對 SSD…

Keep Reading →

緣由 這篇主要談論 Nand flash 的不同 cell type,基本的 SSD 系統架構,及如何做 SSD 效能評定(Benchmarking)。作者是在 booking.com 上班的軟體工程師。有用過應該就知道這是很大的旅遊訂房行程規劃服務網站,在這類工作環境可能需要對底層的效能有深入解快,才能解決工作上的實務問題。我覺得這類軟體從業人員提供的觀點對自己來說幫助很大,所以翻譯/兼做做筆記。 SSD ? Solid state drives,顧名思義 SSD 設計裡去除了傳統硬碟裡不 solid,會動的部分,改善了噪音、震動、讀寫速度慢、易損壞及資料分散時需要硬碟重組來改善讀取時間等缺點。 SSD 作為儲存裝置: 優點: 隨機存取快、且存取時間固定,HDD 的 seek time ? 沒這毛病! 體積小,看看這些愈來愈小的筆記型電腦、移動裝置、SD…

Keep Reading →

Gatsby, React, Netlify, ... I tried a few static website generator like hugo, jekyll. And It turns out I have to use Gatsby since it's React friendly so makes it more extensible. I feel like I have to learn React because most of the frontend job description comes with it and I generally like its way to encapsulate code and view together and pass messages around the components. It just feels more…

Keep Reading →