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 -*- | |
# Filename: viterbi.py | |
# Author:hankcs | |
# Date: 2014-05-13 下午8:51 | |
states = ('Rainy', 'Sunny') | |
observations = ('walk', 'shop', 'clean') | |
start_probability = {'Rainy': 0.6, 'Sunny': 0.4} |
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
/* | |
Pseudo code in HTTP.sys to understand flow related to MS15-034 | |
All pseudo code are reversed from vulnerable HTTP.sys on Windows 7 SP1 x86 | |
For anyone want to know what function are patched. | |
Just open patched version and find all functions reference to RtlULongLongAdd(). | |
*/ | |
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
#! /usr/bin/env python2.7 | |
#encoding:utf-8 | |
#@description:一个python守护进程的例子 | |
#@tags:python,daemon | |
import sys | |
import os | |
import time | |
import atexit | |
from signal import SIGTERM |
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
############# My Clusters Health | |
curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true' | |
{ | |
"cluster_name" : "TweetHadoop", | |
"status" : "yellow", | |
"timed_out" : false, | |
"number_of_nodes" : 1, | |
"number_of_data_nodes" : 1, | |
"active_primary_shards" : 15, |
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
#!/usr/bin/env python | |
# import csv | |
# reader = csv.reader(open('4956984.csv', 'rb')) | |
def gen_chunks(reader, chunksize=100): | |
""" | |
Chunk generator. Take a CSV `reader` and yield | |
`chunksize` sized slices. | |
""" |