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 sys | |
import urllib.parse | |
import traceback | |
keyword = '测试' | |
try: | |
url = "http:/127.0.0.1:8983/solr/demo/query?q=titile_t:" + urllib.parse.quote(keyword, "utf-8") | |
print(url) | |
except: |
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
-partitioner org.apache.hadoop.mapred.lib.KeyFieldBasedPartitioner \ | |
-jobconf stream.num.map.output.key.fields=2 \ | |
-jobconf num.key.fields.for.partition=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
source ~/.bashrc | |
input=*** | |
output=*** | |
hadoop fs -rmr ${output} | |
$HADOOP_HOME/bin/hadoop jar $HADOOP_STREAMING \ | |
-D mapred.reduce.tasks=100 \ | |
-D mapred.job.name="zip" \ | |
-D mapred.job.priority=VERY_HIGH \ | |
-D mapred.map.max.attempts="1" \ | |
-D mapreduce.output.fileoutputformat.compress=true \ |
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
insert overwrite directory "/tmp/out/" | |
row format delimited fields terminated by "\t" | |
select user, login_time from user_login; |
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
1. Vim 去掉 ^M 字符 | |
单个文件: | |
``` | |
%s/^M//g | |
``` | |
(^M是ctrl+v,ctrl+m) |
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
<?php | |
$header_prefix = 'file'; | |
$slots = 6; | |
?> | |
<html> | |
<head> | |
<title>Test upload</title> | |
</head> | |
<body> | |
<?php |
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
# 删除 tmp 文件第一行 | |
sed -i '1d' tmp | |
# 给 tmp 文件增加一列 '1' 的标签,分隔符为“\t” | |
cat tmp | awk 'BEGIN{OFS="\t"} {print $0,"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 pprint | |
class data: | |
def __init__(self, name, value): | |
self.name = name | |
self.value = value | |
a = data('a', 2) | |
b = data('b', 3) | |
c = data('c', 1) | |
mydict = {'keyOfA':a, 'keyOfB':b, 'keyOfC':c} |
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
total=10 | |
startFrom=0 | |
for ((i=${startFrom}; i<${startFrom}+$total; i++)); do | |
echo starting $i of $total ... | |
done |
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
# mvn run main | |
# 网上的例子给的是:mvn exec:java -D"exec.mainClass"="com.example.Main",但是我这边是去掉 Main 才能跑通 | |
mvn exec:java -D"exec.mainClass"="com.example" | |
# sbt run main (background) | |
setsid nohup sbt -mem 2048 "runMain example.YourClassName ${dataSet} ${normOutput}" > norm.log & |