๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ159

Ruby Development Kit์˜ Rubygem SSL ์ธ์ฆ ๋ฌธ์ œ ๋‹จ์ˆœ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ๊ณตํฌ์˜ SSL ์˜ค๋ฅ˜๋ฅผ ๋˜ ๋งž์ดํ–ˆ๋‹ค. ์ด์ œ๋Š” ์ด ๋ฌธ์ œ ํ•ด๊ฒฐ์˜ ๊ทผ๋ณธ์„ ๊ณ ์น˜๊ณ  ๋‚˜์„œ ์ œ๋Œ€๋กœ ํฌ์ŠคํŒ…์„ ํ•ด์•ผํ•  ๋“ฏ์‹ถ๋‹ค. gem install *** ๊ณผ ๊ฐ™์€ ๊ตฌ๋ฌธ์„ ์‹คํ–‰ํ•˜์ž ๊ณตํฌ์˜ ์—๋Ÿฌ ๋ฌธ๊ตฌ๋“ค์ด ๋‚˜ํƒ€๋‚ฌ๋‹ค. ERROR: SSL verification error at depth 1: self signed certificate in certificate chain (19) ERROR: Root certificate is not trusted (/C=KR/O=Somansa/CN=Somansa Root CA) ์ฐธ๊ณ ๋กœ ์—๋Ÿฌ๋ฉ”์‹œ์ง€์˜ Somansa๋Š” ๊ตญ๋‚ด์˜ ๋ณด์•ˆ์—…์ฒด์ธ๋ฐ, ํ˜„ ํšŒ์‚ฌ๊ฐ€ ์ด ์—…์ฒด๋ฅผ ํ†ตํ•ด ์ธ์ฆ์„œ๋ฅผ ๋ฐœ๊ธ‰๋ฐ›์•„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. Self signed certificate in certificate chain ์ด ๋ฉ”์‹œ.. 2020. 9. 24.
ํŒŒ์ด์ฌ ๋‚ ์งœ-์‹œ๊ฐ„ ์‚ฌ์šฉ๊ณผ ๊ณ„์‚ฐ์— ์œ ์šฉํ•œ datetime ๋ชจ๋“ˆ ํ™œ์šฉ ์˜ˆ์‹œ ๋ชจ์Œ ํŒŒ์ด์ฌ์—์„œ ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ด€๋ฆฌํ•˜๋“  ๋”•์…”๋„ˆ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋“  pandas์™€ ๊ฐ™์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋“  ๋‚ ์งœ ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•  ์ผ์ด ์ œ๋ฒ• ์žˆ๋‹ค. ๋ณธ ํฌ์ŠคํŒ…์—์„œ๋Š” ํ”ํ•˜๊ฒŒ ์‚ฌ์šฉ๋˜๋Š” datetime ๋ชจ๋“ˆ์˜ ์‚ฌ์šฉ ์˜ˆ์‹œ๋“ค์„ ๋…ธํŠธ๋ถ์—์„œ ์ž‘์—…ํ•œ ๋‚ด์—ญ์„ ์ญ‰ ๋ถ™์—ฌ์„œ ๋ณด์—ฌ์คŒ์œผ๋กœ์จ datetime์˜ ๋‹ค์–‘ํ•œ ํ˜•ํƒœ์˜ ํ™œ์šฉ์„ ๋•๊ณ ์ž ํ•œ๋‹ค. datetime๋งค๋‰ด์–ผ์„ ํ†ตํ•ด ๋”์šฑ ์ž์„ธํžˆ ํ™•์ธํ•˜๊ณ  ๋‹ค์–‘ํ•œ ๊ธฐ๋Šฅ์„ ํญ๋„“๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ, ์ฒ˜์Œ ์‚ฌ์šฉํ•˜๋Š” ์‚ฌ์šฉ์ž์˜ ์ž…์žฅ์—์„œ๋Š” ์•„๋ž˜์—์„œ ๋ณด์ธ ์˜ˆ์‹œ๋“ค๋งŒ์œผ๋กœ๋„ ์ถฉ๋ถ„ํžˆ ๋งŽ์€ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฆฌ๋ผ ๋ณธ๋‹ค. datetime ๋ชจ๋“ˆ ์‚ฌ์šฉํ•˜๊ธฐ¶ In [2]: import datetime as dt now()ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ํ˜„์žฌ ์‹œ๊ฐ„ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ¶ In [3]: current_time = dt.datetime.now() In [4.. 2020. 9. 22.
Git Push๋ฅผ ๊ท€์ฐฎ๊ฒŒ ๋งŒ๋“œ๋Š” ์—๋Ÿฌ ํ•ด๊ฒฐ: Enter passphrase for key '~/.ssh/id_rsa' ๋ฌธ์ œ์™€ Could not open a connection to your authentication agent. ๋ฌธ์ œ ๋‘˜๋‹ค ํ•ด๊ฒฐํ•˜๊ธฐ ์–ธ์  ๊ฐ€๋ถ€ํ„ฐ https๋กœ git repository๋กœ๋ถ€ํ„ฐ ์†Œ์Šค๋ฅผ ๋ฐ›์„ ๋•Œ ์ž๊พธ ๊ณ„์ • ํ™•์ธ์ด ๋œจ๋Š”๊ฒŒ ๊ท€์ฐฎ์•˜๋‹ค. ๊ทธ๋ž˜์„œ ssh key๋“ฑ๋ก์„ ํ•˜๊ณ  ํ•œ๋ฒˆ ๊ท€์ฐฎ์Œ์„ ๊ฐ์ˆ˜ํ•˜๊ณ  ๊ณ„์† ํŽธํ•˜๊ฒŒ ํ•˜๋ ค๊ณ  ssh ์„ค์ •์„ ๊ฐํ–‰ํ–ˆ๋‹ค. git push์‹œ ์ž๋™ ๋กœ๊ทธ์ธ ์„ค์ • - username, password๊ทธ๋งŒ ์ž…๋ ฅํ•˜์ž github respository์— git push -u origin master ๋ฅผ ํ–ˆ์„ ๋•Œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ž๊พธ ๋กœ๊ทธ์ธ์„ ์š”์ฒญํ•˜๋Š” ๊ฒฝ์šฐ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ์ •๋ฆฌ. repository์ฃผ์†Œ๋ฅผ https ๋กœ ๋ฐ›์•„์„œ ์ฒ˜๋ฆฌํ•˜๋˜ ๊ฒฝ์šฐ์— ํ”„๋กœํ† ์ฝœ์„ ssh ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค.. gentlesark.tistory.com ํ•จ๊ป˜๋ณด๋ฉด ์ข‹์€ ๊ธ€ ๊ทธ๋Ÿฐ๋ฐ ์–ด์ฉ ์ผ์ธ์ง€ ์ž‘์—…ํ•˜๋Š” ์ปดํ“จํ„ฐ ์ค‘ ํ•œ ๋†ˆ์€ ์ง€์†์ ์œผ๋กœ ์•„๋ž˜์˜ ๋ฉ”์‹œ์ง€๋ฅผ ๋ฑ‰๋Š” ๊ฒƒ์ด ์•„๋‹Œ๊ฐ€? (์ฐธ๊ณ .. 2020. 9. 11.
Windowsํ™˜๊ฒฝ์—์„œ Python mysql ์ ‘์† ๋ฌธ์ œ ํ•ด๊ฒฐ (Alchemy, MySQLdb ์‚ฌ์šฉ์‹œ) ์ด๋ฒˆ ๊ฒฝ์šฐ๋Š” ์•„๋ž˜์˜ ์ฝ”๋“œ์ฒ˜๋Ÿผ pandas์˜ DataFrame๊ฐ์ฒด๋ฅผ mysql db์— ์‚ฝ์ž…ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋ฐœ์ƒํ•œ ์—๋Ÿฌ์˜€๋‹ค. engine = create_engine('mysql+mysqlconnector://'+MYSQL_USER+':'+MYSQL_PASSWORD+'@'+MYSQL_HOST_IP+':'+MYSQL_PORT+'/'+MYSQL_DATABASE, echo=False) df = pd.read_csv("./test.csv") with engine.connect() as conn, conn.begin(): df.to_sql('Table1', conn, if_exists='replace') ์—๋Ÿฌ ๋‚ด์šฉ์€ ๊ฐœ๋žต์ ์œผ๋กœ ์•„๋ž˜์™€ ๊ฐ™๋‹ค. MySQLdb._exceptions.OperationalError: (2059.. 2020. 9. 3.
Python ๋ฆฌ์ŠคํŠธ(list) csv ํŒŒ์ผ๋กœ ์ฝ๊ณ  ์“ฐ๊ธฐ(๋ถˆ๋Ÿฌ์˜ค๊ธฐ, ์ €์žฅํ•˜๊ธฐ) ๋”ฅ๋Ÿฌ๋‹ ๋“ฑ AI๊ด€๋ จ ์ž‘์—…์„ ํ•˜๋‹ค๋ณด๋ฉด csv๋ฅผ ๊ฐ€์ ธ์™€์„œ ์—ด๊ณ  ์ž‘์—…์„ ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์ œ๋ฒ• ๋งŽ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ, ๋ง‰์ƒ ์ง์ ‘ ๋งŒ๋“  ์ฝ”๋“œ์—์„œcsv๋ฅผ ๋ฝ‘์•„๋‚ด๊ณ  ๊ทธ ํŒŒ์ผ์„ ๋ถˆ๋Ÿฌ๋“ค์ด๋ ค๋‹ค ๋ณด๋ฉด ์ฝ”๋“œ ์ž‘์„ฑ์ด ํ—ท๊ฐˆ๋ฆด ๋•Œ๊ฐ€ ์žˆ๋”ฐ. ๊ทธ๋ž˜์„œ ํŠน์ • ์˜ˆ์ œ๋ฅผ ๋งŒ๋“ค์–ด csvํŒŒ์ผ์„ ์ฝ๋Š” ๊ณผ์ •๊ณผ ์“ฐ๋Š” ๊ณผ์ •์„ ๊ฐ๊ฐ ๋ณด์ด๋„๋ก ํ•˜๊ฒ ๋‹ค. Python ๋ฆฌ์ŠคํŠธ csv๋กœ ์ €์žฅํ•˜๊ธฐ ํŒŒ์ด์ฌ ๋ชจ๋“ˆ์ธ csv ๋ชจ๋“ˆ์„ importํ•˜๊ณ  ๋ฐ์ดํ„ฐ๋Š” ๋‚ ์งœ ๋ฐ์ดํ„ฐ, ์ •์ˆ˜ ๋ฐ์ดํ„ฐ, ๋ถ€๋™์†Œ์ˆ˜์  ์ž๋ฃŒํ˜• ๋ฐ์ดํ„ฐ๊ฐ€ ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ–ˆ๋‹ค. ์—‘์…€๋กœ ๊ทธ๋ฆฐ๋‹ค๋ฉด ์—ด ๋ฐฉํ–ฅ์œผ๋กœ ๊ทธ๋ฆด ๊ฒƒ ๊ฐ™์ง€๋งŒ, ํŒŒ์ด์ฌ ๋ฆฌ์ŠคํŠธ๋กœ ํ‘œํ˜„ํ•˜์—ฌ ํ–‰ ๋ฐฉํ–ฅ์œผ๋กœ ๋‚˜์—ด๋˜์—ˆ๋‹ค. # csv ๋ชจ๋“ˆ importํ•˜๊ธฐ import csv # list ๋งŒ๋“ค๊ธฐ date = ['200801','200802','200803','200804','20080.. 2020. 8. 7.
Python์œผ๋กœ ์‹ค์‹œ๊ฐ„ ๋กœ๊ทธ ํŒŒ์ผ ๋ชจ๋‹ˆํ„ฐ๋ง ์ฝ”๋“œ ๊ตฌํ˜„ ํŒŒ์ด์ฌ(Python)์œผ๋กœ ์‹ค์‹œ๊ฐ„(real-time) ๋กœ๊ทธ(log) ํŒŒ์ผ ๋ชจ๋‹ˆํ„ฐ๋ง(monitoring) ์ฝ”๋“œ ๊ตฌํ˜„ Python์œผ๋กœ ํ”„๋กœ๊ทธ๋žจ์„ ๊ตฌํ˜„ํ•  ๋•Œ ๊ณ„์†ํ•ด์„œ ๋กœ๊ทธ๋ฅผ ์ฐ๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. ์ด ๋•Œ ๋˜ ๋‹ค๋ฅธ ํ”„๋กœ๊ทธ๋žจ์€ ์ฐํžˆ๋Š” ๋กœ๊ทธ๋ฅผ ๊ณ„์†ํ•ด์„œ ๋ชจ๋‹ˆํ„ฐ๋งํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ๊ตฌํ˜„ํ•ด์•ผ ํ•  ๋•Œ๊ฐ€ ์žˆ๋‹ค. ์˜ˆ๋ฅผ๋“ค์–ด ๊ณ ์„ฑ๋Šฅ HPC์—์„œ ์ž‘์—…์„ ๋Œ๋ฆฌ๊ณ  ํ•ด๋‹น PC์—์„œ logํŒŒ์ผ์„ ์ถœ๋ ฅํ•˜๊ณ  ์žˆ๋Š”๋ฐ, ํด๋ผ์ด์–ธํŠธ ์žฅ๋น„์ธ ๋‚ด ์ปดํ“จํ„ฐ์—์„œ ํ•ด๋‹น logํŒŒ์ผ์„ ์‹ค์‹œ๊ฐ„์œผ๋กœ ๋ชจ๋‹ˆํ„ฐ๋งํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์ด๋Ÿฐ ๊ฒฝ์šฐ๊ฐ€ ๋˜๊ฒ ๋‹ค. ๋จผ์ € ๋กœ๊ทธํŒŒ์ผ์„ ์ฐ๋Š” ์˜ˆ์‹œ์ฝ”๋“œ์ด๋‹ค. logging.py with open("log.txt", "w") as f: for i in range(100): text = "I love sark. %d\n" % i print(text, .. 2020. 7. 30.
Python format ํ•จ์ˆ˜ ์‚ฌ์šฉ์‹œ ์•ˆ์— ๊ด„ํ˜ธ ๋„ฃ๊ธฐ - ํŒŒ์ด์ฌ ๊ฟ€ํŒ Python formatํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ต‰์žฅํžˆ ํŽธํ•˜๊ฒŒ ๋‹ค์–‘ํ•œ ๋ณ€์ˆ˜๋ฅผ ์ž…๋ ฅํ•  ์ˆ˜ ์žˆ๋‹ค. ์•„๋ž˜์˜ ์˜ˆ์ฒ˜๋Ÿผ { } ์ค‘๊ด„ํ˜ธ ํ‘œ์‹œ์™€ ๊ด„ํ˜ธ ์•ˆ์— :์ „์ฒด์ž๋ฆฌ์ˆ˜.์†Œ์ˆ˜์ ์ž๋ฆฌ์ˆ˜+์˜ต์…˜ ํ˜•ํƒœ๋กœ ํŽธํ•˜๊ฒŒ string์„ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค. homepath = '/home/sark/dev/python/test' this_job = 3 num_job = 10 progress = this_job/num_job job_status = "Running" print(("Path:{}, Job({}/{}), Progress:{:4.2%}, Status:{}") .format(homepath,this_job,num_job,progress,job_status)) ์ถœ๋ ฅ๊ฒฐ๊ณผ Path:/home/sark/dev/python/test, Job(.. 2020. 7. 27.
์ž๋ฐ”(Java) ๋ฒ„์ „ ํ™•์ธ ๋ฐ ๊ธฐ๋ณธ์œผ๋กœ ์‚ฌ์šฉํ•  Java ๋ฒ„์ „ ๋ณ€๊ฒฝํ•˜๊ธฐ(JDK ์—ฌ๋Ÿฌ๊ฐœ ์‚ฌ์šฉ์‹œ) ๋ฆฌ๋ˆ…์Šค(Linux)์—์„œ ์ž๋ฐ”(Java) ๊ฒฝ๋กœ๋ฅผ ๋จผ์ € ํ™•์ธํ•˜๊ณ ์ž ํ•œ๋‹ค๋ฉด, ์•„๋ž˜์˜ ๊ธ€์„ ์ฝ์–ด๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค! ์šฐ๋ถ„ํˆฌ(Ubuntu)์—์„œ ์ž๋ฐ”(Java) ๊ฒฝ๋กœ(path) ์ฐพ๊ธฐ ๊ฐ€๋” ์šฐ๋ถ„ํˆฌ์—์„œ ์ž‘์—…ํ•˜๋‹ค ๋ณด๋ฉด, ๋‚ด๊ฐ€ ์ž๋ฐ”๋ฅผ ๋”ฐ๋กœ ์••์ถ•ํŒŒ์ผ์„ ๋ฐ›์•„์„œ ์„ค์น˜ํ–ˆ๋Š”์ง€ apt-get ๋ช…๋ น์–ด๋กœ ์„ค์น˜ํ–ˆ๋Š”์ง€๋„ ํ—ท๊ฐˆ๋ฆด ๋•Œ๊ฐ€ ์žˆ๋‹ค. (feat.๊ธฐ์–ต๋ ฅ ๊ฐํ‡ด) ์ด์— ์„ค์น˜๋œ ์ž๋ฐ” ๊ฒฝ๋กœ๋ฅผ ์ฐพ๋Š” ๋‘๊ฐ€์ง€ ๋ฐฉ๋ฒ• gentlesark.tistory.com Java ๋ฒ„์ „์„ ํ™•์ธํ•˜๋Š” ๋ช…๋ น์–ด๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค. java -version openjdk version "1.8.0_252" OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09) OpenJDK 64-Bit Server VM (bui.. 2020. 7. 17.
์šฐ๋ถ„ํˆฌ(Ubuntu) 16 ์—์„œ 18๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ๊ฐ€ ์•ˆ ๋  ๋•Œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ์–ด๋Š ๋‚ ์ธ๊ฐ€๋ถ€ํ„ฐ ์ง€์†์ ์œผ๋กœ Ubuntu 18๋กœ ์—…๋ฐ์ดํŠธํ•˜๋ผ๋Š” ๋ฉ”์‹œ์ง€๊ฐ€ ๋–ด๋Š”๋ฐ, OK ์•Œ๊ฒ ์–ด ํ•˜๊ณ  ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ๋„ ๋ฐ˜์‘์ด ์—†๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์•˜๋‹ค. ์—ฌ๋Ÿฌ๋ฒˆ ๋ฐ˜๋ณต๋˜๋‹ˆ '์ด๊ฑด ํ„ฐ๋ฏธ๋„์—์„œ ํ•ด๊ฒฐํ•ด์•ผํ•  ๋ฌธ์ œ๊ฒ ๊ตฐ'ํ•˜๋ฉฐ ํ„ฐ๋ฏธ๋„์—์„œ ์ด๋ž˜์ €๋ž˜ ๋งŒ์ ธ๋ดค๋Š”๋ฐ, ์ž˜๋˜์ง€ ์•Š๋‹ค๊ฐ€ ๊ฒฐ๊ตญ์€ ์—…๊ทธ๋ ˆ์ด๋“œ๋ฅผ ํ•˜๊ฒŒ ๋˜์–ด ๊ธฐ์œ ๋งˆ์Œ์œผ๋กœ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ๊ณต์œ ํ•œ๋‹ค. ๋ณธ ๊ฒฝ์šฐ๋Š” Ubuntu 16.04 LTS์—์„œ 18.04 LTS๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ ํ•œ ํ›„๊ธฐ์ด๋‹ค. LTS๋Š” Long-Term Support๋กœ ์˜ค๋žœ๊ธฐ๊ฐ„ ์œ ์ง€๋ณด์ˆ˜๊ฐ€ ๋˜๋Š” ์•ˆ์ •ํ™”๋œ ๋ฒ„์ „์„ ๋œปํ•œ๋‹ค. ๋ฌธ์ œ๋Š” ํฌ๊ฒŒ ๋‹ค์Œ์˜ ๋‘๊ฐ€์ง€ ๋ฐฉ์‹์œผ๋กœ ๋‚˜ํƒ€๋‚  ๊ฒƒ์ด๋‹ค. ๋จผ์ € ์—…๊ทธ๋ ˆ์ด๋“œ๋ฅผ ํ•˜๊ธฐ ์ „์— ๋‹ค์Œ์˜ ๋ช…๋ น์–ด๋“ค์„ ์ž…๋ ฅํ•ด๋ณด์ž. sudo apt update sudo apt upgrade sudo apt dist-upgrade sudo.. 2020. 7. 17.