Skip to content

Instantly share code, notes, and snippets.

View wantongtang's full-sized avatar

Richard M Wan wantongtang

View GitHub Profile
@yesseecity
yesseecity / HMM-example.py
Created November 8, 2017 06:10
HMM-example, python2
# -*- 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}
@worawit
worawit / http_sys_pseudo.c
Last active July 30, 2021 04:18
MS15-034 (CVE-2015-1635) PoCs
/*
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().
*/
@jamiesun
jamiesun / daemon.py
Created July 12, 2012 10:20
一个python守护进程的例子
#! /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
@jonhurlock
jonhurlock / pleaseEscape.py
Created June 20, 2012 15:07
Example Python Code showing cURLing data and POSTing data to Elastic Search, but fails with escaped speech marks
############# 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,
@miku
miku / 4956984-1.py
Created February 10, 2011 13:16
How do you split a csv file into evenly sized chunks in Python?
#!/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.
"""