Skip to content

Instantly share code, notes, and snippets.

@Miopas
Miopas / git.sh
Created February 25, 2019 07:27
git command
# store account info
git config --global credential.helper store
@Miopas
Miopas / mvn.sh
Last active February 13, 2019 02:11
mvn command
# 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
@Miopas
Miopas / hadoop.sh
Created February 13, 2019 02:08
hadoop commands
#查看队列任务
hadoop queue -info [username] -showJobs
@Miopas
Miopas / print_chi_str.py
Created January 23, 2019 12:28
python2 print Chinese string
x = '中文测试'
print(x.decode("string_escape"))
@Miopas
Miopas / python3_clear_symbol.py
Created November 16, 2018 02:00
clear various symbol
#coding=utf8
import string
import sys
import re
def conv_wide(char):
#全角转半角
code = ord(char)
if char == '\u3000': #space
code = 32
@Miopas
Miopas / mvn_sbt.sh
Last active November 12, 2018 10:10
mvn/sbt runmain
# 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 &
@Miopas
Miopas / loop.sh
Last active June 30, 2020 21:23
shell for loop
total=10
startFrom=0
for ((i=${startFrom}; i<${startFrom}+$total; i++)); do
echo starting $i of $total ...
done
@Miopas
Miopas / dict_sort.py
Last active February 7, 2020 04:49
python sort dict
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}
@Miopas
Miopas / sed.sh
Created July 31, 2018 02:38
shell 加工数据的简易脚本
# 删除 tmp 文件第一行
sed -i '1d' tmp
# 给 tmp 文件增加一列 '1' 的标签,分隔符为“\t”
cat tmp | awk 'BEGIN{OFS="\t"} {print $0,"1"}'
@Miopas
Miopas / upload.php
Created July 27, 2018 03:28
nginx upload php script
<?php
$header_prefix = 'file';
$slots = 6;
?>
<html>
<head>
<title>Test upload</title>
</head>
<body>
<?php