法國法院判決 Steam 上的遊戲可以轉賣

Valve 不允許轉賣 Steam 上的遊戲,結果就被告上法院,並且判決違反歐盟法律:「French court rules Steam games must be able to be resold」。

French website Next Inpact reports the Paris Court of First Instance ruled on Tuesday that European Union law allows Steam users to resell their digital games, just like they can any physical product.

看起來 Steam 會上訴,再等幾個月看看...

freeDB 將在明年三月底關閉

Hacker News 上看到的消息,提供 CD 資訊的 freeDB 將在明年三月底關閉:「FreeDB Is Shutting Down (freedb.org)」。

freeDB 的關閉算是一段歷史的終章,實際對使用者的影響應該不算大,一方面是 CD 的銷量逐漸下滑,另外一方面是因為現在的程式大多數會同時支援 freeDB 與 MusicBrainz (如果翻一下歷史的話,會注意到後者本來就是因為 freeDB 的授權結構而另外發展出來的服務)。

現在幾乎都是用串流服務與 YouTube 了...

雲端免費服務的整理

在「free-for.dev」這邊看到的資料,裡面提到了「Free for developers」這個網站。

很多雲端服務都有提供 free tier,有些是一段期間免費,但有些是終身免費。光是用這些終身免費的部份,就能夠弄出不少東西了,只是很多人不知道有這些服務... 這個網站提供的列表則是很清楚的整理出來重點。

然後剛剛才發現 Amazon SES 服務本身每個月有免費的額度的 (頻寬另計):

When you call Amazon SES from an application hosted in Amazon EC2, you can send 62,000 messages per month at no charge. This Free Usage Tier benefit does not expire.

而且列表裡列的豐富度,看起來可以取代掉之前我很喜歡翻的 ToolsOfTheTrade,至少可以當作互補...

許多 VPS 同時宣佈停止營業的消息

前陣子有許多 VPS 同時宣佈停止營業的消息:「20 VPS providers to shut down on Monday, giving customers two days to save their data」。

文章裡面列了 20 個 VPS,而這 20 個在 LowEndBox 上都有出現,我就把搜尋的連結直接整理出來了,想確認的人可以展開來看 XDDD:

話說我之前也中了兩個 (SupremeVPS 與 UMaxHosting),後來就覺得 LowEndBox 上的站台都怪怪的... 結果最近就有人開一個站整理出倒閉表格 XDDD:「LowEndDeadPool」。

開頭也講得很直接,現在 LowEndBox 基本上的貨色基本上都是... XD:

As of December 2019, it is pretty safe to say that all hosts listed at LowEndBox are a scam at best (except for QuadraNet and Virmach).

現在得透過其他方式找...

教你怎麼設計爛 API

看到「API Practices If You Hate Your Customers」這個,在講如果你不想給客戶用 API,或是你被迫要給,你要怎麼設計這些 API XDDD

作者在文章後面有把重點整理成一張表,你也可以先看再拉回去看感興趣的細節部份:

裡面超多奇怪的技巧,像是把文件藏起來不讓 Google 搜的到之類的都出現了 XDDD

然後我發現我在接某個印度公司的 API 的時候滿滿的既視感 XDDD

省頻寬的方法:終極版本...

看到「Three ways to reduce the costs of your HTTP(S) API on AWS」這邊介紹在 AWS 上省頻寬費用的方法,看了只能一直笑 XD

第一個是降低 HTTP response 裡沒有用到的 header,因為每天有五十億個 HTTP request,所以只要省 1byte 就是省下 USD$0.25/day:

Since we would send this five billion times per day, every byte we could shave off would save five gigabytes of outgoing data, for a saving of 25 cents per day per byte removed.

然後調了一些參數後省下 USD$1,500/month:

Sending 109 bytes instead of 333 means saving $56 per day, or a bit over $1,500 per month.

第二個是想辦法在 TLS 這邊下手,一開始其中一個方向是利用 TLS session resumption 降低第二次連線的成本,但他們發現沒有什麼參數可以調整:

One thing that reduces handshake transfer size is TLS session resumption. Basically, when a client connects to the service for the second time, it can ask the server to resume the previous TLS session instead of starting a new one, meaning that it doesn’t have to send the certificate again. By looking at access logs, we found that 11% of requests were using a reused TLS session. However, we have a very diverse set of clients that we don’t have much control over, and we also couldn’t find any settings for the AWS Application Load Balancer for session cache size or similar, so there isn’t really anything we can do to affect this.

所以改成把 idle 時間拉長 (避免重新連線):

