Skip to content

Instantly share code, notes, and snippets.

View DaveIW2034's full-sized avatar
😀
Focusing

ChunJi Zhang DaveIW2034

😀
Focusing
View GitHub Profile
@DaveIW2034
DaveIW2034 / gen_logger.py
Created June 20, 2019 15:14
动态生成 logger位置
import logging
import logging.config
def configure_logger(name, log_path):
logging.config.dictConfig({
'version': 1,
'formatters': {
'default': {'format': '%(asctime)s - %(levelname)s - %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S'}
},
@DaveIW2034
DaveIW2034 / gen_logger.py
Created June 20, 2019 15:09
celery task 生效设置.
import logging
import logging.config
def configure_logger(name, log_path):
logging.config.dictConfig({
'version': 1,
'formatters': {
'default': {'format': '%(asctime)s - %(levelname)s - %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S'}
},
@DaveIW2034
DaveIW2034 / add.py
Last active June 20, 2019 02:58
# celery 任务队列, celery 定制路由, 改进版
from celery import Celery
app_add = Celery('app_add',backend='redis://localhost:6379/0',broker='redis://localhost:6379/0')
from kombu import Exchange, Queue
media_exchange = Exchange('app_reduce', type='direct')
app_add.conf.task_queues = (
Queue('app_reduce', media_exchange, routing_key='app_reduce'),
)
@DaveIW2034
DaveIW2034 / add.py
Last active June 19, 2019 14:41
# celery 任务队列, 不同celery实例定制不同的默认队列及路由设定.
# 说明文档
# https://docs.celeryproject.org/en/latest/userguide/routing.html#broadcast
from celery import Celery
app_add = Celery('app_add',backend='redis://localhost:6379/0',broker='redis://localhost:6379/0')
from kombu import Exchange, Queue
# default_exchange = Exchange('default', type='direct')
# media_exchange = Exchange('media', type='direct')
#
@DaveIW2034
DaveIW2034 / gridtext_analysis.py
Created June 12, 2019 15:39
gridtext 文件读入的中文
# 说明文档
# https://blog.csdn.net/duxin_csdn/article/details/88966295
# 库文件位置
# https://github.com/kylebgorman/textgrid
# 解析代码
import textgrid
def is_chinese(uchar):
"""判断一个unicode是否是汉字"""
if (uchar >= u'\u4e00') and (uchar<=u'\u9fa5'):
@DaveIW2034
DaveIW2034 / gridtext_analysis.py
Created June 12, 2019 15:39
gridtext 文件读入的中文
# 说明文档
# https://blog.csdn.net/duxin_csdn/article/details/88966295
# 库文件位置
# https://github.com/kylebgorman/textgrid
# 解析代码
import textgrid
def is_chinese(uchar):
"""判断一个unicode是否是汉字"""
if (uchar >= u'\u4e00') and (uchar<=u'\u9fa5'):
@DaveIW2034
DaveIW2034 / gridtext_analysis.py
Created June 12, 2019 15:39
gridtext 文件读入的中文
# 说明文档
# https://blog.csdn.net/duxin_csdn/article/details/88966295
# 库文件位置
# https://github.com/kylebgorman/textgrid
# 解析代码
import textgrid
def is_chinese(uchar):
"""判断一个unicode是否是汉字"""
if (uchar >= u'\u4e00') and (uchar<=u'\u9fa5'):
@DaveIW2034
DaveIW2034 / gridtext_analysis.py
Created June 12, 2019 15:39
gridtext 文件读入的中文
# 说明文档
# https://blog.csdn.net/duxin_csdn/article/details/88966295
# 库文件位置
# https://github.com/kylebgorman/textgrid
# 解析代码
import textgrid
def is_chinese(uchar):
"""判断一个unicode是否是汉字"""
if (uchar >= u'\u4e00') and (uchar<=u'\u9fa5'):
@DaveIW2034
DaveIW2034 / class_instance.py
Created March 29, 2019 02:27
有关生成类实例
"""
把一个类实例的生成写成类方法放入类里面, 你直接定义一个函数好不好, 叫获取类实例, 好么.
神烦!!!
"""
@DaveIW2034
DaveIW2034 / enhance.py
Created March 26, 2019 03:23
如何增强自己的技术落地能力.
"""
如何实战一步步的增强自己的技术落地能力.
1 了解一门技术, 技术的适用场景及实现架构.
2 实战最简单实现.
3 实战通用实现.
4 实战特例实现.
5 实战工程化实现, 在具体项目中的嵌入和应用.
"""