7

在 command line 下生出全灰的圖片

 2 years ago
source link: https://blog.gslin.org/archives/2021/11/15/10425/%e5%9c%a8-command-line-%e4%b8%8b%e7%94%9f%e5%87%ba%e5%85%a8%e7%81%b0%e7%9a%84%e5%9c%96%e7%89%87/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

在 command line 下生出全灰的圖片

因為需要一張 1920x1080 全灰色的圖片,翻了一下 DuckDuckGo 找到這篇:「Linux create Image pixel by pixel in command line」。

裡面抓重點,主要的想法是 PPM 格式 (可以參考「Netpbm」這個條目),然後找到「PPM Format Specification」這份文件。

主要就是用 P3 模式下去產生檔案:

repeat 2073600 echo '127 127 127' >> grey.ppm

然後開頭的地方修一下,加上 P3、長寬資訊以及最大的值:

P3
1920 1080
255

接著就用 ImageMagick 轉檔:

convert grey.ppm grey.png

然後用 viewer 看一下,確認沒問題就收工了...

Related

Wikimedia Commons 發現的印度異常流量

在 Hacker News Daily 上看到「Investigate unusual media traffic pattern for AsterNovi-belgii-flower-1mb.jpg on Commons」這個,維基百科拿來存放各種多媒體檔案的 Wikimedia Commons 發現有大量的印度流量都打進了 https://upload.wikimedia.org/wikipedia/commons/thumb/1/16/AsterNovi-belgii-flower-1mb.jpg/1280px-AsterNovi-belgii-flower-1mb.jpg 這張圖片,而這佔了 EQSIN (新加坡伺服器的代碼) 中 20% 的流量: 由於 User-Agent 與 Referer 都沒有資訊,可以確認這不是瀏覽器造成的流量,但也因為沒有有用的資訊,變得很難查。 接下來有使用者提到時間點可能跟 TikTok 在印度被 ban 有關,因為在被 ban 後有很多使用者會去找替代的服務,而開發者有可能就直接拿這張圖來當啟動畫面或是背景畫面。 所以他們把熱門的替代服務都看了一輪,也都沒看到這張圖。後來他們猜測有可能是抓了但沒顯示在畫面上,所以開始交叉測試:在開 app 後就去 Hive 掃 HTTP log,然後找到一個 app。 後來為了要確認是不是這個 app,他們架了一組 DNS server 記錄查詢的網域名稱,看看 app 會不會觸發查詢…

February 12, 2021

In "CMS"

用 Canvas Fingerprint 取代部份 Cookie

Canvas Fingerprint 已經很久了,在「The Web never forgets: Persistent tracking mechanisms in the wild」說明了 Canvas Fingerprint 的歷史: Canvas fingerprinting is a type of browser or device fingerprinting technique that was first presented by Mowery and Shacham in 2012. 原始論文可以在「Pixel Perfect: Fingerprinting Canvas in HTML5」這邊看到。原理是利用不同機器對字型 render 不一樣的原理再對產生出來的圖片 hash 後當作 cookie 替代品。 兩個禮拜前突然紅起來是因為被發現廣泛使用在很多服務以及網站上,像是 AddThis…

August 5, 2014

In "Browser"

第五堂:「Command-line Environment」

這個系列是從『MIT 的「The Missing Semester of Your CS Education」』這邊延伸出來的,這邊講的是「Command-line Environment」這篇。 開始聊之前先看一下其他的東西,我注意到這系列文章有簡體中文 (這裡,已經翻完) 與繁體中文 (這裡,還有幾篇還沒翻完) 的版本了,如果讀英文會比較累的人可以參考看看。 這堂講 command line 下的各種事情,感覺起來比起前面硬不少。 首先就先開始講 signal,各家系統的 signal 應該還是有些微差異,可以參考各家的 signal(7) (在 command line 下用 man 7 signal 可以列出來)。 這邊講的 signal 都比較通用,像是 SIGKILL 的殺傷力,SIGTERM 與 SIGQUIT,然後有提到 SIGHUP,但 SIGHUP 的設計慣例是拿來重讀設定檔好像就沒提到了... 接下來就帶過 tmux,只大概講了一下概念 (sessions、windows、panes) 與用法。 然後講 shell 的 alias 對於打造環境的幫助,以及…

September 2, 2020

In "Computer"

a611ee8db44c8d03a20edf0bf5a71d80?s=49&d=identicon&r=gAuthor Gea-Suan LinPosted on November 15, 2021November 15, 2021Categories Computer, Murmuring, SoftwareTags cli, command, convert, format, gray, grey, image, imagemagick, line, netpbm, p3, pixel, ppm

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

Post navigation


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK