Skip to content

Instantly share code, notes, and snippets.

@baijian
baijian / tail -f -F
Created January 16, 2013 09:58
tail -f 引发的思考
tail -f => tail --follow=descriptor
tail -F => tail --follow=name --retry
example1:
-----start----
first:
tail -f testfile
tail -F testfile
then:
rm -f testfile
@baijian
baijian / Maven using a proxy
Created January 18, 2013 01:35
maybe when you new project using maven, when downloading *.jar, so slow, so you can set a proxy
~/.m2/settings.xml
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
Maven have three lifecycles:clean default and site.
====
**clean lifecycle**
it has three phases
pre-clean
clean:delete the project's build directory(default target directory)
post-clean
**site lifecycle**
it is concerned with generating documentation for a project.
@baijian
baijian / create a project with maven
Last active December 11, 2015 08:59
maven is a good thing to manage java project...
before we start to create a project using maven,
maybe we should set a proxy.....
we can use maven archetype plugin to help us to
create a maven project , you can see archtype
as a existing template.
>>mvn archetype:generate
then terminal will prompt you to choose a number(choose a template),
because there are a lot of choices, so you can use filter to
filter some like input "quick", then you can see
===
pom.xml file is essentially the project's metadata file
that describes the various aspects of the project.
It describes the project's name, group, version,
dependecies, and many other things.
===
Ok, as we have create a project with maven and
import it into eclipse, when we develop the project
we want to use a jar file in our local repository(for example jzmq.jar),
so we add the jar file into our local repository first,
>> crontab -e
* * * * * env > ~/env.tmp
bash shell
>>env > ~/env.tmp2
compare two file: evn.tmp and env.tmp2, you will know why your job can run through shell but can't run through cron.
```
sudo apt-get install build-essential autoconf automake \
libtool libfcgi-dev spawn-fcgi \
libssl-dev nginx git-core
```
###fcgiwrap
```
git clone https://github.com/gnosek/fcgiwrap.git
cd fcgiwrap/
autoreconf -i
@baijian
baijian / team develop
Last active December 16, 2015 01:38
develop project using vagrant
### Install virtualbo
https://www.virtualbox.org/wiki/Downloads
### Install vagrant
http://downloads.vagrantup.com/
###
```
> vagrant init
this command just generate a Vagrantfile, this file describe the kind of machine and
@baijian
baijian / login to the server without passcode
Last active December 16, 2015 11:39
when want to login without password, pay attention to the authority of directory and file
>client
ssh-keygen,一直Enter,得到一对rsa的公钥私钥对.
scp id_rsa.pub user@server.com:~/
>server
确保/root权限为750
@baijian
baijian / gist:5464990
Last active December 16, 2015 16:40
mysqldump
命令导出数据库表or数据:
>mysqldump -u用戶名 -p密码 -d 數據库名 表名 脚本名;
导出数据库所有表结构
>mysqldump -uroot -password -d dbname > db.sql
导出数据库table表接口
>mysqldump -uroot -ppassword -d dbname table > table.sql