This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# checkout 检出操作,第一次拉下SVN服务器中的代码 | |
svn checkout svn://192.168.0.1/runoob01 --username=user01 | |
# 出现冲突,查看两个分支不同的部分 | |
svn diff #查看当前工作区的所有变动 | |
svn diff test.py #查看当前工作区test.py与最新版本的差异 | |
svn diff -r 200:201 test.py #查看指定版本号下该文件的差异 | |
svn diff -r 301 bin #查看当前工作区和版本301中bin目录下的查看 | |
# 更新本地代码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#修改已存在数据 | |
UPDATE table_name SET field1=new-value1, field2=new-value2 | |
[WHERE Clause] | |
update loghis set dirtime='12331' where logpath='/Users/ayuliao/Downloads/temp/20181017/' | |
#插入数据 | |
INSERT INTO table_name ( field1, field2,...fieldN ) VALUES | |
( value1, value2,...valueN ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar命令可以用来压缩打包单文件、多个文件、单个目录、多个目录。 | |
常用格式: | |
单个文件压缩打包 tar czvf my.tar.gz file1 | |
多个文件压缩打包 tar czvf my.tar.gz file1 file2,...(file*)(也可以给file*文件mv 目录在压缩) | |
单个目录压缩打包 tar czvf my.tar.gz dir1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# 下载普通文件 | |
def download_file(): | |
image_url = "https://www.python.org/static/community_logos/python-logo-master-v3-TM.png" | |
r = requests.get(image_url) # create HTTP response object | |
with open("python_logo.png",'wb') as f: | |
f.write(r.content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#使用findall方法,会找出字符串中所有匹配的字符,如果有多个匹配结构,则返回一个list | |
re.findall('mysql:.*\n\n',str, re.M| re.S) | |
如果想把匹配中的mysql头去除,则改写成如下形式: | |
re.findall('mysql:.*\n\n',str, re.M| re.S) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
第一种方式 | |
:$ 跳转到最后一行 | |
:1 跳转到第一行 | |
第二种方式 | |
shift+g 跳转到最后一行 | |
gg 跳转到第一行 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ps -ef //显示所有进程信息,连同命令行 | |
ps -u root //显示root进程用户信息 | |
ps -A //显示进程信息 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
判断路径是否存在,不存在则创建整个目录树 | |
''' | |
if not os.path.exists(f_path): | |
#创建目录树 | |
os.makedirs(f_path) | |
os.path.exists('d:/assist') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='Manual to this python script') | |
parser.add_argument('--mode', type=str, default='d', | |
help='m: move file mode which just move the file in the device,' | |
' d: download mode which download file from remote server, default mode is d') | |
parser.add_argument('--agent', type=str, default=None, help='agent PHP fold path, default value is None') | |
parser.add_argument('--ssdb', type=str, default='beta-1.0.175', help='ssdb version, defalut version is beta-1.0.175') | |
parser.add_argument('--sgame', type=str, default='beta-1.0.14794', help='sgame version, defalut version is beta-1.0.14794') | |
parser.add_argument('--cgame', type=str, default='beta-1.0.15222', help='cgame version, defalut version is beta-1.0.15222') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def debug(func): | |
''' | |
catch error and write in log file | |
:param func: | |
:return: | |
''' | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
try: | |
return func(*args,**kwargs) |