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=utf8 | |
import string | |
import sys | |
import re | |
def conv_wide(char): | |
#全角转半角 | |
code = ord(char) | |
if char == '\u3000': #space | |
code = 32 |
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
x = '中文测试' | |
print(x.decode("string_escape")) |
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
#查看队列任务 | |
hadoop queue -info [username] -showJobs |
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
# run specific test case | |
mvn -Dtest=TestCircle test | |
# mvn spring boot | |
mvn clean install && cd ./xx-web && mvn spring-boot:run | |
# run with specific setting file | |
mvn clean intall --settings mysetting.xml |
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
# store account info | |
git config --global credential.helper store |
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
./cypher-shell -a bolt://localhost:1688 -u neo4j -p work "match(n)-[r]->(m) return n, r, m limit 10;" >/tmp/a.txt |
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
# train | |
import logging | |
import os | |
from gensim.models import word2vec | |
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) | |
sentences = word2vec.LineSentence('/path/to/your/data') | |
model = word2vec.Word2Vec(sentences, |
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
# reference: https://stackoverflow.com/questions/2087370/decode-html-entities-in-python-string | |
from bs4 import BeautifulSoup | |
BeautifulSoup("<p>£682m</p>") | |
# output is like: | |
# <html><body><p>£682m</p></body></html> | |
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
{ | |
"Ansi 5 Color" : { | |
"Green Component" : 0.10802463442087173, | |
"Red Component" : 0.77738940715789795, | |
"Blue Component" : 0.43516635894775391 | |
}, | |
"Tags" : [ | |
], | |
"Ansi 12 Color" : { |
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
# word count | |
cat result | awk -F"\t" '{key=$1"\t"$2; c[key]++} END {for (i in c) print c[i],i}' | |
# sum, count, mean, median, min, max | |
# credit:https://unix.stackexchange.com/questions/13731/is-there-a-way-to-get-the-min-max-median-and-average-of-a-list-of-numbers-in | |
#!/bin/sh | |
cat test.txt | sort -n | awk ' | |
BEGIN { | |
c = 0; | |
sum = 0; |