拔掉 Android 上面無意義的軟體:Universal Android Debloater GUI

HN 上看到「Debloat non-rooted Android devices (github.com/universal-debloater-alliance)」這個討論,原網頁是 GitHub 專案 Universal Android Debloater GUI 這個。

說明的地方還蠻清楚的,透過 ADB 在不需要 root 的情況下試著把垃圾軟體清掉:

Cross-platform GUI written in Rust using ADB to debloat non-rooted android devices. Improve your privacy, the security and battery life of your device.

專案看起來跑一段時間了,從 releases 頁這邊可以直接下載 binary 執行。

FAQ 頁裡面的「What are the ADB commands used by UAD?」也有列出用到的指令,如果不想用這套軟體的話也可以自己下指令移除。

首頁上有列出支援的廠牌,看起來還不少,拿找個時間清一下手上的 Android 手機...

美國的撥接服務:2600.network

Hacker News 上偶而會出現這種懷古的東西:「2600.network Dialup Service (2600.network)」,原始網站在「2600.network [idle]」這邊,電話號碼在「2600.network - Numbers」這邊。

我試著拿 iPhone 直接打美西的號碼 (加上 +1),前幾秒鐘還可以聽到 modem 的 handshake 聲音,但馬上就被掛掉了,不知道是什麼原因...

台灣好像已經沒有撥接服務了,剛好前幾天有想到找過... 是個懷古的東西。

回顧 Let's Encrypt 將在六月停止 cross-signed chain 的消息

因為收到 Cloudflare 的信,關於 Let's Encrypt 的 cross-signed chain 將在今年九月底過期的計畫,Cloudflare 這邊也有一些配合的措施會進行:

Let’s Encrypt announced that the cross-signed chain is set to expire on September 30th, 2024. As a result, Cloudflare will stop issuing certificates from the cross-signed CA chain on May 15th, 2024.

去年七月的時候 Let's Encrypt 拿的是去年五月底的資料說明 (2023/05/31),這邊會看 Android 7.1+ 的佔比,當時到了 93.9%。

會看 Android 7.1 是因為從這個版本開始預設就有內建 ISRG Root X1,而不需要 IdenTrust 的 cross-sign chain 了:

剛剛開了 Android Studio 來看,最近一次更新 Android 市占率的資料是去年十月初 (2023/10/01),到 95.0% 了:

也許到九月底的時候有 97%+ 甚至 98%+ coverage,但 Android 的基數還是太大,就算到 98%+ coverage,預期到時候的影響應該還是不小,會不會再簽一年...?

Java 21 的 ZGC 在 Netflix 的效果

Hacker News 上看到連結「Bending pause times to your will with Generational ZGC (netflixtechblog.com)」,發現這篇還沒整理:「Bending pause times to your will with Generational ZGC」,裡面講的東西都有圖有數字 (i.e. Y 軸),作者是 Danny Thomas

在這之前他們就已經知道 GC pause 是延遲的重要來源,會導致 timeout & retry:

In both our GRPC and DGS Framework services, GC pauses are a significant source of tail latencies.

That’s particularly true of our GRPC clients and servers, where request cancellations due to timeouts interact with reliability features such as retries, hedging and fallbacks.

第一張圖拉出來的資料是 error rate,白色是上個禮拜的資料,紫色是這個禮拜的資料,而從 G1GC 切到 ZGC 是在 2023/11/16 發生的:

可以看到很明顯的 error rate 改變:尖峰從 2k 下降到大約 0.3k,大約是原來的 1/6 到 1/7 的下降。

第二張圖是 GC 的時間:

可以看到 G1GC 還是偶而會撞到 2 秒,發生時平均值也都還是會 >100ms,切到 ZGC 後直接降到個位數 ms 等級了。

第三張圖是 memory overhead 的部分:

從圖上可以看到上週與本週的對比,導入 ZGC 後記憶體的使用量下降了,不過文裡面倒是沒解釋這點,反而提到 ZGC 比起 G1GC 有個固定的 3% overhead:

ZGC has a fixed overhead 3% of the heap size, requiring more native memory than G1. Except in a couple of cases, there’s been no need to lower the maximum heap size to allow for more headroom, and those were services with greater than average native memory needs.

第四張則是 Huge Pages 的差異,這邊要注意這張圖的 Y 軸不是從 0 計算:

可以看到在開 Huge Pages 後,在 RPS (request per second) 不變的情況下 CPU 使用率是有下降的,大約從 50% 降到 45% 左右,不過這張圖的時間跨度有點少,應該是要拉長一點的圖... 不過既然被提出來了,就假設 Netflix 內看起來應該是有這個趨勢,只是抓圖的時候懶了點?

整體算是大成功?

syllazh:拿同音字硬顯示到 Linux TTY 的 console 上面

翻資料的時候翻到用 Python 寫的 syllazh 這個東西,可以在 Linux TTY console 上面直接顯示中文,我本來以為是類似 big5con 的東西,看了一下完全不是,syllazh 是直接透過 Linux TTY 搞,所以會受限於 512 字的限制,而 big5con 是切進圖形模式自己處理,所以可以完整顯示 big5 上面的字:

Linux TTY 上的字体可以由一般位于kbd软件包里的setfont工具更换。它最多支持512个字形(glyph),但每个字形可以被映射到多个 Unicode 码位。 所以为了支持显示中文,我必须把成千上万个汉字挤进这个狭小的空间。 幸运的是,现代汉语普通话大约只有400个不同的音节(忽略声调)。于是我针对每个音节,挑选了一个最常用的汉字来代表那最多上百个读音近似的汉字。 这样再加上96个可见的ASCII字符和几个符号,它们就正好装进512字符的限制内了!

然後這邊因為不可能將所有的中文字都塞進去,syllazh 的作法就是找同音字塞,效果就會變成這樣:

這主要還是好玩為主,作者自己也有提到這點:

老实讲,盯着这些同音错字并通过句子来费劲猜测它是什么意思,并不是很愉快的体验。因此我也不期待任何人日常使用它。 现在都2024年了,你应该去用你喜欢的 Wayland 或 X 桌面,而不是TTY。所有主要的图形界面库对中文(以及所有其他语言)的支持都比我这奇技淫巧高到不知哪里去了。

Web Audio API 當做 fingerprint 的方式

三年前的文章「How the Web Audio API is used for audio fingerprinting」講解了 AudioContext 是怎麼被拿來 fingerprint 的,最近在「How We Bypassed Safari 17's Advanced Audio Fingerprinting Protection」這篇看到的。

AudioContext 可以完全跟錄音設備無關,單純計算,然後因為不同瀏覽器實作上面有差異,就被拿來當作 fingerprint 了。

文章裡介紹的方法是透過 Oscillator 產生 440Hz 的正弦波,然後過 Compressor 降低音量 (運算):

The Web Audio API provides a DynamicsCompressorNode, which lowers the volume of the loudest parts of the signal and helps prevent distortion or clipping.

降低音量的運算再這塊各家的實作不同,就能夠區分不同的瀏覽器 (甚至是版本):

Historically, all major browser engines (Blink, WebKit, and Gecko) based their Web Audio API implementations on code originally developed by Google in 2011 and 2012 for the WebKit project.

Since then browser developers have made a lot of small changes. These changes, compounded by the large number of mathematical operations involved, lead to fingerprinting differences. Audio signal processing uses floating point arithmetic, which also contributes to discrepancies in calculations.

Additionally, browsers use different implementations for different CPU architectures and OSes to leverage features like SIMD. For example, Chrome uses a separate fast Fourier transform implementation on macOS (producing a different oscillator signal) and other vector operation implementations on different CPU architectures (used in the DynamicsCompressor implementation). These platform-specific changes also contribute to differences in the final audio fingerprint.

而這東西平常也不會用到,所以對 Tor Browser 這種特別重視 privacy 的瀏覽器就直接關掉他了:

Tor

In the case of the Tor browser, everything is simple. But unfortunately, web Audio API is disabled there, so audio fingerprinting is impossible.

用 Ollama 加上 ollama-ui (Chrome extension) 測試

ChatGPT 類的應用我最常還是拿來跑翻譯,有些東西不希望透過雲端去翻,試著找本機的方案跑看看。

因為桌機是 Linux 系統,目前比較成熟的方案看起來是 Ollama,可以在本地端跑起來並且開一個 HTTP API 讓其他程式呼叫。

我的作法是寫 systemd 設定,但是不要開機就跑起來,需要的時候再跑 sudo service ollama start 再使用就好,只是要注意第一次跑會需要從 NVMe disk 裡面讀 model,會比較慢一點,後續就正常了...

另外找了一下 GUI,看起來 ollama-ui 算是還 OK,兩個搭起來後拿 mistral-openorca 這組 7B model 跑翻譯,這邊是拿 NHK 網站上面的「政党支持率 自民下落20%台に 立民 維新も伸びず NHK世論調査」這篇翻,看起來還可以:

不過 7b 的幾個 model 測了一下都不到 GPT-3.5 的程度,要多跑幾次才會出現堪用的 (像上面那樣),之後再多測看看其他的 model...

用 Samba 讓 virt-manager 內的 Windows 存取資料

續著「從 VirtualBox 換到 virt-manager」這篇,當時其他的問題都解的差不多了,但用 VirtualBox 時可以很方便的分享目錄,然後用 \\vboxsrv\directory 存取到 host 的資料,在 virt-manager 就沒辦法這樣弄了。

