用於建立一個隔離的Python環境,一個專屬於項目的python環境。用virtualenv 來保持一個乾淨的環境很是有用 php
https://virtualenv.pypa.io/en/latest/ html
http://www.virtualenv.org/en/latest/index.html python
一些博文:mysql
用pyenv和virtualenv搭建單機多版本python虛擬開發環境 http://www.it165.net/pro/html/201405/13603.html git
https://github.com/yyuu/pyenv 程序員
https://github.com/yyuu/pyenv-virtualenv github
## INSTALL pyenvgolang
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profilesql
## INSTALL pyenv-virtualenvshell
git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
--------
$ pyenv install 2.7.11
$ pyenv rehash
To create a virtualenv for the Python version used with pyenv, run pyenv virtualenv, specifying the Python version you want and the name of the virtualenv directory. For example,
$ pyenv virtualenv 2.7.10 my-virtual-env-2.7.10
will create a virtualenv based on Python 2.7.10 under ~/.pyenv/versions in a folder called my-virtual-env-2.7.10.
$ pyenv virtualenv 2.7.11 ve-ansible-2.7.11
http://my.oschina.net/lionets/blog/267469
CONFIGURE_OPTS="--enable-shared" pyenv install -v 2.7.5
http://www.buildout.org/en/latest/
用於最小化將本地開發的代碼部署到遠程服務器上這一繁瑣的重複性工做。
fabric 用來自動化遠程部署項目,很是的方便。能夠根據須要在本地、遠程依次執行一系列shell 命令、程序等。好比從代碼庫更新代碼,執行數據遷移腳本,重啓服務進程,完成自動化的部署。
https://pypi.python.org/pypi/fabric-virtualenv/
最早進的Python軟件包管理工具。pip 用來解決項目依賴問題。將項目全部依賴的第三方庫寫在一個requirements.txt 中用pip 批量安裝。通常和virtualenv 配合使用,將全部包安裝在virtualenv 的環境中。
https://github.com/mitsuhiko/pipsi 優勢是能夠把每個命令都隔離開,不會再污染系統的包了,包和包之間的依賴也不會衝突了。
ansible是新出現的自動化運維工具,基於Python開發,集合了衆多運維工具(puppet、cfengine、chef、func、fabric)的優勢,實現了批量系統配置、批量程序部署、批量運行命令等功能。ansible是>基於模塊工做的,自己沒有批量部署的能力。真正具備批量部署的是ansible所運行的模塊,ansible只是提供一種框架。主要包括:
(1)、鏈接插件connection plugins:負責和被監控端實現通訊;
(2)、host inventory:指定操做的主機,是一個配置文件裏面定義監控的主機;
(3)、各類模塊核心模塊、command模塊、自定義模塊;
(4)、藉助於插件完成記錄日誌郵件等功能;
(5)、playbook:劇本執行多個任務時,非必需可讓節點一次性運行多個任務。
特性
(1)、no agents:不須要在被管控主機上安裝任何客戶端;
(2)、no server:無服務器端,使用時直接運行命令便可;
(3)、modules in any languages:基於模塊工做,可以使用任意語言開發模塊;
(4)、yaml,not code:使用yaml語言定製劇本playbook;
(5)、ssh by default:基於SSH工做;
(6)、strong multi-tier solution:可實現多級指揮。
優勢
(1)、輕量級,無需在客戶端安裝agent,更新時,只需在操做機上進行一次更新便可;
(2)、批量任務執行能夠寫成腳本,並且不用分發到遠程就能夠執行;
(3)、使用python編寫,維護更簡單,ruby語法過於複雜;
(4)、支持sudo。
To install from source.
$ git clone git://github.com/ansible/ansible.git --recursive
$ cd ./ansible
Using Bash:
$ source ./hacking/env-setup
Using Fish:
$ . ./hacking/env-setup.fish
If you want to suppress spurious warnings/errors, use:
$ source ./hacking/env-setup -q
If you don’t have pip installed in your version of Python, install pip:
$ sudo easy_install pip
Ansible also uses the following Python modules that need to be installed [1]:
$ sudo pip install paramiko PyYAML Jinja2 httplib2 six
Note when updating ansible, be sure to not only update the source tree, but also the 「submodules」 in git which point at Ansible’s own modules (not the same kind of modules, alas).
$ git pull --rebase
$ git submodule update --init --recursive
Once running the env-setup script you’ll be running from checkout and the default inventory file will be /etc/ansible/hosts. You can optionally specify an inventory file (see Inventory) other than /etc/ansible/hosts:
$ echo "127.0.0.1" > ~/ansible_hosts
$ export ANSIBLE_INVENTORY=~/ansible_hosts
NOTE ANSIBLE_INVENTORY is available starting at 1.9 and substitutes the deprecated ANSIBLE_HOSTS
You can read more about the inventory file in later parts of the manual.
Now let’s test things with a ping command:
$ ansible all -m ping --ask-pass
$ ansible all -m ping -i ~/ansible_hosts --ask-pass
You can also use 「sudo make install」 if you wish.
Ansible is not just about running commands, it also has powerful configuration management and deployment features.
surfer [high level concurrency downloader] 是一款Go語言編寫的高併發爬蟲下載器,擁有surf與phantom兩種下載內核,支持固定UserAgent自動保存cookie與隨機大量UserAgent禁用cookie兩種模式,高度模擬瀏覽器行爲,可實現模擬登陸等功能。
http://git.oschina.net/henrylee/surfer
2016-05
rust 中文教程 https://www.gitbook.com/book/kaisery/rust-book-chinese/details
2016-05
2016-05
mysql 支持json了 http://dev.mysql.com/doc/refman/5.7/en/json.html
各版本 MySQL 並行複製的實現及優缺點 http://www.oschina.net/news/70126/mysql-compare
phpenv https://github.com/phpenv/phpenv
php-build https://github.com/php-build/php-build
## INSTALL phpenv
cd
git clone git://github.com/phpenv/phpenv.git .phpenv
echo 'export PATH="$HOME/.phpenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(phpenv init -)"' >> ~/.bash_profile
exec $SHELL
phpenv rehash
## INSTALL phpenv-build
git clone git://github.com/php-build/php-build.git $HOME/.phpenv/plugins/php-build
You can list the available PHP releases by running:
$ phpenv install --releases
To build one of the listed releases run:
$ phpenv install php-5.3.20
To install multiple builds of the same release simply add a unique name for your additional builds after the release identifier.
$phpenv install php-5.3.20 debug
Will use the configuration options source file located at .phpenv/etc/php-5.3.20-debug.Darwin.source if installing on a Mac OS X environment and installs the version to .phpenv/versions/5.3.20-debug.
The build is kept in tact at location phpenv/php-src to simplify fault finding and allowing you to continue the installation process in the event of a failed build.
To continue from a previous step in the installation process use the --continue option.
$phpenv install php-5.3.20 -c 4
To start from the configuring stage of the installation process and rerun ./configure using the updated information from your configuration options source file.
When restarting an installation from scratch it may be useful to clean previously build and generated files, use
$phpenv install --clean
When installing a different release version it may be useful to do a deep clean and purge all previously build and generated files including those from custom extension located at .php-env/php-ext and purge the ccache (if used), use
$phpenv install --deep-clean
Running phpenv install with no arguments will output its usage, for detailed help documentation, use
$phpenv install --help
phpenv global
Sets the global version of PHP to be used in all shells by writing the version name to the ~/.phpenv/version file. This version can be overridden by a per-project .phpenv-version file, or by setting the PHPENV_VERSION environment variable.
$ phpenv global 5.4.0
The special version name system tells phpenv to use the system PHP (detected by searching your $PATH).
When run without a version number, phpenv global reports the currently configured global version.
phpenv local
Sets a local per-project PHP version by writing the version name to a .phpenv-version file in the current directory. This version overrides the global, and can be overridden itself by setting the PHPENV_VERSION environment variable or with the phpenv shell command.
$ phpenv local 5.3.8
When run without a version number, phpenv local reports the currently configured local version. You can also unset the local version:
$ phpenv local --unset
好程序員 + 爛技術 = 痛苦 http://www.oschina.net/news/69989/the-miserable-programmer-paradox