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
# (scp_aa.sh)-i : private key 지정. -P : port 지정. | |
scp -i ~/.ssh/id_rsa_xxx -P 1026 root@host.name.fqdn:/from/path /to/path | |
# rsync | |
rsync -avh --delete -e ssh $SRC:$DIR/ $DIR >> $LOG_FILE | |
# (quark_setting.sh) mkdir -p = 이미 있으면 무시, 없으면 parent까지 생성. | |
mkdir -p /path/to/make | |
# jq = json 파싱. '.token' = token의 value만 출력. https://stedolan.github.io/jq/tutorial/ |
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
# POST 요청으로 login 후에 결과 cookie 저장. | |
# 아래 요청은 파라메터를 STDID(-)으로 입력하게 된다. | |
$ curl -X POST -c cookies.txt -d "@-" http://xxx.xx/login | |
username=xxx&password=yyy | |
<ctrl+D> | |
# 위와 같이 저장한 쿠키를 이용해서(-b) 요청을 하게 되고, 그 결과를 다시 저장(-c)한다. | |
$ curl -b cookies.txt -c cookies.txt http://xxx.yyy/abcd |
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 | |
from_dt=${$1:-2018-03-01} | |
end_dt=${$2:-2018-03-08} | |
dt_arr=(01 08 15 22) | |
for m in $(seq -f "%02g" 3 12) | |
do | |
for d in ${dt_arr[*]} |
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
# (비추) 파일명에 띄어쓰기가 있는 경우를 처리하기 위해서 "-print0", "-0" 옵션이 들어감. | |
find . -name config.xml -print0 | xargs -0 grep "Job_DoSomething" | |
# (추천) 아래와 같이 개행문자(\n)를 delimiter로 지정해서 파일명에 있는 띄어쓰기 문제를 해결할 수도 있음. | |
find . -name config.xml | xargs '-d\n' grep "Job_DoSomething" |
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
-- 특수문자만 있는 케이스 제거 | |
query not rlike '\'\"`^[0-9!@#$%^&*()=+_.,?/-]*$' | |
-- 구두점이나 숫자, 자모 만으로 구성된 케이스 제거 | |
query not rlike '[\p{Digit}\p{Punct}\p{Space}\u3131-\u318E]+' | |
-- hivevar vs hiveconf : prefer hivevar | |
hive --hivevar a='this is a' -e '!echo ${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
$ ldconfig -p | grep cudnn | |
libcudnn.so.7 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcudnn.so.7 |
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
from https://unix.stackexchange.com/a/29811 | |
Using su without -l or - starts bash as an interactive, but non-login shell, which doesn't read from either of the files you specified. Use the -l or - option or put the relevant config into /root/.bashrc. | |
Quick summary of config files: | |
* Login shell (-l/--login) reads /etc/profile first, and then the first it finds of: ~/.bash_profile, ~/.bash_login, and ~/.profile. | |
* Interactive but non-login shell (-i) reads /etc/bash.bashrc and ~/.bashrc, in that order (unless the --rcfile option is used and tells it to look elsewhere). | |
* Non-interactive shells, e.g. started from within another program without using the -l or -i flags, reads the file specified in the BASH_ENV environment variable. | |
* When run as sh as a login shell, it will read /etc/profile and ~/.profile, in that order. |
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
# python의 "param1"과 "param2" 변수를 bash 스크립트에서 각각 $1과 $2로 사용할 수 있게 해준다. | |
%%bash -s $param1 $param2 | |
echo $1 $2 | |
## debugging | |
* cheatsheet : https://appletree.or.kr/quick_reference_cards/Python/Python%20Debugger%20Cheatsheet.pdf | |
``` | |
with open( base_dir + pred_filename, "r", encoding="utf-8") as f: | |
pred_data = f.read().split('\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
# 1: 한글을 그냥 써보면 박스만 그려짐. | |
import matplotlib.pyplot as plt | |
plt.text(0.5, 0.5, ['한글', 'test']) | |
plt.show() | |
# 2: 아래와 같이 설정해주면 한글이 잘 동작함. | |
# ㄴ 시스템에 install이 잘 되어 있다면 mpl.rcParams[] 설정만 하면 되는데, docker에 띄운 jupyter에서는 왠지 apt-get으로 설치한 font를 인식하지 못한다. | |
import matplotlib as mpl | |
import matplotlib.font_manager as fm |