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 | |
#coding=utf-8 | |
import urllib2 | |
import Queue | |
import sys | |
import traceback | |
import threading | |
import re | |
import datetime |
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
(defun score (dice) | |
(reduce #'+ (mapcar #'(lambda (n) | |
(let ((coun (count n dice))) | |
(case n | |
(1 (cond ((= coun 3) 1000) | |
((< coun 3) (* 100 coun)) | |
((> coun 3) (+ 1000 (* 100 (- coun 3)))))) | |
(5 (cond ((= coun 3) 500) | |
((< coun 3) (* coun 50)) | |
((> coun 3) (+ 500 (* (- coun 3) 50))))) |
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
def __getattr__(self, name): | |
""" | |
According to invoke methods to obtain data | |
""" | |
base_type = ['Careful', 'Warning', 'Critical'] | |
base_module = ['CPU', 'LOAD', 'Process', 'STD', 'MEM', 'SWAP', 'TEMP', 'HDDTEMP', 'FS'] | |
get_type = ['get'+n for n in base_type] | |
get_module = ['get'+m+t for m in base_module\ | |
for t in base_type] |
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
def getCareful(self, stat): | |
return self.__limits_list[stat][0] | |
def getWarning(self, stat): | |
return self.__limits_list[stat][1] | |
def getCritical(self, stat): | |
return self.__limits_list[stat][2] | |
# TO BE DELETED AFTER THE HTML output refactoring |
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
#!/bin/env python | |
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.options | |
import tornado.web | |
import tornado.httpclient | |
import time |
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
在.emacs.d/core/prelude-core.el最后添加函数 | |
(defun prelude-py-taglist (arg) | |
"简易版taglist" | |
(interactive "P") | |
(let ((buffer-other | |
(if arg | |
"*py-taglist*" | |
(format "*py-taglist from %s*" (buffer-name))))) | |
(occur-1 "class \\|def " nil |
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
class ProcessStates: | |
STOPPED = 0 | |
STARTING = 10 | |
RUNNING = 20 | |
BACKOFF = 30 | |
STOPPING = 40 | |
EXITED = 100 | |
FATAL = 200 | |
UNKNOWN = 1000 |
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/expect | |
#使用expect登陆服务器脚本 | |
#dongweiming 2013.04.02 | |
set timeout 5 | |
set server [lindex $argv 0] | |
set port [lindex $argv 1] | |
set password [lindex $argv 2] | |
set tbjpass XXX |
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 multiprocessing | |
import time | |
import pymongo | |
start = time.time() | |
db = pymongo.MongoClient()['test'] | |
def mapper(i): | |
if i['a'] > 0.95: |
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
;;; pli.el --- A Major mode for demo | |
;; Description: A Major mode for demo | |
;; Created: 2014-09-01 01:12 | |
;; Author: dongweiming [email protected] | |
;; URL: http://github.com/dongweiming/pli-mode | |
;; Keywords: test, emacs | |
;; Version: 1.0 |
OlderNewer