Skip to content

Instantly share code, notes, and snippets.

@miminus
miminus / jieba.txt
Created July 21, 2016 12:32
基于Python的分词工具
###<font color=red>Jieba</font>
___
####Features
######1.三种分词模式
>
* 精确模式:试图将句子最精确地切开,适合文本分析;
* 全模式:把句子中所有的可以成词的词语都扫描出来, 速度非常快,但是不能解决歧义;
* 搜索引擎模式:在精确模式的基础上,对长词再次切分,提高召回率,适合用于搜索引擎分词。
######2.支持繁体分词
@miminus
miminus / seaweedFS.md
Last active July 22, 2016 08:56
一种分布式文件系统

####Defination: SeaweedFS is a simple and highly scalable distributed file system, two objectives as follows:

  • to store billions of files!
  • to serve the files fast!

####Fetures:

  • implement only a key->file mapping ,like "NoSQL" ,called "NoFS"
  • there are master-server and volume-server:
@miminus
miminus / pyenv.md
Created July 20, 2016 09:49
为Mac 设置Python多版本开发环境

##参考链接

##问题 - 可能会遇到多个版本同时部署的情况

  • 系统自带的Python是2.x,自己需要Python 3.x,测试尝鲜;
  • 系统是2.6.x,开发环境是2.7.x
  • 由于Mac机器系统保护的原因,默认的Python中无法对PIP一些包升级,需要组建新的Python环境
  • 此时需要在系统中安装多个Python,但又不能影响系统自带的Python,即需要实现Python的多版本共存。pyenv就是这样一个Python版本管理器

##解决方法 - pyenv

@miminus
miminus / Fragment
Created July 20, 2016 09:34
python的通用log文件,满足大部分的日志记录
#!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################
#
# Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved
#
########################################################################
"""
File: log.py
import termcolor
# special use
red_on_cyan = lambda x: termcolor.colored(x, 'red', 'on_cyan')
print red_on_cyan('* MiniSpider is Staring ... ')
# general use
print termcolor.colored('* MiniSpider Configurations list as follows:', 'green')
print termcolor.colored('* MiniSpider Configurations list as follows:', 'red')
@miminus
miminus / threading - Queue.py
Created July 20, 2016 06:27
* 如何使用 Queue 来实现 生产者-消费者的关系 * 理解如何使用 task_done()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################
#
# Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved
#
########################################################################
"""
File: worker_costumer.py
@miminus
miminus / ConfigParser_Read
Created July 20, 2016 06:19
snippets_argparse
#!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################
#
# Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved
#
########################################################################
"""
File: config_parse_read.py
@miminus
miminus / Git.md
Created July 19, 2016 13:33
.gitignore

Windows:

Thumbs.db ehthumbs.db Desktop.ini

Python:

*.pyc *.so *.egg *.egg-info