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
''' | |
struct is ["url", "introduction"] | |
''' | |
cs_site=[ | |
"http://composingprograms.com", "Welcome to Composing Programs, a free online introduction to programming and computer science.", | |
] | |
unittest_site = [ | |
"http://stackoverflow.com/questions/155436/unit-test-naming-best-practices", " [UnitOfWork_StateUnderTest_ExpectedBehavior]", | |
] | |
python_site = [ |
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
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse |
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 dict_to_assert(dict_name, d): | |
template = '''self.assertEqual({}['{}'], {})'''.format(dict_name, '{}', '{}') | |
for k,v in d.items(): | |
try: | |
assert_line = template.format(k, v) | |
except Exception as ex: | |
assert_line = template.format(k, ex) | |
print assert_line |
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 | |
from django import forms | |
from django.core.validators import RegexValidator | |
from datetime import datetime | |
import re | |
def only_character_number_underline(value): | |
RegexValidator(regex=r'^[A-Za-z0-9_]+$', message='only number, A-Z, a-z, _')(value) |
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 render_format(kv): | |
k = kv[0] | |
v = kv[1] | |
with_span = lambda: '{}{}'.format(v[1], ' '*(48-len(v[1]))) | |
return '| {} | {} | {}|'.format(v[0], k, with_span()) |
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 gg-input (li) | |
;;(setq v2 '()) | |
(setq li (split-string li ",")) | |
(setq format-str | |
(mapcar | |
(lambda (f) (format "\n:param %s: %s" f f)) | |
li)) | |
(require 'cl-lib) | |
(prin1-to-string format-str) |
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 | |
''' | |
Aggregation of datapoints | |
~~~~~~~~~~~~~~~~~~~~~~~~~ | |
对数据点得值进行聚合运算, 包括【sum, avg, max, min】 | |
''' | |
import json |
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 | |
''' | |
Aggregation of datapoints | |
~~~~~~~~~~~~~~~~~~~~~~~~~ | |
对数据点得值进行聚合运算, 包括【sum, avg, max, min】 | |
''' | |
import json |
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
(add-to-list 'load-path "~/.emacs.d/plugins/") | |
(require 'auto-complete-config) | |
(add-to-list 'ac-dictionary-directories "~/.emacs.d/plugins//ac-dict") | |
(ac-config-default) | |
(global-linum-mode 1) | |
(add-to-list 'load-path | |
"~/.emacs.d/plugins/yasnippet") |
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 | |
import logging | |
import json | |
from datetime import datetime, timedelta | |
import time | |
import random | |
USE_MONGO = True |