That leaves reducing the number of handshakes required by reducing the number of connections that the clients need to establish. The default setting for AWS load balancers is to close idle connections after 60 seconds, but it seems to be beneficial to raise this to 10 minutes. This reduced data transfer costs by an additional 8%.

再來是 AWS 本身發的 SSL certification 太肥,所以他們換成 DigiCert 發的,大幅降低憑證本身的大小,反而省下 USD$200/day:

So given that the clients establish approximately two billion connections per day, we’d expect to save four terabytes of outgoing data every day. The actual savings were closer to three terabytes, but this still reduced data transfer costs for a typical day by almost $200.

這些方法真的是頗有趣的 XDDD

不過這些方法也是在想辦法壓榨降低與 client 之間的傳輸量啦,比起成本來說反而是提昇網路反應速度...

一個超小的 HTTP Server Library

httpserver.h 這個專案是用 C 寫的,就一個 .h 檔,從範例可以看到用法不算太複雜:

#define HTTPSERVER_IMPL
#include "httpserver.h"

#define RESPONSE "Hello, World!"

void handle_request(struct http_request_s* request) {
  struct http_response_s* response = http_response_init();
  http_response_status(response, 200);
  http_response_header(response, "Content-Type", "text/plain");
  http_response_body(response, RESPONSE, sizeof(RESPONSE) - 1);
  http_respond(request, response);
}

int main() {
  struct http_server_s* server = http_server_init(8080, handle_request);
  http_server_listen(server);
}

然後同時支援 epollkqueue。拿來寫小東西還蠻有趣的,不過如果複雜一點的東西還是會考慮其他的框架就是了,畢竟會 blocking 的東西太多了...

cdnjs 轉移到 Cloudflare 負責維護

不確定是 cdnjs 還是 CDNJS,因為官方網站是小寫,但 GitHub 上是大寫...

Anyway,cdnjs 本來由社群維護更新 (實際上是透過 bot 更新,但 bot 本身也需要維護),因為人力時間的因素,轉移給 Cloudflare 負責了:「An Update on CDNJS」。

這次也更新了 cdnjs 的 daily request 數量,可以看到現在大約是每天六十億次:

本來 Cloudflare 是站在贊助頻寬的角色提供服務:

Within Cloudflare’s infrastructure there is a set of machines which are responsible for pulling the latest version of the repo periodically. Those machines then become the origin for cdnjs.cloudflare.com, with Cloudflare’s Global Load Balancer automatically handling failures. Cloudflare’s cache automatically stores copies of many of the projects making it possible for us to deliver them quickly from all 195 of our data centers.

但更新的 bot 本身掛了,而且維護者沒時間修:

Unfortunately approximately thirty days ago one of those bots stopped working, preventing updated projects from appearing in CDNJS. The bot's open-source maintainer was not able to invest the time necessary to keep the bot running. After several weeks we were asked by the community and the CDNJS founders to take over maintenance of the CDNJS repo itself.

所以現在則是 Cloudflare 接手維護了:

This means the Cloudflare engineering team is taking responsibility for keeping the contents of github.com/cdnjs/cdnjs up to date, in addition to ensuring it is correctly served on cdnjs.cloudflare.com.

不過裡面也提到了一個問題,就是現在瀏覽器為了安全性,對於不同的站台會有不同的 cache,本來 cdnjs 的設計目的之一被大幅削弱,現在只剩下省頻寬了:

The future value of CDNJS is now in doubt, as web browsers are beginning to use a separate cache for every website you visit. It is currently used on such a wide swath of the web, however, it is unlikely it will be disappearing any time soon.

改善內嵌 YouTube 影片的載入速度

YouTube 的 embed 會載入大量的元件,所以就有專案把對使用者沒有意義的元件都拔掉:「Lite YouTube Embed」。

從比較可以看出來 Lite YouTube Embed 下載的元件少很多:

當然在功能上有差異,不過基本的功能應該都沒問題...

雖然還是 JavaScript 實做,但可以看到實際的程式碼大概 40 行而已?(註解的行數大約是程式碼的兩倍):「lite-youtube-embed/src/lite-yt-embed.js」。

不過要注意的是,程式碼中用到 ES6 的 class 語法,所以如果要考慮到 IE11,應該是要打包轉換...

Amazon EC2 可以掛多個 Elastic Inference 了

看到 Jeff Barr 的 tweet:

所以是一台 Amazon EC2 的主機可以掛多個 Elastic Inference (GPU) 了,這主要應該還是對現有的使用者有幫助。還沒有使用的應該會往新的 AWS Inferentia 測試?(參考「AWS 開始推自己的 Machine Learning Chip」)