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
''' | |
Get the Linux birth time of the system or a process using /proc/stat | |
and /proc/pid/stat. | |
For example, you may get local datetime when process 12345 started: | |
import datetime | |
import btime | |
datetime.datetime.fromtimestamp(btime.process_time(12456)[1]) | |
''' | |
import os |
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
''' | |
A simple command line tool for managing windows PATH variable. | |
''' | |
import _winreg as winreg | |
import os | |
import sys | |
def choose_key(scope, write=False): | |
''' |
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 signal | |
import time | |
from signal_inject import * | |
def dummy_handler(signum, frame): | |
print "In dummy handler" | |
inject_signal_handler(signal.SIGINT, dummy_handler) | |
while 1: |
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 httplib2 | |
# set proxy_rdns=True to ensure use the dns on | |
# remote proxy, in case local DNS is pulluted. | |
proxy = httplib2.ProxyInfo(httplib2.socks.PROXY_TYPE_HTTP, | |
'localhost', 8000, | |
proxy_rdns=True) | |
http = httplib2.Http(proxy_info=proxy) | |
http.request('http://google.com') |
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
;; cmd | |
;; ---------- | |
;;; Open the cmd in the current directory. | |
(defun cmd () | |
"Open the cmd in the current directory." | |
(interactive) | |
(w32-shell-execute | |
"open" | |
"cmd")) |
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 sys | |
import functools | |
''' | |
Usage: | |
consider following functions | |
import stack_trace | |
def foo(): | |
pass | |
def bar(): |
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 -*- | |
# An pure python implemetation of Dynamic Time Warpping | |
# http://en.wikipedia.org/wiki/Dynamic_time_warping | |
class Dtw(object): | |
def __init__(self, seq1, seq2, distance_func=None): | |
''' | |
seq1, seq2 are two lists, | |
distance_func is a function for calculating |
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
//http://data-matters.blogspot.com/2008/07/simple-implementation-of-dtwdynamic.html | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Collections; | |
namespace DTW | |
{ |
NewerOlder