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 collections import defaultdict | |
shinewords = open('cli.txt','r').read().decode('utf-8') | |
section = shinewords.strip().split("==========\r\n") | |
books = defaultdict(lambda : "") | |
for i in section: | |
try: | |
i = i.split('\n') | |
books[i[0]] += i[3]+'\n\n' |
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 sys | |
import os | |
import os.path as path | |
def get_project_row_info(project, suffix): | |
res = { | |
'all_line': 0, | |
'annotation': 0, |
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 __get_proper_size_pic_from_url(url, uplimit, workbench=tempfile.mkdtemp(), pic_name=str(time.time()*1000000)): | |
pic_loc = os.path.join(workbench, pic_name+'.'+url.split('.')[-1]) | |
r = requests.get(url, stream=True) | |
if r.status_code == 200: | |
with open(pic_loc, 'wb') as f: | |
r.raw.decode_content = True | |
shutil.copyfileobj(r.raw, f) | |
else: | |
logger.warning('download pic failed with url {0}'.format(url)) | |
return |
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 -*- | |
# 一个汉字算两个字符 | |
def _chars_fit_baohong_limit(element): | |
element_len = 0 | |
for index, char in enumerate(unicode(element)): | |
if element_len >= BAOHONG_TEXT_LENGTH_LIMIT: | |
index -= 2 | |
break | |
if u'\u4e00' <= char <= u'\u9fff': # 是汉字. | |
element_len += 2 |
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
$.prototype.replaceChildText = function (text) { | |
let textNodes = this.contents().filter(function() { | |
return this.nodeType === 3; | |
}); | |
textNodes.each(function() { | |
if (this.nodeValue.trim() !== '') { | |
this.nodeValue = text | |
} | |
}); |
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
{ | |
"title": "change application", | |
"rules": [ | |
{ | |
"description": "change application use poker", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "a", |
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
user_001,book_001,4 | |
user_001,book_002,3 | |
user_001,book_005,5 | |
user_002,book_001,5 | |
user_002,book_003,4 | |
user_002,book_005,4 | |
user_003,book_001,4 | |
user_003,book_003,5 | |
user_003,book_004,3 | |
user_003,book_005,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
# 查放到.zshrc中 | |
redis-server | |
result=`ps aux | grep 6379 | grep redis-server` | |
if [[ "$result" == "" ]] | |
then | |
redis-server & | |
fi | |
tomcat-server | |
result1=`ps aux | grep tomcat | grep /Library/Java/JavaVirtualMachines` |
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 -*- |
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
function enable_vim() { document.querySelectorAll(".CodeMirror").forEach(function (e) { e.CodeMirror.setOption("vimMode", true); }); } | |
document.addEventListener('keydown', function(e) { | |
if (e.keyCode == 13 && e.metaKey || e.keyCode == 13 && e.shiftKey) { | |
for (var i = 0; i < 10; i++) setTimeout(enable_vim, 1000 * i); | |
} | |
}); | |
enable_vim(); |