awk '{sum += $10};END {print sum}'
例如想计算nginx日志中206下载总数据和,则用cat xxx.access.log|grep " 206 " |awk '{sum += $10};END {print sum}'
awk '{sum += $10};END {print sum}'
例如想计算nginx日志中206下载总数据和,则用cat xxx.access.log|grep " 206 " |awk '{sum += $10};END {print sum}'
首先需要安装pip模块,如果yum中没有,则需要用 get-pip.py安装
sudo python get-pip.py 安装
sudo pip install web.py
1 | wget http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-1.0.11.zip |
1 | sudo pip install python-tds |
sudo pip install pinyin4py
这样安装之后不会与之前的python2.6版本有冲突,3.x版本同理
1 | wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz |
https://www.fosshub.com/Remix-OS.html
解压之后有一个iso文件一个exe文件,推荐用ultraiso安装(用那个exe会把U盘分成三个区。。。有病吗?)
U盘开机启动之后,选择”Resident/Guest mode”,按TAB键或e键,在命令最后添加”INSTALL=2”,删掉”USB_DATA_PARTITION=1”
接下来系统会安装到硬盘上。
我只是占个tag坑…😂
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2017年5月24日
@author: BirdZhang
'''
from bs4 import BeautifulSoup
import mechanize
import cookielib
from wyblog import BLOG_URL
class NoHistory(object):
def add(self, *a, **k): pass
def clear(self): pass
def getBrowers():
br = mechanize.Browser(history=NoHistory())
#options
br.set_handle_equiv(True)
#br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
cj = cookielib.LWPCookieJar()
br.set_cookiejar(cj)##关联cookies
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.set_debug_http(False)
br.set_debug_redirects(False)
br.set_debug_responses(False)
br.addheaders = [("User-agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36")]
return br
if __name__ == "__main__":
br = getBrowers()
r = br.open(BLOG_URL)
html = r.read()
# print html
soup = BeautifulSoup(html,"html5lib")
lis = soup.find_all(name='li',attrs={
"class":"list-group-item title"
})
for i in lis:
print i.a["href"]," ".join(i.a.contents)
剩下的自己该干嘛干嘛吧
更多logrotate的说明见 http://www.linuxcommand.org/man_pages/logrotate8.html
或者这里 https://linux.cn/article-4126-1.html
在/etc/logrotate.d/tomcat里写入下面的内容
1 | /data/logs/logpath/catalina-daemon.out { |
测试
logrotate --force /etc/logrotate.d/tomcat.conf
查看是否有一个/data/logs/logpath/catalina-daemon.out.1生成
很简单,cronolog对jsvc启动的tomcat不友好
用以下命令:
/cs op #jolla-cn +o birdzhang
原文 https://developers.google.com/drive/v3/web/quickstart/python
pip install --upgrade google-api-python-client
谷歌上的步骤:
1 | Use this wizard to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials. |
内容大概如下
1 | {"installed":{"client_id":"334720361216-xxxxx.apps.googleusercontent.com","project_id":"analog-fastness-167807","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"xxxxxx","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}} |
1 | #!/usr/bin/env python |