gconftool-2 -t string -s /desktop/gnome/url-handlers/magnet/command "wine '/home/fukid/.wine/drive_c/Program Files/uTorrent/uTorrent.exe' %s"
gconftool-2 -s /desktop/gnome/url-handlers/magnet/needs_terminal false -t bool
gconftool-2 -t bool -s /desktop/gnome/url-handlers/magnet/enabled true
記得要改自己的utorrent位置呀
The computer thing
Entropy > 0 ; Enthalpy <0
2011年1月12日星期三
2010年12月8日星期三
總結 eeepc t91 安裝gma 500 與touch screen 所需的code
安裝gma 500 driver:
sudo add-apt-repository ppa:gma500/ppa && sudo apt-get update
sudo apt-get install poulsbo-driver-2d poulsbo-driver-3d poulsbo-config
修正 touch screen:
xinput list
找出IDEACOM IDC 6680 的id
sudo gedit /etc/X11/Xsession.d/98x11-common_touchscreen
xinput set-int-prop 8 "Evdev Axis Calibration" 32 300 7900 400 7800
把8改為你找到的id
sudo add-apt-repository ppa:gma500/ppa && sudo apt-get update
sudo apt-get install poulsbo-driver-2d poulsbo-driver-3d poulsbo-config
修正 touch screen:
xinput list
找出IDEACOM IDC 6680 的id
sudo gedit /etc/X11/Xsession.d/98x11-common_touchscreen
xinput set-int-prop 8 "Evdev Axis Calibration" 32 300 7900 400 7800
把8改為你找到的id
2010年10月2日星期六
optimize jquery selector
var items = '
var list = $('#list');
list.html(items);
console.time('direct');
for (i=0; i<10000; i++) {
var s = $('.item');
}
console.timeEnd('direct');
console.time('Specific tag');
for (i=0; i<10000; i++) {
var s = $('li.item');
}
console.timeEnd('Specific tag');
console.time('Specific class');
for (i=0; i<10000; i++) {
var s = $('.item.anotherClass');
}
console.timeEnd('Specific class');
console.time('Specific another class');
for (i=0; i<10000; i++) {
var s = $('li.item.anotherClass');
}
console.timeEnd('Specific another class');
console.time('with ancestor');
for (i=0; i<10000; i++) {
var s = $('#ulId .item');
}
console.timeEnd('with ancestor');
console.time('with context');
for (i=0; i<10000; i++) {
var s = $('.item','#ulId');
}
console.timeEnd('with context');
console.time('specific tag with context');
for (i=0; i<10000; i++) {
var s = $('.item','#ulId');
}
console.timeEnd('specific tag with context');
console.time('direct with jquery context');
for (i=0; i<10000; i++) {
var s = $('.item',$('#ulId'));
}
console.timeEnd('direct with jquery context');
得出
direct: 3791ms
Specific tag: 3483ms
Specific class: 4128ms
Specific another class: 3001ms
with ancestor: 3094ms
with context: 72ms
specific tag with context: 73ms
direct with jquery context: 75ms
最緊要係加context!
- ';
- item ';
for (i=0; i<1000; i++) {
items += '
}
items += '
var list = $('#list');
list.html(items);
console.time('direct');
for (i=0; i<10000; i++) {
var s = $('.item');
}
console.timeEnd('direct');
console.time('Specific tag');
for (i=0; i<10000; i++) {
var s = $('li.item');
}
console.timeEnd('Specific tag');
console.time('Specific class');
for (i=0; i<10000; i++) {
var s = $('.item.anotherClass');
}
console.timeEnd('Specific class');
console.time('Specific another class');
for (i=0; i<10000; i++) {
var s = $('li.item.anotherClass');
}
console.timeEnd('Specific another class');
console.time('with ancestor');
for (i=0; i<10000; i++) {
var s = $('#ulId .item');
}
console.timeEnd('with ancestor');
console.time('with context');
for (i=0; i<10000; i++) {
var s = $('.item','#ulId');
}
console.timeEnd('with context');
console.time('specific tag with context');
for (i=0; i<10000; i++) {
var s = $('.item','#ulId');
}
console.timeEnd('specific tag with context');
console.time('direct with jquery context');
for (i=0; i<10000; i++) {
var s = $('.item',$('#ulId'));
}
console.timeEnd('direct with jquery context');
得出
direct: 3791ms
Specific tag: 3483ms
Specific class: 4128ms
Specific another class: 3001ms
with ancestor: 3094ms
with context: 72ms
specific tag with context: 73ms
direct with jquery context: 75ms
最緊要係加context!
2010年9月1日星期三
Ubuntu 10.04 上, 定時用ClamAV 掃毒並 email log
安裝
更新病毒庫
設定cron
設定限權
把shell加到 crontab 內
# 記得更改 LOG_FILE , SCAN_FOLDER
# 想用gmail寄可參考 ubuntu 10.04 上,透過 gmail 用命令列寄信
shell 修改自http://ubuntuforums.org/showthread.php?t=631293
$ sudo apt-get install clamav
更新病毒庫
$ sudo freshclam
設定cron
$ sudo vim /usr/local/bin/virus_scan.sh
#!/bin/bash
# ----------------------------------------------------------------------
# Virus scan with ClamAV
# ----------------------------------------------------------------------
# Disabling PATH improves the security of the script
unset PATH
# Declare the variables
ECHO=/bin/echo;
DATE=/bin/date;
FRESHCLAM=/usr/bin/freshclam;
CLAMSCAN=/usr/bin/clamscan;
LOG_FILE=/home/user/clamscan.log;
SCAN_FOLDER=/;
# Start the log entry
$ECHO Complete system virus scan starting >> $LOG_FILE;
$DATE >> $LOG_FILE;
$ECHO \* >> $LOG_FILE;
# Update Virus definitions
$FRESHCLAM >> $LOG_FILE;
# Run the scan
$CLAMSCAN -ri $SCAN_FOLDER >> $LOG_FILE;
# Finish the log entry
$ECHO \* >> $LOG_FILE;
$ECHO Complete system virus scan finished >> $LOG_FILE;
$DATE >> $LOG_FILE;
$ECHO \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* >> $LOG_FILE;
$cat clamscan.log | mail -s "ClamAV Scan" someone@server.com
$rm clamscan.log
設定限權
sudo chown root /usr/local/bin/virus_scan.sh
sudo chmod u=rwx /usr/local/bin/virus_scan.sh
sudo chmod go= /usr/local/bin/virus_scan.sh
把shell加到 crontab 內
sudo vim /etc/crontab
20 3 * * * root /usr/local/bin/virus_scan.sh
# 記得更改 LOG_FILE , SCAN_FOLDER
# 想用gmail寄可參考 ubuntu 10.04 上,透過 gmail 用命令列寄信
shell 修改自http://ubuntuforums.org/showthread.php?t=631293
ubuntu 10.04 上,透過 gmail 用命令列寄信
$ sudo apt-get install heirloom-mailx msmtp
$ vim ~/.mailrc
$ vim ~/.msmtprc
$ chmod 600 ~/.msmtprc
$ echo "Hello, world!" | mail -s "Test from command line" -a attachment.txt somebody@somedomain.org
ssmtp也有相同作用, 但ssmtp會把帳密以明碼存在/etc/下,會增有gmail被帳號被盜。
參考
How To Use Gmail Account To Relay Email From a Shell Prompt
在 Ubuntu 8.04 上透過 gmail 用命令列寄信
$ vim ~/.mailrc
set from="YOURNAME@gmail.com (YOURNAME)"
set sendmail="/usr/bin/msmtp"
set message-sendmail-extra-arguments="-a gmail"
$ vim ~/.msmtprc
defaults
logfile /home/USER/msmtp.log
# gmail account
account gmail
auth on
host smtp.gmail.com
port 587
user YOURNAME@gmail.com
password YOURPASSWORD
from YOURNAME@gmail.com
tls on
tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt
# set default account to use (not necessary with single account)
account default : gmail
$ chmod 600 ~/.msmtprc
$ echo "Hello, world!" | mail -s "Test from command line" -a attachment.txt somebody@somedomain.org
ssmtp也有相同作用, 但ssmtp會把帳密以明碼存在/etc/下,會增有gmail被帳號被盜。
參考
How To Use Gmail Account To Relay Email From a Shell Prompt
在 Ubuntu 8.04 上透過 gmail 用命令列寄信
訂閱:
文章 (Atom)