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
#!/bin/sh | |
#kill all exe proc | |
ps -A | grep exe > tmp.txt | |
i=1 | |
while read line | |
do | |
echo Killing `echo $line |awk '{printf("%s\n",$4)}'` | |
kill `echo $line |awk '{printf("%s\n",$1)}'` | |
done < tmp.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
df1 = DataFrame(np.random.randn(10, 4), columns=['a', 'b', 'c', 'd']) | |
mask = df1.applymap(lambda x: x <-0.7) | |
df1 = df1[-mask.any(axis=1)] | |
sLength = len(df1['a']) | |
e = Series(np.random.randn(sLength)) |
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
If you want add to ignore some directories in your local repository (which already exist) after editing .gitignore you want to run this on your root dir | |
``` | |
git rm --cached -r . | |
git add . | |
``` |
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 time | |
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) | |
# >> '2017-07-15 14:39:54' |
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 -*- | |
# Created by frank at 15/07/2017 | |
""" | |
███╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ██████╗ | |
████╗ ██║██╔═══██╗██╔══██╗██║ ██║██╔════╝ | |
██╔██╗ ██║██║ ██║██████╔╝██║ ██║██║ ███╗ | |
██║╚██╗██║██║ ██║██╔══██╗██║ ██║██║ ██║ | |
██║ ╚████║╚██████╔╝██████╔╝╚██████╔╝╚██████╔╝ | |
╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ |
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
[program:service] | |
;directory = ~/su/ ; 程序的启动目录 | |
command = /root/miniconda3/bin/python /root/project/service/run.py ; 启动命令,可以看出与手动在命令行启动的命令是一样的,注意这里home不可用~代替 | |
autostart = true ; 在 supervisord 启动的时候也自动启动 | |
startsecs = 5 ; 启动 5 秒后没有异常退出,就当作已经正常启动了 | |
autorestart = true ; 程序异常退出后自动重启 | |
startretries = 3 ; 启动失败自动重试次数,默认是 3 | |
user = root ; 用哪个用户启动 | |
redirect_stderr = true ; 把 stderr 重定向到 stdout,默认 false | |
stdout_logfile_maxbytes = 20MB ; stdout 日志文件大小,默认 50MB |
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
#!/bin/bash | |
for file in $( ls ); do | |
echo item: $file | |
if [[ ( $file == *.tgz ) || ( $file == *.tar.gz ) ]]; then | |
tar xzvf $file -C /usr/local/ | |
fi | |
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
rsync -rav -e ssh --exclude 'word2vec-1/*' --exclude '.git/*' --exclude '*.pyc' --exclude '*nohup.out*' root@datalab2:~/project/service_test/ ./service/ |
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
vim *.cpp | |
qx # start recording to register x | |
:%s/OldString/NewString/g | |
:wnext | |
q # stop recording | |
@x # playback to see if it works correctly | |
999@x # repeat 999 times to complete the job |
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
_get_module_path = lambda path: os.path.normpath(os.path.join(os.getcwd(), | |
os.path.dirname(__file__), path)) |
OlderNewer