- https://github.com/agentzh/lua-redis-parser 先下載安裝
- gem install passenger
- http://nginx.org/en/download.html
- https://github.com/simpl/ngx_devel_kit
- https://github.com/agentzh/set-misc-nginx-module
- https://github.com/agentzh/lua-redis-parser
- https://github.com/agentzh/redis2-nginx-module
- https://github.com/chaoslawful/lua-nginx-module
- http://mdounin.ru/hg/ngx_http_upstream_keepalive/
- 執行下面指令
passenger-install-nginx-module --nginx-source-dir=`pwd`/nginx-1.0.5 \
--extra-configure-flags='--prefix=/opt/nginx \
--with-cc-opt="-Wno-unused-but-set-variable" \
--with-http_ssl_module --with-http_realip_module \
--add-module=../simpl-ngx_devel_kit-bc97eea \
--add-module=../agentzh-set-misc-nginx-module-5c4a47f \
--add-module=../chaoslawful-lua-nginx-module-e06c869 \
--add-module=../agentzh-redis2-nginx-module-6f7fc37 \
--add-module=../ngx_http_upstream_keepalive-c6396fef9295'
其中 --with-cc-opt="-Wno-unused-but-set-variable" 是為了 nginx 1.0.5 跟 gcc 4.6.1 感情不好所需要的額外參數
Monday, July 18, 2011
花了點時間測試 xz, bzip2, gzip rzip 這四種壓縮方式, 測試環境與結果如下
硬體
cpu Intel i5-2400
ram DDR3 16GB
被壓縮的內容
android-sdk-linux_x86
eclipse
jdk1.5.0_22
jdk-1_5_0_22-linux-i586.bin
proguard4.5.1
zxing-read-only
約 2.1 GB
花費的時間
21.16 tar cf android.tgz —use-compress-prog=pigz android
1:18.56 tar cf android.tbz2 —use-compress-prog=pbzip2 android
1:24.60 tar czf android.tgz android
2:58.07 tar cf android.tar.lrz —use-compress-prog=lrzip android
4:28.28 tar cjf android.tbz2 android
12:35.09 tar cJf android.txz android
壓縮後的檔案大小
597192013 android.tar.lrz
1304941558 android.tbz2
1330036813 android.tgz
1103788324 android.txz
結論
lrzip 真是太威了, 雖然花的時間多pgiz一倍, 但是壓縮完後的檔案大小只有其他人的一半呀 以後自己要用的備份都改用 lrzip 來處理好了, 但是如果是趕時間的話, 就用 pgiz 包一包就好了, 至於 xz 就當作沒看過這東西吧, 沒有 multi thread 就是比別人慢很多, 而且壓完只比 gzip 小不到10%
Friday, April 8, 2011
因為外接的 usb dac 走 usb 輸入的時候可以吃到 24Bit/96KHz 的格式
所以就找了一下調整的方法
1.取得音效卡資訊
cat /proc/asound/card1/pcm0p/sub0/hw_param
2.調整音效卡內容
vim /etc/pulse/daemon.conf
resample-method=src-sinc-medium-quality
default-sample-format = s24le
default-sample-rate = 96000
3.重開 pulse
pulseaudio -k
Friday, March 25, 2011
可以把 Rails Model 畫出 ERD 的工具
建議改用下列參數
rake erd polymorphism=true inheritance=true indirect=false
14:23 < tka> 不過覺得 mail-2.2.12/lib/mail/network/delivery_methods/smtp.rb 在 smtp.start 之前應該加個 smtp.set_debug_output $stderr
14:23 < tka> 大概在128行的地方
Friday, December 24, 2010
使用 ruby-growl gem 必須要打開 growl 接收網路通知才可以運作, 但是預設值是不打開的, 若是透過 growlnogify 這個指令呼叫的話, 使用者也有可能沒有安裝, 因此比較方便的方式是自己寫個 applescript 來呼叫 growl
將文章最下面的 growl.applescript 跟 icon.png 放置在同一目錄下面 在用下列 ruby 語法呼叫便可
msg = 'Hello World!'
system('/usr/bin/osascript', "growl.applescript", msg )
growl.applescript內容
on run argv
tell application "GrowlHelperApp"
set the msg to item 1 of argv
set myPath to POSIX path of (path to me as string) -- gets it in "/" form
set ASTID to AppleScript's text item delimiters -- save 'em
set AppleScript's text item delimiters to "/"
set theFolder to (text 1 thru text item -2 of myPath) & "/" as Unicode text
set AppleScript's text item delimiters to ASTID -- restore 'em
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"My.app Notification"}
-- Make a list of the notifications
-- that will be enabled by default.
-- Those not enabled by default can be enabled later
-- in the 'Applications' tab of the growl prefpane.
set the enabledNotificationsList to ¬
{"My.app Notification"}
-- Register our script with growl.
-- You can optionally (as here) set a default icon
-- for this script's notifications.
register as application ¬
"My.app" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Script Editor"
-- Send a Notification...
notify with name ¬
"My.app Notification" title ¬
"My.app" description ¬
msg application name "My.app" ¬
image from location theFolder & "icon.png"
end tell
end run
Sunday, December 19, 2010
過去的作法可以參考 xdite 在 Linux 上架設 Screenshot Service , 但是前兩天發現了 wkhtmltopdf 整體的架設比過去的方法簡單很多, 程式的流程也比較容易控管. 基本的抓圖可以透過下面的 script 達成,其中 montage 是imagemagick的指令, -density 300 改成 600 可以取得更好的畫面品質, 但是需要耗費更多的系統資源
#!/bin/bash
wkhtmltopdf -L 0 -B 0 -R 0 -T 0 $1 tmp.pdf
montage -density 300 -trim tmp.pdf -resize 1024x -mode concatenate -tile 1x $2
# 2011/11/25 更新
目前該專案已經有 khtmltoimage 可直接輸出成 image, 不需要再透過 imagemagick 轉檔了
Saturday, June 12, 2010