Category Archives: Software

換回 Firefox…

Tweet 用 Google Chrome 用一陣子了,回頭來看看 Firefox 發展的如何… 在 Location bar 輸入網址還是鈍鈍的問題還是沒解,不過很明顯感覺速度跟 Chrome 差不多了… 裝了一卡車套件,用一陣子看看吧 :o

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

Google Chrome Extension 內攔截所有的 url request…

Tweet 之前寫了一個處理 Referer header 的 extension,使用 chrome.experimental.webRequest.onBeforeSendHeaders.addListener 攔截所有的 url 然後處理 Referer header。 之前只需要在 manifest.json 裡面加上 experimental 就可以使用,但是前陣子發現失效。剛剛在「onBeforeSendHeaders listeners aren’t triggering」這個 issue 裡面找到解法:現在需要多加上 <all_urls> 這組權限。

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

Ubuntu 11.04 最近一次 kernel 升級後沒聲音…

Tweet 桌機還在用 Ubuntu 11.04,剛剛 apt-get 升級後沒聲音了 (有注意到 kernel 有更新),後來是用「Ubuntu 11.04 – No sound at all」這篇的方法解決: rm -r ~/.pulse ~/.asound* ~/.pulse-cookie sudo rm /etc/asound.conf 重開機後就有聲音了…

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

自己編 rTorrent 與 libTorrent…

Tweet Ubuntu 提供的 rTorrent 比較舊,11.04 上面只有 0.8.6 可以用,11.10 則是 0.8.7。目前最新的 stable 是 0.8.9,有支援 magnet uri… 找了 launchpad 上面有沒有人做,看起來是沒有 :/ 因為不想影響到系統舊版的 libTorrent 與 rTorrent,所以裝在自己的 home directory 下。 先安裝 libTorrent,用 ./configure –prefix=/home/gslin/foo 之後用 make 編完後 make install 就可以了,有缺軟體的部份會跳訊息出來,用 apt-get 補上 -dev 版本後再繼續安裝。 … Continue reading

Posted in Computer, Linux, Murmuring, Network, OS, P2P, Software | Tagged , , | Leave a comment

把 Google Plus 的數字 icon 藏起來…

Tweet 那個紅色的數字 icon 還蠻妨礙工作的,到 userscripts.org 上翻一翻,果然有人有寫過了 (雖然是沒幾天前):「Go Away! Google Plus」。 PS:隨便丟字進去測試的時候,發現 “test” 第五名是 tw.yahoo.com,這是怎麼了…?

Posted in Browser, Computer, Firefox, GoogleChrome, Murmuring, Network, Social, Software | Tagged , , , , , | Leave a comment

gitolite 的 hook…

Tweet 弄了整個週末的 gitolite,總算是把 hook 搞定。 簡單的說,修改完 ~/.gitolite/hooks/common/ 裡的 hook script 後,需要下 gl-setup 指令,這個指令會把現在所有的 git repository 內的 hook script 再 symbolic link 一次。 另外,gitolite 的環境變數可能會影響 git 本身執行 (我是在 git pull -v 更新某個目錄下的 git repository 時失敗),這時可以用 /usr/bin/env -i /usr/local/bin/git 確保 git 執行時不會被環境變數影響… … Continue reading

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

如果要自己寫 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

同時用 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