Nginx,python拾遗

114 篇文章 0 订阅

Nginx

http://www.nginx.cn/install
编译安装Nginx一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩。

make是用来编译的,它从Makefile中读取指令,然后编译。

make install是用来安装的,它也从Makefile中读取指令,安装到指定的位置。

configure命令是用来检测你的安装平台的目标特征的。它定义了系统的各个方面,包括nginx的被允许使用的连接处理的方法,比如它会检测你是不是有CC或GCC,并不是需要CC或GCC,它是个shell脚本,执行结束时,它会创建一个Makefile文件。

nginx rewrite指令执行顺序:

1.执行server块的rewrite指令(这里的块指的是server关键字后{}包围的区域,其它xx块类似)
2.执行location匹配
3.执行选定的location中的rewrite指令
如果其中某步URI被重写,则重新循环执行1-3,直到找到真实存在的文件

python

ujson:

Ultra fast JSON encoder and decoder for Python

inspect — Inspect live objects:

The inspect module provides several useful functions to help get information about live objects such as modules, classes, methods, functions, tracebacks, frame objects, and code objects. For example, it can help you examine the contents of a class, retrieve the source code of a method, extract and format the argument list for a function, or get all the information you need to display a detailed traceback.

There are four main kinds of services provided by this module: type checking, getting source code, inspecting classes and functions, and examining the interpreter stack.
if isinstance(data, (tuple, list, set, dict)):
    return list(data)

python requests

>>> import requests
>>> headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
>>> checkResult = requests.post("http://10.22.0.152:8089/api/ruleCheck", data=jsonData, headers=headers)
>>> responseData = checkResult.json()
>>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
>>> r.status_code
200
>>> r.headers['content-type']
'application/json; charset=utf8'
>>> r.encoding
'utf-8'
>>> r.text
u'{"type":"User"...'
>>> r.json()

python url操作

from urlparse import urlparse, urljoin, urlsplit, urldefrag

>>> urlparse('http://www.baidu.com?name=lockey23')
  ParseResult(scheme='http', netloc='www.baidu.com', path='', params='', query='name=lockey23', fragment='')

>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', 'FAQ.html')
  'http://www.cwi.nl/%7Eguido/FAQ.html'

>>> urlsplit('http://user:pass@NetLoc:80/path;parameters/path2;parameters2?query=argument#fragment')
  SplitResult(scheme='http', netloc='user:pass@NetLoc:80', path='/path;parameters/path2;parameters2', query='query=argument', fragment='fragment')

>>> urlparse.urldefrag('http://netloc/path;parameters?query=argument#fragment')
  ('http://netloc/path;parameters?query=argument', 'fragment')

>>> x = urlparse.urlparse('http://netloc/path;?#')
>>> t = x[:]
>>> t
('http', 'netloc', '/path', '', '', '')
>>> urlparse.urlunparse(t)
'http://netloc/path'

css 边框颜色渐变如何实现

设置后面的两个值啊,图片边框向内偏移,图片边框的宽度

border-image: -webkit-linear-gradient( red , blue) 30 30;
border-image: -moz-linear-gradient( red, blue) 30 30;
border-image: linear-gradient( red , blue) 30 30;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值