**引言**
HTTP是一个属于应用层的面向对象的协议,由于其简捷、快速的方式,适用于分布式超媒体信息系统。它于1990年提出,经过几年的使用与发展,得到不断地完善和扩展。目前在WWW中使用的是HTTP/1.0的第六版,HTTP/1.1的规范化工作正在进行之中,而且HTTP-NG(Next Generation of HTTP)的建议已经提出。
HTTP协议的主要特点可概括如下:
1.支持客户/服务器模式。
2.简单快速:客户向服务器请求服务时,只需传送请求方法和路径。请求方法常用的有GET
......编写`hello_world.vim`,插件内容为:
:::vim
"hello world test
"vim打开该文件,在命令行中加载当前文件到vim: :so %
"然后按hw组合键,就会在vim底部打印hello world
nnoremap hw :python print "hello world"
`.vim`中执行python代码,插件内容为:
:::vim
python << python_code
print 'hi Mr.axiaoxin'
python_c
...... :::python
from functools import wraps
def makebold(fn):
@wraps(fn)
def wrapped():
return "" + fn() + ""
return wrapped
def makeitalic(fn):
@wraps(fn)
def wrapped():
return "" + fn() + ""
collectd收集系统metric,statsd可以收集任意的数据,比如你自己的程序,通过监听UDP包收集数据,通过TCP连接Graphite。
**安装**
ubuntu默认库中没有提供StatsD,所以只能自己编译安装。
安装所需依赖:
sudo apt-get install git nodejs devscripts debhelper
编译statsd:
mkdir ~/build
cd ~/build
git clone https://github.com/etsy/statsd.git
cd s
**安装**
sudo apt-get install collectd collectd-utils
**配置**
sudo vi /etc/collectd/collectd.conf
设置当前机器的hostname,修改配置文件中`Hostname`的值为你想要的hostname。如果有真是的域名,可以不用设置这个值。
确保一下插件的load命令是解开了注释的。
LoadPlugin cpu
LoadPlugin df
LoadPlugin entropy
LoadPlugin interface
**安装**
14.04的库里默认已经有了Graphite,所以安装只需:
sudo apt-get install graphite-web graphite-carbon
Carbon是Graphite的存储后端
**配置Graphite**
graphite-web是一个django站点,其settings文件在`/etc/graphite/local_settings.py`
So,配置django,再熟悉不过,修改其配置文件:
sudo vim /etc/graphite/local_settings.py
解除`SEC
......
:::python
In [4]: class Borg:
...: __share_state = {}
...: def __init__(self):
...: self.__dict__ = self.__share_state
...:
In [5]: b1 = Borg()
In [6]: b1.x = 1
In [7]: b2 = Borg()
In [8]: b2.x
Out[8]: 1
......