展開所有 GitHub comment 的 Bookmarklet

看到 Eric Meyer 弄了一個可以展開 GitHub comment 的 bookmarklet:「Bookmarklet: Load All GitHub Comments」。

分析他的程式碼,稍微手動排一下,可以看出來邏輯蠻簡單的,就是去找出對應的 button,然後模擬按下去的 event:

javascript:function start() {
  let buttons = document.querySelectorAll('button');
  let loaders = [];
  for (let i = 0; i < buttons.length; i += 1) {
    if (buttons[i].textContent.trim() == 'Load more%E2%80%A6') {
      loaders.push(buttons[i]);
      buttons[i].dispatchEvent(new MouseEvent('click', {
        view: window,
        bubbles: false
      }))
    }
  }
  if (loaders.length > 0) {
    setTimeout(start, 5000)
  }
}
setTimeout(start, 500);
void(20240130);

意外可以看到一些應該是作者以前寫習慣的寫法 (畢竟 Eric Meyer 這個名字二十年前就聽過了?),現在 for 拿來當 iteration 應該會用 of 的語法了,另外是 letconst 的差異...

還好這邊還是用 querySelectorAll(),而不是直接看到 getElementsByTagName(),不然就更有考古感了...

拿「Quadratic time internal base conversions #90716」這個測了一下還行,不過我不是那麼常用到,大概不會掛到 bookmark bar 上面...

作者有提到考慮過寫成 userscript,不過看起來是懶 XD

原來 Disqus 已經被網路廣告公司買走了...

在「Disqus, the dark commenting system」這邊才看到 Disqus 被網路廣告公司買的消息:

Disqus was acquired by an advertising company called Zeta Global in 2017. Obviously, advertising companies do everything to increase their revenue (Ex: the Big G).

引用的報導則是在「Zeta Global acquires commenting service Disqus」這邊可以看到,大約在三年前發生的事情...

基本上已經變成廣告追蹤平台了:

I analyzed the network requests log. Disqus makes HTTP requests to 11 different third-party domains through the browser. All of these websites are trackers/pixels (Even some were detected as malware by my security guard).

而且就算是付費會員也一樣,還是會追蹤:

When you provide a free product, money should come from somewhere. Disqus uses advertising for that. Now, I subscribed to a paid plan trial of Disqus to see if things change or not. No! Even in the paid plans, the same pixels are loaded on the client-side. Looks like there's no way to opt-out from tracking.

後面的推薦可以看看就好,自己架應該還是比較好的選擇... 用「open source comment system」搜有些東西可以參考。

AWS CodeCommit 支援 Pull Request 與聊天功能 XDDD

AWS CodeCommit 算是 AWS 提供的 source code hosting 服務,現在也提供 Pull Request 以及聊天^H^H code review 的功能了:「Using AWS CodeCommit Pull Requests to request code reviews and discuss code」、「AWS CodeCommit Supports Pull Requests」。

AWS CodeCommit now supports pull requests, which provide a mechanism to request code reviews and discuss code with collaborators.

這幾個功能果然是抄來抄去... XD

分析 FCC 對網路中立性的留言,將鄉民與機器人分開來分析

Boing Boing 的立場其實還蠻鮮明的,所以有時候他們的新聞看看就好...

但這篇真的很有趣,把 FCC (美國的聯邦通信委員會) 上兩千兩百萬則對網路中立性的留言拿出來分析,結果發現真人與機器人的差異超明顯 XDDD:「Analysis of 22 million FCC comments show that humans love Net Neutrality and bots really, really hate it」,引用的文章在「Discovering truth through lies on the internet - FCC comments analyzed」這邊。

分析可以發現,真人偏好網路中立,而機器人反對網路中立 XDDD:(其實大家心裡都有底是怎麼玩出來的... 只是這次有機會分析,讓事情更明顯)

Data analysis company Gravwell ingested 22,000,000 comments sent to the FCC's docket on Net Neutrality and posted their preliminary findings, which are that the majority of comments came from bots, and these bots oppose Net Neutrality; of the comments that appear to originate with humans, the vast majority favor Net Neutrality.

文章中列出幾個有趣的現象,像是機器人的 comment 大量重複:

A very small minority of comments are unique -- only 17.4% of the 22,152,276 total. The highest occurrence of a single comment was over 1 million.

甚至是 pornhub.com 的郵件位置 XDDD:

Most comments were submitted in bulk and many come in batches with obviously incorrect information -- over 1,000,000 comments in July claimed to have a pornhub.com email address

然後機器人的 pattern 也很容易辨別:

Bot herders can be observed launching the bots -- there are submissions from people living in the state of "{STATE}" that happen minutes before a large number of comment submissions

這個有點類似「50 Cent Party (五毛黨)」,但是是自動化機器人,而且產出的「品質」不太好 XDDD

肥大的 DISQUS

在「Replacing Disqus with Github Comments」這邊看到作者抱怨 DISQUS 的肥大,然後作者自己寫了一個用 GitHub 當後端的 comment system XDDD

先看沒有 DISQUS 的:

然後把 DISQUS 掛進來 XDDD:(不得不說 uBlock OriginDisconnect 是你的好朋友...)

估算五毛黨所發表的評論數量

Bloomberg 上看到「China Fakes 488 Million Social Media Posts a Year: Study」這篇在討論中國五毛黨在網路上洗言論的數字。原始論文在「How the Chinese Government Fabricates Social Media Posts for Strategic Distraction, not Engaged Argument」這邊。

這篇論文估算大約有 200 萬人產生了 4.88 億的評論:

The Chinese government has long been suspected of hiring as many as 2,000,000 people to surreptitiously insert huge numbers of pseudonymous and other deceptivewritings into the stream of real social media posts,

We estimate that the government fabricates and posts about 488 million social media comments a year.

這個估算頗有趣的... XD

GitHub 加上 +1 與 -1 功能 (順便加上表情符號)

這是回應之前社群對 GitHub 的請願 (or 抱怨?) 而生的新功能,(參考先前的文章「GitHub 對 Open Source Community 請願的回應」):「Add Reactions to Pull Requests, Issues, and Comments」。

這避免了在討論時大量的 +1 與導致混亂的情況。

減少「註解長度」增加 Node.js 效率...

在「#NodeJS : A quick optimization advice」這邊看到這樣的效能改善方法... 兩段程式碼,只差在註解:

效能差了 50%:

只是因為註解的長度有差,只要用 --max-inlined-source-size 調整就可以避開了:

超苦超無奈:

So when you have a function or callback that’ll be called repeatedly, try to make it under 600 characters (or your tweaked value), you’ll have a quick win !

把舊站的 comment 關掉...

這幾天 blog 常常出現 504,連到機器上發現 MySQL 很忙,才發現是舊站 spam 的量太大的問題造成的,把舊站的 comment 關掉後就好不少,現在看機器的 CPU loading 應該是正常多了。

新站已經是用 DISQUS 所以比較沒有 comment spam 的問題。舊站那邊除了關掉 comment 外,另外直接進 MySQL 把 2006 年之後的 comment 都丟到 pending 裡面去。(因為 2005 年 8 月後就沒更新舊站了)

來研究看看要怎麼把舊的 comment 丟進 Akismet...

Update:發現只要按下 Check for Spam 的按鈕就會把目前 Pending comments 都丟去 Akismet 掃,先丟著 :p