Friday, October 5, 2012

Drush install drupal 7 in one command line

http://drush.ws/#site-install

It's a tedious to install drupal each time I start a new project. Here is a short cut to minimize the effect to start from.

drush dl drupal --desination=mysite.com
drush site-install --db-url=mysql://root:pass@localhost:port/dbname --account-name admin --acount-pass=pass
Install Drupal along with modules/themes/configuration using the specified install profile.

Examples:
 drush site-install expert --locale=uk     (Re)install using the expert install profile. Set default language to Ukranian.              
 drush site-install                        Install using the specified DB params.                                                       
 --db-url=mysql://root:pass@localhost:por                                                                                               
 t/dbname                                                                                                                               
 drush site-install                        Install using SQLite (D7+ only).                                                             
 --db-url=sqlite://sites/example.com/file                                                                                               
 s/.ht.sqlite                                                                                                                           
 drush site-install --account-name=joe     Re-install with specified uid1 credentials.                                                  
 --account-pass=mom                                                                                                                     
 drush site-install standard               Pass additional arguments to the profile (D7 example shown here - for D6, omit the form id). 
 install_configure_form.site_default_coun                                                                                               
 try=FR                                                                                                                                 
 my_profile_form.my_settings.key=value                                                                                                  


Arguments:
 profile                                   the install profile you wish to run. defaults to 'default' in D6, 'standard' in D7+                                
 key=value...                              any additional settings you wish to pass to the profile. Fully supported on D7+, partially supported on D6 (single 
                                           step configure forms only). The key is in the form [form name].[parameter name] on D7 or just [parameter name] on  
                                           D6.                                                                                                                


Options:
 --account-mail                            uid1 email. Defaults to admin@example.com                                                                           
 --account-name                            uid1 name. Defaults to admin                                                                                        
 --account-pass                            uid1 pass. Defaults to a randomly generated password. If desired, set a fixed password in drushrc.php.              
 --clean-url                               Defaults to 1                                                                                                       
 --db-prefix                               An optional table prefix to use for initial install.  Can be a key-value array of tables/prefixes in a drushrc file 
                                           (not the command line).                                                                                             
 --db-su=                            Account to use when creating a new database. Must have Grant permission (mysql only). Optional.                     
 --db-su-pw=                         Password for the "db-su" account. Optional.                                                                         
 --db-url=                                                                                                                                                             
 --locale=                          A short language code. Sets the default site language. Language files must already be present. You may use download 
                                           command to get them.                                                                                                
 --site-mail                               From: for system mailings. Defaults to admin@example.com                                                            
 --site-name                               Defaults to Site-Install                                                                                            
 --sites-subdir=           Name of directory under 'sites' which should be created. Only needed when the subdirectory does not already exist.  
                                           Defaults to 'default'                                                                                               


Aliases: si

Wednesday, September 5, 2012

Wget download whole website


wget: Download entire websites easy

v1.0.4 (en)
愚蠢的网站会让wget直接下载整个站点。
Fooling sites to let wget crawl around
wget is a nice tool for downloading resources from the internet. The basic usage is wget url:
wget http://linuxreviews.org/
Therefore, wget (manual page) + less (manual page) is all you need to surf the internet. The power of wget is that you may download sites recursive, meaning you also get all pages (and images and other data) linked on the front page:
wget -r http://linuxreviews.org/
But many sites do not want you to download their entire site. To prevent this, they check how browsers identify. Many sites refuses you to connect or sends a blank page if they detect you are not using a web-browser. You might get a message like:
Sorry, but the download manager you are using to view this site is not supported. We do not support use of such download managers as flashget, go!zilla, or getright
Wget has a very handy -U option for sites like this. Use -U My-browser to tell the site you are using some commonly accepted browser:
  wget  -r -p -U Mozilla http://www.stupidsite.com/restricedplace.html
The most important command line options are --limit-rate= and --wait=. You should add --wait=20 to pause 20 seconds between retrievals, this makes sure you are not manually added to a blacklist. --limit-rate defaults to bytes, add K to set KB/s. Example:
wget --wait=20 --limit-rate=20K -r -p -U Mozilla http://www.stupidsite.com/restricedplace.html
A web-site owner will probably get upset if you attempt to download his entire site using a simple wget http://foo.bar command. However, the web-site owner will not even notice you if you limit the download transfer rate and pause between fetching files.
Use --no-parent
--no-parent is a very handy option that guarantees wget will not download anything from the folders beneath the folder you want to acquire. Use this to make sure wget does not fetch more than it needs to if just just want to download the files in a folder.

Copyright (c) 2000-2004 Øyvind Sæther. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Sunday, February 5, 2012

Vim Not greedy

Non-greed modifiers are different and more obscure then in Perl. Perl allows you to convert any quantifier into a non-greedy version by adding an extra ? after it. So *? is a non-greedy version of a special character *
Quantifier
Description
\{-}
matches 0 or more of the preceding atom, as few as possible
\{-n,m}
matches 1 or more of the preceding characters...
\{-n,}
matches at lease or more of the preceding characters...
\{-,m}
matches 1 or more of the preceding characters...

Friday, February 3, 2012

ssh多用户登录远程服务器

http://www.cyberciti.biz/tips/linux-multiple-ssh-key-based-authentication.html

bluehost上创建git服务器


1. 安装git

#cd ~
#mkdir .local
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$PATH

#cd ~/.local
#mkdir -v src
#cd src
#wget http://git-core.googlecode.com/files/git-1.7.9.tar.gz
#tar -xzf git-1.7.4.3.tar.gz
#cd git-1.7.4.3
#./configure --prefix=$HOME/.local LDFLAGS="-L/lib64"
#make
#make install

2.配置服务器端git


#cd ~
#mkdir git
#cd git
#mkdir repository

#cd ~/git/repository
#git init --bare --share

#cd ~/git
#git clone ~/git/repository myfolder
#cd myfolder
#echo This is a test file > text.txt
#git add .

#git commit
#git push ~/git/repository/ master

#cd ~/git/
#rm -rf myfolder
#git clone ~/git/repository/ myfolder2
#cd myfolder2
#cat test.txt

3. 远程登录git

mkdir mylocalfolder
cd mylocalfolder
git init

git config remote.myrepository.uploadpack /home/myuser/.local/bin/git-upload-pack
git config remote.myrepository.receivepack /home/myuser/.local/bin/git-receive-pack

git pull myrepository master

git add .
git commit
git push myrepository master

参考链接

http://www.calzzani.com/blog/?p=92
http://sysmonblog.co.uk/misc/git_by_example/
http://codepie.org/install-git-on-bluehost-shared-hosting.html






Sunday, January 15, 2012

NFS Ubuntu

https://help.ubuntu.com/8.04/internet/C/networking-shares.html
http://www.cyberciti.biz/tips/nfs-stale-file-handle-error-and-solution.html