網路上比較多人提到的是 SPICE 提供的 WebDAV 方式存取,但怎麼弄都弄不起來,最後決定直接在 host 上面跑 Samba,這樣 guest OS 內也不用裝軟體了...

雖然中間有遇到新版 Windows 會在 client 端擋 guest access,用 gpedit 改一下就可以用了,這邊把摸索出來的 Samba 設定放在我自己的 wiki 上面:「Samba」。

這樣算是把 virt-manager 的最後一塊拼圖補上了...

Nvidia CUDA 的 EULA 禁止跑在模擬層上面

Hacker News 上看到「Nvidia bans using translation layers for CUDA software to run on other chips (tomshardware.com)」這個討論串,原報導「Nvidia bans using translation layers for CUDA software — previously the prohibition was only listed in the online EULA, now included in installed files」。

文章最上面更新的這段把重點講完了,在 11.6 之後的版本就有加入這段文字了:

[Edit 3/4/24 11:30am PT: Clarified article to reflect that this clause is available on the online listing of Nvidia's EULA, but has not been in the EULA text file included in the downloaded software. The warning text was added to 11.6 and newer versions of the installed CUDA documentation.]

主要是這條:

You may not reverse engineer, decompile or disassemble any portion of the output generated using SDK elements for the purpose of translating such output artifacts to target a non-NVIDIA platform.

從「CUDA Toolkit Archive」這邊可以看到 11.6.0 是 2022 年一月的事情:

CUDA Toolkit 11.6.0 (January 2022), Versioned Online Documentation

看起來跟 ZLUDA 有關 (參考「IntelAMD GPU 直接跑 CUDA 程式的 ZLUDA」)。

時間軸看起來有對起來,2021 年的時候被 Intel 找去聊,2022 年的時候改跟 AMD 簽約,然後 AMD 後來也放掉:

In 2021 I was contacted by Intel about the development of ZLUDA. I was an Intel employee at the time. While we were building a case for ZLUDA internally, I was asked for a far-reaching discretion: not to advertise the fact that Intel was evaluating ZLUDA and definitely not to make any commits to the public ZLUDA repo. After some deliberation, Intel decided that there is no business case for running CUDA applications on Intel GPUs.

Shortly thereafter I got in contact with AMD and in early 2022 I have left Intel and signed a ZLUDA development contract with AMD. Once again I was asked for a far-reaching discretion: not to advertise the fact that AMD is evaluating ZLUDA and definitely not to make any commits to the public ZLUDA repo. After two years of development and some deliberation, AMD decided that there is no business case for running CUDA applications on AMD GPUs.

Cloudflare Zaraz 的新價錢

Cloudflare Zaraz 有點像是 GA4Mixpanel 或是 Amplitude 這種產品:

Cloudflare Zaraz is a solution that developers and marketers use to load third-party tools like Google Analytics 4, Facebook CAPI, TikTok, and others.

剛剛看到 Cloudflare Zaraz 的宣佈的新價錢:「Zaraz launches new pricing」,翻資料的時候發現去年七月的時候也有宣佈過價錢,但當時看起來反彈頗大而暫緩:「Cloudflare Zaraz steps up: general availability and new pricing」。

先看一下去年七月當時宣佈的價錢,這邊用了 Zaraz Loads 這個特別的 term:

If you exceed the free Zaraz Loads allocations, you'll be charged $0.50 for every additional 1,000 Zaraz Loads, but the service will continue to function.

看起來 Zaraz Load 包括了 script loading 以及 pageview event 都各算一次:

A Zaraz Load is counted each time a web page loads the Zaraz script within it, and/or the Pageview trigger is being activated.

這樣的話 1M event 就要 US$500,隔壁棚 Mixpanel 可以在「Pricing - Mixpanel | Product Analytics」這邊試拉,同樣 1M event 只要 $140,難怪當時被幹剿到不行...

這次公佈的價錢則是又用了新的 term,叫做 Zaraz Events,這個看起來就是一般理解的 event:

One of the biggest changes we made was changing the metric we used for pricing Zaraz. One Zaraz Event is an event you’re sending to Zaraz, whether that’s a pageview, a zaraz.track event, or similar.

而價錢直接下殺到 1M event 收 US$5,跟之前的差異巨大:

With the new Zaraz pricing model, every Cloudflare account gets 1,000,000 Zaraz Events per month for free. If your account needs more than that, every additional 1,000,000 Zaraz Events are only $5 USD, with volume discounting available for Enterprise accounts.

只是不知道 Zaraz 可以做到什麼程度,「理論上」會比較陽春,但不知道夠不夠用?