Author Archives: Gea-Suan Lin

如果要自己寫 TOTP 的幾個要看的東西…

Tweet 整理下來: HOTP: An HMAC-Based One-Time Password Algorithm TOTP: Time-Based One-Time Password Algorithm KeyUriFormat – google-authenticator – The format of URIs containing encoded keys – Two-step verification – Google Project Hosting 有玩過 HMAC 的人,讀這些文件應該不難… TOTP 在預設的情況下,其實就是 HMAC-SHA-1 後取後面 32bits,然後轉成數字取 100000 … Continue reading

Posted in Computer, Murmuring, Network, Programming, Security, Software | Tagged , , , , , , , | Leave a comment

PHP 提供的資料結構…

Tweet 從「How big are PHP arrays (and values) really? (Hint: BIG!)」這篇看到的。文章本身值得花些時間看過了解,不過對我來說重點在最後面的 SplFixedArray。 PHP 的 Datastructures 說明目前 PHP SPL 所支援的 data structure,在記憶體用量以及效率上面都會比自己實作來的小且快。 可以看到很多都支援 Countable、Iterator,以及 ArrayAccess,代表可以用 foreach() 或是對應的方式存取… 如果自己寫 library 的時候應該要善用這些 SPL。

Posted in Computer, Murmuring, Programming, Software | Tagged , , , , | Leave a comment

YouTube (Google) 允許環球唱片 (Universal Music Group,UMG) 直接移除非 UMG 所擁有版權的影片

Tweet 依照環球唱片 (Universal Music Group,UMG) 提供給法院的文件中,YouTube (也就是 Google) 允許 UMG 透過 YouTube 的 CMS (Content Management System) 移除「不屬於 UMG 的影片」:「Google Deal Allegedly Lets UMG Wipe YouTube Videos It Doesn’t Own」,文件 (PDF) 在:「gov.uscourts.cand.248875.14.0.pdf」這邊可以下載取得。 重點在於這份文件中第四頁的這段: The UMG-YouTube agreement grants UMG rights to … Continue reading

Posted in Computer, Movie, Murmuring, Network, Recreation, Television, WWW | Tagged , , , , , , , | Leave a comment

同時用 mod_deflate 與 mod_fastcgi 所產生的問題…

Tweet 今天花了不少時間找到的問題… 問題是使用 mod_fastcgi 以及 mod_deflate 時,Content-Encoding 會是 gzip,但 Content-Length 會是未壓縮的長度。 也就是說,伺服器端在 header 提供的 Content-Length 可能寫 8KB,但實際上只丟出 2KB (壓縮後的大小),於是瀏覽器讀完這 2KB 後會停下來一直等,等到 Keep-Alive timeout 斷線 (在我機器上預設是 5 秒)。 在 timeout 斷線後 browser 會就抓到的資料直接解開執行 (因為這 2KB 都有抓到,於是都正確執行)。如果用瀏覽器這邊的 debugger 觀察,就會發現從 first byte 後 … Continue reading

Posted in Computer, Murmuring, Network, Software, WWW | Tagged , , , , , , , | Leave a comment

Squid 3.1 的 forward proxy 設定…

Tweet 因為打算給 portsnap 用,所以得用 Squid 3.1 架 forward proxy,可以避免大量對外抓同樣的資料… 由於是內部的機器,不需要擋 acl,設定起來超簡單… ports 裝完 www/squid31 後,把 squid.conf 寫成: # http_access allow all # access_log /home/squid/logs/access.log squid cache_dir aufs /home/squid/cache1 1024 16 16 cache_effective_group squid cache_effective_user squid cache_log /home/squid/logs/cache.log cache_mem 256 MB … Continue reading

Posted in Computer, Murmuring, Network, Software, WWW | Tagged , , | 2 Comments

BSD make 與 GNU make 的 Makefile…

Tweet 前陣子看到 fcamel 丟出來的舊文章:「Debugging make」,花了一些時間看裡面關於 BSD make 與 GNU make 的相同處,之後寫 Makefile 的時候應該會相當有幫助。 目前的目標是 FreeBSD 與 Ubuntu,文章裡面有提到三個變數在兩個平台是通用的,分別是 $

Posted in Computer, Murmuring, Programming, Software | Tagged , , , | 1 Comment

把 Ubuntu 11.10 的 Alt-Tab 行為改掉…

Tweet 參考「Revert Alt-tab behavior changed in 11.10」這篇提到的方法改。 Ubuntu 11.10 的 Alt-Tab 切換視窗的行為與 11.04 不同,會遇到切換兩次是不會切回原來視窗的情況。 我遇到的情況是 Google Chrome 除了 browser 本身以外,還開了一個 Tasky for Google Tasks,於是在系統裡面就會有兩個視窗。當我現在 focus 在 browser window,用 Alt-Tab 切到 terminal 後,再用 Alt-Tab 切回來,focus 變成在 Tasky 上面… 這讓人相當困擾 :o 依照上面那篇文章所提到的方法改系統設定就回到原來 … Continue reading

Posted in Computer, Linux, Murmuring, OS, Software | Tagged , , , | 1 Comment

GitHub 買下 Ordered List…

Tweet GitHub 買 Ordered List,兩邊都有新聞稿: Ordered List Acquired by GitHub Ordered List is a GitHubber Ordered List 的產品質感一直都很不錯,最近比較有名的產品就是 Speaker Deck,像是 othree 講 Base2 這篇,embed 起來的效果:

Posted in Computer, Murmuring | Tagged , , | Leave a comment

Firefox 11 將會支援 SPDY Protocol

Tweet Firefox 預定在 11 (現在是 8) 支援 SPDY Protocol:「(SPDY) Implement SPDY protocol」,除了 Google Chrome 自家瀏覽器支援外,總算有個大的也要支援了… 所以現在除了 Chrome、Kindle Fire 以外,又多了 Firefox 支援… 不過 Apache 與 F5 什麼時候會支援呢… mod-spdy 看起來… 呃…

Posted in Browser, Computer, Firefox, Murmuring, Network, Security, Software, WWW | Tagged , , , , , , , , | Leave a comment

重新啟動 Mac 的藍牙…

Tweet 家裡的 Mac Mini 與 Magic Mouse 中間透過藍牙連接,但有時候會斷掉… 剛開始是接隻 Apple Mouse 重開藍牙,後來覺得太麻煩了,還是要找可以用鍵盤搞定的方法:「blueutil » Command-Line Control of Bluetooth on the Mac」,裝好後用 blueutil off; blueutil on 就可以重新打開藍牙…

Posted in Computer, Hardware, MacOS, Murmuring, OS, Software | Tagged , , , , | Leave a comment