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
# python | |
# 企业名称正则:只允许汉字,数字,字母 | |
re.match(u'^[a-zA-Z0-9\u4e00-\u9fa5]{4,50}$', u'0Aa_测试').group() |
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
# 限制条件:中间件类名必须以Middleware结尾 | |
APP_ROOT = os.path.join(BASE_DIR, 'app') | |
APP_DIR_LIST = os.listdir(APP_ROOT) | |
APPS = {} # {'account': '/var/test/account'} | |
for app_name in APP_DIR_LIST: | |
if app_name == 'tpl': | |
continue | |
app = os.path.join(APP_ROOT, app_name) |
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 os | |
import importlib | |
APP_ROOT = os.path.join(BASE_DIR, 'app') | |
APP_DIR_LIST = os.listdir(APP_ROOT) | |
APPS = {} # {'account': '/var/test/account'} | |
for app_name in APP_DIR_LIST: | |
if app_name == 'tpl': | |
continue |
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
class LocalUploadBackend(object): | |
BUFFER_SIZE = 10485760 # 10MB | |
def __init__(self,path,ext= '.bak'): | |
self.path = path | |
self.extension = ext | |
self.md5sum = None | |
def setup(self, filename): |
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
#!/bin/bash | |
# xvfb - this script starts and stops Xvfb | |
# | |
# chkconfig: 345 95 50 | |
# description: Starts xvfb on display 99 | |
# processname: Xvfb | |
# pidfile: /var/log/xvfb/xvfb.pid | |
# Source function library. |
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
//add | |
$( "#myinput" ).rules( "add", { | |
required: true, | |
minlength: 2, | |
messages: { | |
required: "Required input", | |
minlength: jQuery.format("Please, at least {0} characters are necessary") | |
} | |
}); |
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
#coding=utf-8 | |
import codecs | |
import os | |
import shutil | |
import chardet | |
def convert_encoding(file_path, target_encoding="utf-8"): | |
""" | |
尝试转换文件编码,默认转换成utf-8编码 |
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
class DataRestore(object): | |
def __init__(self, request): | |
""" | |
数据恢复类 | |
系统配置--数据恢复页面主要功能: 上传--备份恢复前的--解压覆盖 | |
""" | |
self.request = request | |
self.uploadFileInputName = "uploadFile" | |
#上传文件存储的临时目录 | |
self.strUploadTempDir = os.path.join(settings.WebTempDir, "dw-cbv4datarestore", pubfun.getTimestampStr()) |
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
#coding=utf-8 | |
__author__ = 'lyhapple' | |
import os | |
dir_path = '%s' % u'D:\\迅雷下载\\' | |
for name in os.listdir(dir_path): |
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
#coding=utf-8 | |
""" | |
百科ES搜索引擎初始化模块 | |
""" | |
from Queue import Queue | |
import datetime | |
import time | |
import threading | |
import traceback | |
import pyes |
NewerOlder