XFCE (Xubuntu) 下的手動 lock + screensaver + DPMS 組合

桌機換成 Xubuntu 22.04 後會遇到手動鎖定螢幕時,螢幕不會進入省電模式,遇到的情況有點像是「DPMS Suspend on Screen Lock」這邊提到的情境。

這類問題如果用 search engine 一時間沒有找到解法的話,最好的方法都是直接去讀 source code,然後就發現透過 Ctrl+Alt+L 觸發的 /usr/bin/xflock4 其實是個 shell script,從 code 讀可以發現裡面只負責 lock 的部分,本來就跟 DPMS 無關。

我在下面提供的方案就是自己處理螢幕的部分,也就是自己先跑 DPMS 指令,然後再回頭呼叫 /usr/bin/xflock4

#!/bin/sh
/usr/bin/xset dpms force off
exec /usr/bin/xflock4

Ctrl+Alt+L 的觸發程式掛上來,這樣就會正常處理了...

把電子墨水螢幕透過 VNC 當作外接螢幕

上個禮拜在 Hacker News 上看到的專案,把電子書閱讀器拿來當作外接螢幕:「eInk VNC for Kobo e-readers」,對應的討論在「Show HN: A VNC viewer for eInk devices capable of 30 FPS when writing text (zmarshall.nl)」這邊。

作者提供的 screenshot 看起來效果還不錯:

source code 在 GitHub 上的 everydayanchovies/eink-vnc,看起來算是實驗性質,在 warning 的段落可以看到:

The screen can refresh up to 30 times per second, this will degrade the eInk display rapidly. Do not use with fast changing content like videos.

Furthermore, this tool was only tested on a single device (Kobo Libra 2). It is possible that it will damage yours. I cannot be held responsible, use this tool at your own risk.

Hacker News 上有看到一個有趣的專案 The Modos Paper Laptop,是一台用電子紙的筆電:

不過好像還在開發階段...

用 GitHub Actions 做的監控服務 Upptime

是在 Twitter 上看到這個:

然後翻到 Upptime 這個 open source monitoring 工具,直接是用 GitHub Actions 提供的 schedule (cron job) 每五分鐘跑一次。這邊要注意的是,如果是 public repository 的話不受限制,如果是 private repository 的話會有機會把 quota 吃完:

Billing note: Upptime uses thousands of build minutes every month (approximately 3,000 minutes in the default setting). If you use a public repository, GitHub offers unlimited free build minutes, but if you use a private repository, you'll have to pay for this time.

依照說明是用 GitHub Actions、GitHub IssuesGitHub Pages 三個功能在運作:

  • GitHub Actions is used as an uptime monitor
  • GitHub Issues are used for incident reports
  • GitHub Pages are used for the status website

除了用這三個功能外,另外還是會每天塞一些資料回 git history 裡面:

We also record the response time once per day and commit it to git history. This way, we can graph long-term trends in your websites' response times by going through git commit history. We generate these graphs once every day, also using schedulers.

好像可以玩看看...

電子紙的螢幕 BOOX Mira Series

看到「BOOX Mira Series」這個,主要是因為現在公司的老闆是電子墨水的發明人之一 (也是 E Ink 的 cofounder),所以看到一些電子墨水的新聞也會覺得有趣...

比較小的 BOOX Mira 是 13.3" 的 4:3 螢幕,但 resolution 也已經拉到 2200x1650 了,207 ppi,走 Mini HDMI 或是 Type C 輸入,賣 US$799,從圖片上看起來像是攜帶性的。

而比較大的 BOOX Mira Pro 則是 25.3" 的 16:9 螢幕 (3200x1800),145 ppi,可以走 HDMI/Mini HDMI/DP 或是 Type C,價錢則是 US$1799,從圖片上看起來是放在桌面上的。

因為電子紙的特性,畫面的更新速度不像傳統螢幕那樣,要想一下使用的情境...

在非 4K 的螢幕上跑 HiDPI

前幾天看到 BetterDummy 這個專案,作者在 M1 上面外接 24" 1440p 的螢幕,但沒辦法啟用 HiDPI,於是就寫了一個軟體來解:

M1 macs tend to have issues with custom resolutions. Notoriously they don't allow sub-4K resolution displays to have HiDPI ("Retina") resolutions even though (for example) a 24" QHD 1440p display would greatly benefit from having an 1920x1080 HiDPI "Retina" mode.

在這之前的解法都有些麻煩,一種是買個 dummy dongle 去騙 macOS,另外是用 mirror 的方式使用:

To fix this issue, some resort to buying a 4K HDMI dummy dongle to fool macOS into thinking that a 4K display is connected and then mirror the contents of this dummy display to their actual monitor in order to have HiDPI resolutions available. Others use the built in screens of their MacBooks to mirror to the external display. These approaches have obvious drawbacks and cannot solve all problems.

作者提供的軟體可以先建立 Dummy Monitor,然後再透過 mirror 掛到實際螢幕上:

不確定用起來如何,但如果之後有需要的話好像可以測試看看...

