make playlist

March 23rd, 2012 yhlu No comments

find . -name “*.mp3″|sed ‘s/^\.\///g’>playlist.m3u

Categories: Uncategorized Tags:

Changing java lookandfeel without modifying the application

December 17th, 2011 yhlu No comments

java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -jar yourapp.jar

Some Look and Feel list can be found below:

http://www.javootoo.com/

http://www.open-open.com/61.htm

Categories: Uncategorized Tags:

make the home/end function keys go to the beginning/end of current line

August 3rd, 2011 yhlu No comments

mkdir ~/Library/KeyBindings
cd ~/Library/KeyBindings
touch DefaultKeyBinding.dict
vi DefaultKeyBinding.dict

{
/* home */
“\UF729″ = “moveToBeginningOfLine:”;
“$\UF729″ = “moveToBeginningOfLineAndModifySelection:”;

/* end */
“\UF72B” = “moveToEndOfLine:”;
“$\UF72B” = “moveToEndOfLineAndModifySelection:”;

/* page up/down */
“\UF72C” = “pageUp:”;
“\UF72D” = “pageDown:”;
}

Categories: Uncategorized Tags:

Who Has Seen the Wind?

June 29th, 2011 yhlu No comments

Who has seen the wind?
Neither I nor you.
But when the leaves hang trembling,
The wind is passing through.
Who has seen the wind?
Neither you nor I.
But when the trees bow down their heads,
The wind is passing by.

by Christina Georgina Rossetti
(1830-1894)

Categories: Uncategorized Tags:

Git

June 1st, 2011 yhlu No comments

1. git config –global http.sslverify false
or git config –global http.sslcainfo cacert.crt

2. auto fill https authorization username and password:
vi ~/.netrc
machine www.example.com
login myusername
password mypassword

3. ubuntu lucid upgrade package git-core:
sudo add-apt-repository ppa:pdoes/ppa/ubuntu
if add-apt-repository is not installed:
sudo apt-get install python-software-properties

Categories: Uncategorized Tags:

PHP and nginx on Ubuntu: the easy way

May 31st, 2011 yhlu No comments

I’ve now changed my slice from running lighttpd to nginx. Here’s the simplest way, in around 6 commands, to get PHP up and running via FastCGI.

Install and setup
Install PHP 5:

sudo aptitude install php5-cgi
Install nginx:

sudo aptitude install nginx
Create PHP 5 FastCGI start-up script:

sudo nano /etc/init.d/php-fastcgi
Inside, put:

#!/bin/bash
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=1000

PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS=”- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND”
RETVAL=0

start() {
echo -n “Starting PHP FastCGI: ”
start-stop-daemon –quiet –start –background –chuid “$USER” –exec /usr/bin/env — $PHP_CGI_ARGS
RETVAL=$?
echo “$PHP_CGI_NAME.”
}
stop() {
echo -n “Stopping PHP FastCGI: ”
killall -q -w -u $USER $PHP_CGI
RETVAL=$?
echo “$PHP_CGI_NAME.”
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo “Usage: php-fastcgi {start|stop|restart}”
exit 1
;;
esac
exit $RETVAL
Make start-up script executable:

sudo chmod +x /etc/init.d/php-fastcgi
Launch PHP:

sudo /etc/init.d/php-fastcgi start
Launch at start-up:

sudo update-rc.d php-fastcgi defaults
That’s it. All installed and ready to go.

Test
In your server config, add the following:

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
include fastcgi_params;
}
Restart nginx:

sudo /etc/init.d/nginx restart
Create a file in your web root (in the example above, /var/www/nginx-default/test.php):

phpinfo();
Visit the page in your browser and you should see the standard PHP info page. And you’re done.

via: http://davidwinter.me/articles/2009/06/13/php-and-nginx-the-easy-way/

Categories: Uncategorized Tags:

Switchy! Proxy Setting

April 20th, 2011 yhlu No comments

Online rule:

https://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt

Adblock:

http://adcontrol.tudou.com/*

http://*.tudou.com/tdcm/adcontrol*

*.atm.youku.com/*

Full Adblock List: (Chrome Extension: JVNA)

http://valf.atm.youku.com/valf*

http://afp.qiyi.com/main*

http://*.tudou.com/tdcm/adcontrol*

http://ku6afp.allyes.com/s*

http://iafp.pptv.com/*

http://dcads.sina.com.cn/*

http://acs.56.com/ac*

Categories: Uncategorized Tags:

Create VM machine from Ubuntu Server Template

January 12th, 2011 yhlu No comments

Because mac address changed, “ifconfig -a” got eth1, not eth0.

Solution is:

Stop networking and udev:

/etc/init.d/udev stop
/etc/init.d/networking stop

vi /etc/udev/rules.d/70-persistent-net.rules

You will find two instances. The first one is the one from the template virtual machine. The second one is the one attributed when answering “I copied it”, on first start:
# PCI device 0×1022:0×2000 (vmxnet)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:0c:29:36:xx:xx”, ATTR{type}==”1″, NAME=”eth0″

# PCI device 0×1022:0×2000 (vmxnet)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:0c:29:75:xx:xx”, ATTR{type}==”1″, NAME=”eth1″

Delete the 1st one, and change eth1 to eth0 at the end on the second one. You will end up with:
# PCI device 0×1022:0×2000 (vmxnet)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:0c:29:75:xx:xx”, ATTR{type}==”1″, NAME=”eth0″

Save the file (obviously), and then restart udev and networking:
/etc/init.d/udev start
/etc/init.d/networking start

Categories: Uncategorized Tags:

mysql table AUTO_INCREMENT index

January 4th, 2011 yhlu No comments

1. To check:
SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_name = ‘TABLE_NAME’
2. To modify:
ALTER TABLE `TABLE_NAME` auto_increment=NEW_INDEX

Categories: Uncategorized Tags:

Anoying wine image opening problem

December 30th, 2010 yhlu No comments

you can delete wine-related files from ~/.local/share/applications/, ~/.local/share/mime and ~/.config/menus to get rid of them entirely. To stop it happening again, go into winecfg, click the Libraries tab and type “winemenubuilder.exe” in the drop-down box, then click add. This will stop wine creating entries in your menu as well, but I prefer to create them manually so that I can use better icons

Categories: Uncategorized Tags: