Cloudflare Workers 提供的 MySQL/MariaDB 方案
在「Build global MySQL apps using Cloudflare Workers and Hyperdrive」這邊看到 Cloudflare 提供了 Cloudflare Workers 使用 MySQL/MariaDB 的方案。 本來以為是做出了 replicated globally 的系統,還在想要怎麼處理 ACID 問題,花了點時間看完才發現是弄出了一個類似...
View ArticleValkey 支援 Bloom Filters
先前在「Valkey 對 hash 資料結構的改善」這邊有提到會需要觀察 Valkey 的開發能量,後續就看到「Introducing Bloom Filters for Valkey」這篇了。 Redis 的 Bloom filter 是透過 module 的形式掛進去的:「Bloom filter」,這也是早期溫水煮青蛙的第一步,2018 年時從周邊的 module 換掉本來的 open...
View Article對影片中馬賽克的部分解碼
在 Hacker News 上「It's easier than ever to de-censor videos (jeffgeerling.com)」看到的,原文在「It's easier than ever to de-censor videos」這邊,在講影片中就算用「馬賽克」,但因為每個影格 (frame) 所馬賽克的範圍不同,是有可能反解出來的。 Jeff Geerling...
View Article./configure 支援多 CPU 加速執行的問題
在「Parallel ./configure (tavianator.com)」這邊看到的,原文是「Parallel ./configure」這篇。 I paid good money for my 24 CPU cores, but ./configure can only manage to use 69% of one of them. As a result, this random...
View Article用 flock + timeout 包裝 cron script
避免同時間有太多 cron script 跑 (我的例子裡面是會去 call API,避免同時間太多 API request 打進去),所以用 flock(1) 確保同時間只有一隻在跑,另外用了 -w 在 timeout 時放棄。 不過後來發現 -w 只處理取得 lock 時的 timeout,不負責取得完後的執行時間: Fail (with an exit code of 1) if the...
View ArticleGo 的 Green Tea GC
在 Lobsters 上看到 Go 將會引入 Green Tea GC (需要開 flag):「runtime: green tea garbage collector」。 可以從後面 Prototype evaluation 的地方看到 Green Tea GC 主打在多 CPU 下的最佳化: Overall, the single object scan optimization was...
View ArticleMozilla 把 Firefox 的 code repository 搬到 GitHub 上
在 Hacker News 上有提到這個 repository:「Mozilla Firefox – Official GitHub repo (github.com/mozilla-firefox)」,本來想說這個應該是 mirror (就像 Linux kernel 在 GitHub 上的情況),但留言的地方有 Mozilla 的人在 id=43970574 說明的確是搬上去了: The...
View Article電腦線圈!
在 Hacker News 上看到「Mystical (suberic.net)」這個,原文「Mystical」是發明了一套系統,看起來就像是用魔法陣在寫程式: I wanted to make a programming language that resembled magical circles. This is more like a way to write PostScript that...
View Article非負整數上的 x % d == 0 可以用 x * p
前幾天在 Hacker News 上看到計算閏年的演算法:「A leap year check in three instructions」(via)。 最基礎的演算法是四年一閏、遇百不閏,遇四百閏,文章作者給了基本的演算法: bool is_leap_year(uint32_t y) { if ((y % 4) != 0) return false; if ((y % 100) != 0)...
View ArticleHacker News 的底層換掉了...
在 Hacker News Daily 上看到「Hacker News now runs on top of Common Lisp」這篇,對應的討論在「Hacker News now runs on top of Common Lisp (lisp-journey.gitlab.io)」這邊。 從說法上看起來是把底層換掉了,透過 transcompiler 把 Arc 轉到 Common Lisp...
View Article讓 Flutter 在 Console (CLI) 下可以 auto hot reload (或是 auto hot restart)
IDE 環境 (像是 VSCode) 因為可以知道哪些檔案被改變,所以可以在改變時呼叫 hot reload 或是 hot restart,但我自己用 Neovim 就得自己找方案了。 網路上找 Flutter 的 hot reload 方案會看到 Dart 的 dashmon,不過在我的 Linux 桌機上不會動,看起來是沒抓到檔案變更的事件,但沒仔細往下看了。 我後來找一套方法可以在...
View ArticleReverse geocoding 的簡化
前幾天看到「Mapping latitude and longitude to country, state, or city」這篇,應該是在 Lobsters 看到的... (不是很確定) Reverse geocoding 是指輸入經緯度,反推出在哪個區域 (國家/州/城市): An app can easily check a user's location (with...
View ArticleLet's Encrypt 針對無主用戶端的限制
Let's Encrypt 發表了「How We Reduced the Impact of Zombie Clients」這篇,在講處理 zombie client 的情況。 這邊講的 zombie client 是指自動化過程的產物:Let's Encrypt 推動自動化更新 certificate 的機制,所以大多數都是透過程式更新 (也就是...
View Article產生 [0.0, 1.0) 浮點亂數的方式
好像是前幾天在 Lobsters 上看到的文章:「performance of random floats」,裡面在講產生浮點亂數效能的問題,不過先被吸引到的是「正確性」的問題,作者在 2023 年的時候寫過方法「Random floating point numbers」。 在 IEEE 754 的格式下,float64 (Double-precision floating-point...
View ArticlePHP 的 PSR-12
在翻 PHP 程式的時候突然想到 coding standard 與 coding style 好像有新的規範 (而且有一陣子了),翻「PHP Standards Recommendations」重新熟悉一下。 看起來是在 2019 年的時候推出了 PSR-12,取代了本來的 PSR-2:「New blog, PSR-12 approval and Upgrading PSRs」。...
View ArticleHomomorphic encryption + CRDT 的想法
看到「Homomorphically Encrypting CRDTs」這篇 (via),作者想要在跨機同步時使用 CRDT,並且避免中間同步的 server 看到內容而採用 Homomorphic encryption。 點子本身還蠻有趣的,也把 PoC 實作出來了... 不過最後面在「Fundamental Limitations」這段說明目前的技術上還不可行的原因。 首先是 server...
View ArticleHTML 規格修改了對 attribute 中 escape 的處理
在「HTML spec change: escaping < and > in attributes」這邊看到的,裡面提到了「Escape "<" and ">" when serializing attribute values #6362」這個更改。 本來 HTML spec 的文字是: If the algorithm was invoked in the...
View Article不使用前端 JavaScript 架構架設網頁的方式
前幾天 JavaScript broke the web (and called it progress) (via) 這篇在 Hacker News 上有一些討論。 作者在抱怨現在的前端 JavaScript 框架最主要的目的是 DX (Developer experience),而且會發現代價是犧牲了 UX (User experience),以及帶給 Architecture 與 DevOps...
View ArticleAPScheduler + requests 遇到 OSError: [Errno 24] Too many open files 的問題
前陣子試著在 Python 上面定時跑 crawler 抓一些東西寫進資料庫。 因為是偏實驗性質,選擇用 PyPy (PyPy3) 而非 CPython (就是官方版本的 Python),然後搭著 Gunicorn (跑 Flask) + APScheduler + requests,專案的程式碼可以在 app/app.py 這邊看到。 遇到的問題就像標題提到的,跑個半天到一天後發現 job...
View Articleuvx 與 PEP 723 的組合
最近 Hacker News 上蠻多 uv 相關的條目,看到「Fun with uv and PEP 723」這篇 (via),透過 uvx 與 PEP 723 組出接近 standalone script 的環境。 一般的 Python script 通常都會需要一個環境 (像是 venv) 把相依性套件都裝起來,而相依性一般都是放在另外一個檔案裡面 (像是 requirements.txt 或是...
View Article