4px 寬的字型

也是在 Hacker News Daily 上看到的:「a pretty sweet 4px wide pixel font.」,看 commit log 似乎很久了,字本身長這樣:

作者有提到可以用在解析度不夠的螢幕上,馬上想到的是「Waveshare 3.2 inch Raspberry Pi LCD 320X240 Resistive Touch Screen TFT Display SPI LCD for Raspberry Pi 3 Model B/3B+/2 B/B/A Raspbian IMG Provided」這種東西:

另外用在小顆 LCD 單色顯示似乎也是個方法,不過看了一下是 5px:

出自「Real Time Clock On 20x4 I2C LCD Display with Arduino - Electronics-Lab.com」。

先記起來...

AWS 區域間的連線測試

Hacker News 首頁上看到「AWS Latency Monitoring」這個,看起來是常態性在所有的機房都開機器一直測試蒐集資料,就可以直接拉出來看...

有常見的 p50 與 p99 資訊,對於在規劃架構的時候還蠻有用,在「mda590/cloudping.co」這邊可以看到他是用 LambdaDynamoDB 的 endpoint 測試。

好像沒有 packet loss rate 的資訊,這個也蠻重要的...

超高 PPI 的螢幕

看到「DPI Calculator / PPI Calculator」這個網站,裡面有一些有趣的小螢幕,但是有超高解析度:

1280x1024 @ 0.61 MicroOLED microdisplay (2687.21 PPI)
1920x1080 @ 0.74 Silicon Micro Display ST1080 (2976.9 PPI)
2048x1536 @ 0.83 Forth Dimension QXGA-R9 (3084.34 PPI)
2048x2048 @ 0.99 Kopin Lightning 2K (2925.57 PPI)

不過如果放寬到只要是螢幕就可以的話 (不用是彩色的),查了一下發現跟目前的進展有點遠,目前有查到的是 14000 DPI:「14,000ppi MicroLED display is world’s densest, only 0.48mm across」:

According Mojo Vision, with a world record pixel pitch of 1.8µm and a pixel density over 14,000ppi, the monochrome display technology is the company’s first important step in succeeding in its mission to deliver “Invisible Computing”, enabling people to receive and share information that is immediate and relevant without distracting them from the world in front of them.

不過考慮到彩色螢幕需要三色,上面那幾個 3000 PPI 好像已經很厲害了...

AWS 在上個月推出的 CloudWatch Synthetics

AWS 在上個月推出的新功能,在 tab 上放的有點久:「New – Use CloudWatch Synthetics to Monitor Sites, API Endpoints, Web Workflows, and More」。

算是監控網站的服務,但不只是有沒有活著,而是包括整個網站 loading 的狀態。因為連 HAR 格式都支援了,所以可以抓很多特殊的時間點,從 screenshot 可以看出來:

價錢不算便宜,畢竟是要需要用瀏覽器抓出所有情境。如果以五分鐘跑一次來算,一個月就要 USD$10.3 左右的服務費用,另外還要加上 S3Lambda 的成本 (不過這兩個服務的費用應該就只是零頭了):

Pricing – As part of the AWS Free Tier you get 100 canary runs per month at no charge. After that, you pay per run, with prices starting at $0.0012 per run, plus the usual charges for S3 storage and Lambda invocations.

不過我記得類似的服務大概也都是這個等級的價錢,如果量夠大的話,我記得 HAR 的輸出有 open source solution 可以自己弄 EC2 instance 裝起來,應該會划算不少...

家裡電腦裝 Ubuntu 18.04

上個禮拜四家裡的桌機開不了機,找了一天發現是系統的 SSD 掛掉了,就買了張 M.2 SSD,然後計畫順便把本來的 Ubuntu 16.04 升級到 Ubuntu 18.04,但 Ubuntu 18.04 把預設的界面從 Unity 換成 GNOME (然後披上 Unity 的皮),加上前陣子系統從 Intel 平台換到 AMD,整個狀況變得超混亂之後,就變成一連串踩地雷的過程...

最一開始是 UEFI + LUKS 的安裝問題,本來想裝到 M.2 SSD 上面,但 Ubuntu 18.04 的 grub-install 就是硬寫到 /dev/sda 不能改:「“Unable to install GRUB in /dev/sda” when installing GRUB」,照著這篇的 workaround 用還是不行,最後放棄,直接生一顆 SATA SSD 接到 SATA Port 1,把 M.2 當作資料碟。

硬體相關的問題:

軟體相關的問題:

  • 目前不支援從 GUI 設定 PPPoE 的網路 (沃槽),幾種方式裡面我推薦用 pppoeconf 設定會比較好,然後可以改 /etc/ppp/options 加上 IPv6 的設定。
  • 本來想裝 gnome-shell-extension-system-monitor 觀察系統狀態,但會造成系統超級卡,關掉後就變成普通的卡 (後來就找到 Intel I211-AT 的那個問題了)。

現在至少是堪用的程度了,接下來就是不斷的補各種設定...