[git]

git config --global http.sslVerify false

 

[system]

sudo trust anchor --store ~/my-ca-cert.crt

 

[python]

import ssl

ssl._create_default_https_context = ssl._create_unverified_context

#!/bin/bash
#
# Copyright (c) 2018, NVIDIA CORPORATION.  All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.
#

if [ "$#" -ne 1 ]; then
    echo "Usage: $0 <Install Folder>"
    exit
fi
folder="$1"
user="nvidia"
passwd="nvidia"

echo "** Install requirement"
sudo apt-get update
sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy
sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp
sudo apt-get install -y curl
sudo apt-get update

echo "** Download opencv-4.0.0"
cd $folder
curl -L https://github.com/opencv/opencv/archive/4.0.0.zip -o opencv-4.0.0.zip
curl -L https://github.com/opencv/opencv_contrib/archive/4.0.0.zip -o opencv_contrib-4.0.0.zip
unzip opencv-4.0.0.zip 
unzip opencv_contrib-4.0.0.zip 
cd opencv-4.0.0/

echo "** Building..."
mkdir release
cd release/
cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.0.0/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j3
sudo make install
sudo apt-get install -y python-opencv python3-opencv

echo "** Install opencv-4.0.0 successfully"
echo "** Bye :)"โ€‹
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
sudo reboot
sudo apt-get install build-essential git cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libatlas-base-dev gfortran
cd ~
git clone https://github.com/Itseez/opencv.git
cd opencv
git checkout 3.1.0
cd ~
git clone https://github.com/Itseez/opencv_contrib.git
cd opencv_contrib
git checkout 3.1.0
sudo apt-get install python3-dev
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
pip install numpy
cd ~/opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
      -D WITH_CUDA=ON \
      -D CUDA_ARCH_BIN=${ARCH_BIN} \
      -D CUDA_ARCH_PTX="" \
      -D ENABLE_FAST_MATH=ON \
      -D CUDA_FAST_MATH=ON \
      -D WITH_CUBLAS=ON \
      -D WITH_LIBV4L=ON \
      -D WITH_GSTREAMER=ON \
      -D WITH_GSTREAMER_0_10=OFF \
      -D WITH_QT=ON \
      -D WITH_OPENGL=ON \
      -D OPENCV_EXTRA_MODULES_PATH=/home/nvidia/Research/opencv_contrib/modules \
      -D BUILD_opencv_legacy=OFF \
      ../
make -j4
sudo make install
sudo ldconfig

 

์ตœ๊ทผ Kakao์—์„œ Khaiii๋ฅผ ๋ฐœํ‘œํ•ด์„œ ์กฐ๊ธˆ ์ธ๊ธฐ๊ฐ€ ์•ฝํ•ด์ง€๊ธด ํ–ˆ์ง€๋งŒ, ์—ฌ์ „ํžˆ Khaiii์™€ ๋งž๋จน๋Š” ์„ฑ๋Šฅ์„ ๋ณด์—ฌ์ฃผ๋Š” mecab์„ค์น˜๋ฅผ ์ง„ํ–‰ํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

1. ์šฐ์„  mecab ํ™ˆํŽ˜์ด์ง€์—์„œ ์ตœ์‹  ๋ฒ„์ „์„ ๋‹ค์šด๋กœ๋“œ ํ•ฉ๋‹ˆ๋‹ค. 

    ํ˜„์žฌ๋Š” mecab-0.996-ko-0.9.2.tar.gz ์ด ํŒŒ์ผ์ด ์ตœ์‹ ์ด๋„ค์š”.

 

https://bitbucket.org/eunjeon/mecab-ko/downloads/

 

eunjeon / mecab-ko / Downloads — Bitbucket

 

bitbucket.org

2. ํŒŒ์ผ์„ ๋‹ค์šด๋ฐ›์•„์„œ ํŠน์ • ๋””๋ ‰ํ† ๋ฆฌ์— ์ €์žฅ ํ•˜๊ณ  ์••์ถ•์„ ํ’€์–ด ์ค๋‹ˆ๋‹ค.

tar -zxvf mecab-*-ko-*.tar.gz

3. ํ•ด๋‹น ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•˜์—ฌ configure/make/make install ์„ ์ง„ํ–‰ ํ•ฉ๋‹ˆ๋‹ค.

cd mecab-0.996-ko-0.9.2
./configure
make
make check
sudo make install

4. ์„ค์น˜ ๋ฒ„์ „์„ ํ™•์ธํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒ ํ•ฉ๋‹ˆ๋‹ค.

mecab --version

5. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋กœ๋”ฉํ•ด์ฃผ๊ณ  ๋‹ค์‹œ ๋ฒ„์ „์„ ํ™•์ธํ•˜๋ฉด ์ •์ƒ์ ์œผ๋กœ ํ‘œ์‹œ ๋ฉ๋‹ˆ๋‹ค.

sudo ldconfig
mecab --version

** ์ด ๋ฐฉ๋ฒ• ์™ธ์— ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ํ•œ๋ฒˆ์— ์„ค์น˜ ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

pip install python-mecab-ko

 

6. ๋‹ค์Œ์€ ํ•œ๊ตญ์–ด ์‚ฌ์ „์„ ์„ค์น˜ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

์šฐ์„  ์‚ฌ์ „์˜ ์ตœ์‹  ๋ฒ„์ „์„ ๋‹ค์šด๋ฐ›์•„ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์••์ถ•์„ ํ’€์–ด ์ค๋‹ˆ๋‹ค.

ํ˜„์žฌ์˜ ์ตœ์‹  ๋ฒ„์ „์€ mecab-ko-dic-2.1.1-20180720.tar.gz ์ด๊ตฐ์š”.

https://bitbucket.org/eunjeon/mecab-ko-dic/downloads/

tar -zxvf mecab-ko-dic-2.1.1-20180720.tar.gz
 

eunjeon / mecab-ko-dic / Downloads — Bitbucket

 

bitbucket.org

 

7. ์••์ถ•์„ ํ‘ผ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•˜์—ฌ make๋ฅผ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

cd mecab-ko-dic-2.1.1-20180720
./configure
make
sudo make install

8. ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ด…๋‹ˆ๋‹ค. Khaiii์ฒ˜๋Ÿผ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•œ ํ›„ ๋ถ„์„ํ•˜๊ณ ์ž ํ•˜๋Š” ๋ฌธ์žฅ์„ ์ž…๋ ฅํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

mecab -d /usr/local/lib/mecab/dic/mecab-ko-dic

์„ค์น˜๊ฐ€ ์ž˜ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

 

9. Python์—์„œ ์ž˜ ๋˜๋Š”์ง€ ํ…Œ์ŠคํŠธ ํ•ด ๋ด…๋‹ˆ๋‹ค.

import mecab
mecab = mecab.MeCab()

mecab.morphs('์˜๋“ฑํฌ๊ตฌ์ฒญ์—ญ์— ์žˆ๋Š” ๋ง›์ง‘ ์ข€ ์•Œ๋ ค์ฃผ์„ธ์š”.')
# ['์˜๋“ฑํฌ๊ตฌ์ฒญ์—ญ', '์—', '์žˆ', '๋Š”', '๋ง›์ง‘', '์ข€', '์•Œ๋ ค', '์ฃผ', '์„ธ์š”', '.']

 

์ด์ƒ์œผ๋กœ ๋งˆ์น˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์ตœ๊ทผ์—...๊ตฌ๊ธ€์—์„œ ๋ฐœํ‘œํ•œ BERT์—ดํ’์ด ์žฅ๋‚œ์ด ์•„๋‹™๋‹ˆ๋‹ค.

๊ฒŒ๋‹ค๊ฐ€ LG CNS์—์„œ SQuaD ๋ฐ์ดํ„ฐ์…‹์„ ํ•œ๊ธ€๋กœ ๋Œ€์ฒด ํ•  ์ˆ˜ ์žˆ๋Š” KorQuAD ๋ฐ Leader Board๋ฅผ ์ œ๊ณตํ•ด์ฃผ์–ด์„œ,

๊ตญ๋‚ด ์œ ์ˆ˜์˜ AI ๊ฐœ๋ฐœํŒ€์ด ๋งŽ์ด ์ฐธ์—ฌ๋ฅผ ํ–ˆ๋˜ ์—ดํ’์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

 

BERT์— ๋Œ€ํ•ด ๊ถ๊ธˆํ•˜์‹œ๋ฉด ์•„๋ž˜ ๊ธฐ์‚ฌ๋ฅผ ์ฝ์–ด๋ณด์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

http://www.aitimes.kr/news/articleView.html?idxno=13117

 

์ „, ๋ฆฌ๋”๋ณด๋“œ์— 3๋“ฑ๊นŒ์ง€๋ฐ–์— ์—†๋˜ ์‹œ์ ˆ์— BERT๋ฅผ ์ด์šฉํ•ด์„œ 4๋“ฑ์ด๋ผ๋„ ํ•ด๋ณด์ž ๋ผ๊ณ  ํ–ˆ๋‹ค๊ฐ€...

ํ”„๋กœ์ ํŠธ๋•Œ๋ฌธ์—, ๋ฏธ๋ฃจ๋‹ค, ์ง€๊ธˆ์€ ๊ฐ„์‹ ํžˆ 22๋“ฑ์— ๋จธ๋ฌผ๋ €๋„ค์š”.

https://korquad.github.io/

 

KorQuAD

desktop_mac Getting Started KorQuAD๋Š” ํ•œ๊ตญ์–ด Machine Reading Comprehension์„ ์œ„ํ•ด ๋งŒ๋“  dataset์ž…๋‹ˆ๋‹ค. ๋ชจ๋“  ์งˆ์˜์— ๋Œ€ํ•œ ๋‹ต๋ณ€์€ ํ•ด๋‹น Wikipedia ์•„ํ‹ฐํด ๋ฌธ๋‹จ์˜ ์ผ๋ถ€ ํ•˜์œ„ ์˜์—ญ์œผ๋กœ ์ด๋ฃจ์–ด์ง‘๋‹ˆ๋‹ค. Stanford Question Answering Dataset(SQuAD) v1.0๊ณผ ๋™์ผํ•œ ๋ฐฉ์‹์œผ๋กœ ๊ตฌ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ „์ฒด ๋ฐ์ดํ„ฐ๋Š” 1,560 ๊ฐœ์˜ Wikipedia article์— ๋Œ€ํ•ด 10,645

korquad.github.io

(๊ธ€์„ ์“ฐ๋Š” ๋„์ค‘์— ๋ณด๋‹ˆ 23๋“ฑ์œผ๋กœ ๋ฐ€๋ ธ๋„ค์š”...ใ… ใ… )

 

์ด๋ฒˆ์—, ์ถ”๊ฐ€์ ์œผ๋กœ ํ•ด๋ณผ ์ˆ˜ ์žˆ๋Š” ์•„์ด๋””์–ด๋ฅผ ์–ป์–ด, KorQuAD์˜ ๋ฆฌ๋”๋ณด๋“œ ์ˆœ์œ„๋ฅผ ๋†’์—ฌ๋ณด๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.

 

๊ทธ์ค‘ ํ•˜๋‚˜์˜ ๋ฐฉ๋ฒ•์ด default๋กœ ์„ค์ •๋˜์–ด ์žˆ๋Š” BERT์˜ multilingual tokenizer๋ฅผ ๋Œ€์ฒด ํ•˜๋Š” ๊ฒƒ ์ž…๋‹ˆ๋‹ค.

ํ•œ๊ตญ์–ด์˜ ๊ธฐ์กด ํ˜•ํƒœ์†Œ ๋ถ„์„๊ธฐ๋Š” konlpy, mecab๋“ฑ ์—ฌ๋Ÿฌ๊ฐ€์ง€๊ฐ€ ์žˆ๋Š”๋ฐ ์นด์นด์˜ค์—์„œ Khaiii๋ผ๋Š” ํ˜•ํƒœ์†Œ ๋ถ„์„๊ธฐ๋ฅผ ๋ฐœํ‘œํ–ˆ์Šต๋‹ˆ๋‹ค.

Khaiii๋Š” ๋”ฅ๋Ÿฌ๋‹(CNN)๊ธฐ๋ฐ˜์˜ ํ˜•ํƒœ์†Œ ๋ถ„์„๊ธฐ ์ธ๋ฐ, ๊ธฐ์กด์— ์„ฑ๋Šฅ์ด ๋†’๋˜ Mecab๊ณผ ๋™์ผํ•˜๊ฑฐ๋‚˜ ์ข€ ๋” ๋‚˜์€ ์„ฑ๋Šฅ์„ ๋‚ด๋Š” ๊ฒƒ์œผ๋กœ ์•Œ๋ ค์ ธ ์žˆ์Šต๋‹ˆ๋‹ค.

 

๋•Œ๋ฌธ์—, ์šฐ์„  Khaiii๋ฅผ ์„ค์น˜ํ•˜๋Š” ๋ฒ•์„ ๊ธฐ๋กํ•˜๋ฉฐ ์ง„ํ–‰ํ•˜๋ ค๊ณ  ํ•˜๋Š”๋ฐ, 

์ง€๊ธˆ ํ™˜๊ฒฝ์ด Linux์ด๋‹ค ๋ณด๋‹ˆ, Linux ํ™˜๊ฒฝ ์œ„์ฃผ๋กœ ์ง„ํ–‰์„ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

์šฐ์„  ๊ธฐ๋ณธ ๋นŒ๋“œ ํ™˜๊ฒฝ์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Ubuntu(Mint Linux) 18.04

Python 3.6

gcc 7.xx

 

1. Khaii git ์ €์žฅ์†Œ๋ฅผ clone ํ•ฉ๋‹ˆ๋‹ค.

git clone https://github.com/kakao/khaiii.git

2. build๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์ด๋™ ํ•ฉ๋‹ˆ๋‹ค.

cd khaiii
mkdir build
cd build

3. Cmake๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. (์ปคํ”ผํ•œ์ž” ํƒ€ ๊ฐ€์ง€๊ณ  ์˜ต๋‹ˆ๋‹ค.)

cmake ..

4. Make๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. (์ปคํ”ผ๋ฅผ ํ•œ์ž” ๋” ํƒ€ ๊ฐ€์ง€๊ณ  ์˜ต๋‹ˆ๋‹ค.)

make all

 ์„ฑ๊ณต์ ์œผ๋กœ ๋นŒ๋“œ๊ฐ€ ๋˜๋ฉด build ๋””๋ ‰ํ„ฐ๋ฆฌ ์•„๋ž˜์— ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํŒŒ์ผ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.

  • bin: ๋””๋ ‰ํ„ฐ๋ฆฌ
    • khaiii: ์‹คํ–‰ ํ”„๋กœ๊ทธ๋žจ
  • lib: ๋””๋ ‰ํ„ฐ๋ฆฌ
    • libkhaiii.so: shared ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ (๋งฅ OS์˜ ๊ฒฝ์šฐ libkhaiii.dylib)
    • libkhaiii.so.X
    • libkhaiii.so.X.Y
  • test: ๋””๋ ‰ํ„ฐ๋ฆฌ
    • khaiii: ํ…Œ์ŠคํŠธ ํ”„๋กœ๊ทธ๋žจ

5. make resource : bin ๋””๋ ‰ํ† ๋ฆฌ์— ์ƒ์„ฑ๋œ khaiiiํŒŒ์ผ์„ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํ•ด๋‹น ํ”„๋กœ๊ทธ๋žจ์—์„œ ์‚ฌ์šฉํ•˜๋Š” 

                                      ๋ฆฌ์†Œ์Šค ๋“ค์„ ๋นŒ๋“œ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

make resource

6. ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด ๋ด…๋‹ˆ๋‹ค.

./bin/khaiii --rsc-dir=./share/khaiii

        ๋ช…๋ น์–ด๋ฅผ ์น˜๋ฉด "...PoS tagger opened"๋ผ๋Š” ๋ฉ”์‹œ์ง€ ๋‹ค์Œ์— ์•„๋ฌด ๋ณ€ํ™”๊ฐ€ ์—†๋Š”๋ฐ, 

       ์—ฌ๊ธฐ์— ํ…Œ์ŠคํŠธ ํ•˜๊ณ ์ž ํ•˜๋Š” ๋ฌธ์žฅ์„ ์ž…๋ ฅํ•˜๊ณ  ์—”ํ„ฐ๋ฅผ ์น˜๋ฉด ํ˜•ํƒœ์†Œ ๋ถ„์„์ด ๋œ ๊ฒฐ๊ณผ๊ฐ€ ์ถœ๋ ฅ์ด ๋ฉ๋‹ˆ๋‹ค.

7. ์ •์ƒ ์ž‘๋™์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

ctest

7. python๊ณผ ์—ฐ๋™์„ ์œ„ํ•ด make๋ฅผ ํ•ฉ๋‹ˆ๋‹ค. (python binding)

make package_python

8. pip install ์‹คํ–‰

cd package_python
pip install  . 

9.  Python ๋ฐ”์ธ๋”ฉ ํ…Œ์ŠคํŠธ

      ๋งˆ์ง€๋ง‰์œผ๋กœ, python ๋ฐ”์ธ๋”ฉ์ด ์ž˜ ๋˜์–ด ์žˆ๋Š”์ง€ ํ…Œ์ŠคํŠธ ํ•ฉ๋‹ˆ๋‹ค.

      ์•„๋ž˜ ์†Œ์Šค๋ฅผ python์œผ๋กœ ์‹คํ–‰์‹œ์ผœ๋ด…๋‹ˆ๋‹ค.

      ** ์—ฌ๊ธฐ์„œ ์ฃผ์˜ํ•  ์ ์€ ํ˜„์žฌ์˜ ๋””๋ ‰ํ† ๋ฆฌ(./package_python)์„ ๋ฒ—์–ด๋‚˜์„œ ์‹คํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

           ํ˜„์žฌ์˜ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ์‹คํ–‰ํ•˜๋ฉด ํ˜„์žฌ์˜ buildํŒŒ์ผ์„ ์‹คํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์˜์กด์„ฑ ๋ฌธ์ œ๊ฐ€

           ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

from khaiii import KhaiiiApi
api = KhaiiiApi()
for word in api.analyze('์•ˆ๋…•, ์„ธ์ƒ.'):
    print(word)

์œ„ ์ด๋ฏธ์ง€ ์ฒ˜๋Ÿผ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ค๋ฉด ์ž˜ ๋˜๋Š” ๊ฒƒ ์ž…๋‹ˆ๋‹ค.

 

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

Anaconda ์„ค์น˜ ์ž์ฒด๋Š” ๊ทธ๋ฆฌ ์–ด๋ ค์šด ์ ์ด ์—†๊ธฐ ๋•Œ๋ฌธ์— ์ƒ๋žตํ•ฉ๋‹ˆ๋‹ค.

์‹ค๋ฌด์—์„œ ์ œ๋ฒ• ์œ ์šฉํ–ˆ๋˜ ํŒ์„ ๊ณต์œ  ํ•ฉ๋‹ˆ๋‹ค.


1. ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ

      ๊ฐ€. ํŒจํ‚ค์ง€ ์„ค์น˜

              > conda install numpy scipy pandas

    ๋‚˜. ํŒจํ‚ค์ง€ ์ œ๊ฑฐ

          > conda remove ํŒจํ‚ค์ง€๋ช…

    ๋‹ค. ํŒจํ‚ค์ง€ Update

          > conda update ํŒจํ‚ค์ง€๋ช…

    ๋ผ. ๋ชจ๋“ ํŒจํ‚ค์ง€ Update

          > conda update --all

    ๋งˆ. ์„ค์น˜๋œ ํŒจํ‚ค์ง€ ํ™•์ธ

          > conda list

    ๋ฐ”. ํŒจํ‚ค์ง€ ์ด๋ฆ„์„ ์ž˜ ๋ชจ๋ฅผ๋•Œ ๊ฒ€์ƒ‰

          > conda search *beautiful*

                  



2. ํ™˜๊ฒฝ ๊ด€๋ฆฌ

    ๊ฐ€. ๊ฐ€์ƒํ™˜๊ฒฝ ์ƒ์„ฑ

          > conda create -n [๊ฐ€์ƒํ™˜๊ฒฝ๋ช…] [๊ธฐ๋ณธ์„ค์น˜ํ•  ํŒจํ‚ค์ง€] 

             '๊ธฐ๋ณธ์„ค์น˜ํ•  ํŒจํ‚ค์ง€'๋Š” ์—ฌ๋Ÿฌ ํŒจํ‚ค์ง€๋ฅผ ํ•œ๊บผ๋ฒˆ์— ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

    ๋‚˜. ํŒจํ‚ค์ง€์˜ ํŠน์ • ๋ฒ„์ „์„ ์„ค์น˜ํ•˜์—ฌ ๊ฐ€์ƒํ™˜๊ฒฝ ์ƒ์„ฑ

          > conda create -n my_env python=3.6

    ๋‹ค. ๊ฐ€์ƒํ™˜๊ฒฝ ํ™œ์„ฑํ™”

          > source activate [๊ฐ€์ƒํ™˜๊ฒฝ๋ช…]

    ๋ผ. ๊ฐ€์ƒํ™˜๊ฒฝ ๋น„ํ™œ์„ฑํ™”

          > source deactivate


3. ๊ฐ€์ƒํ™˜๊ฒฝ ์ €์žฅ ๋ฐ ๊ณต์œ 

     ๊ฐ€. ๊ฐ€์ƒํ™˜๊ฒฝ export

           > conda env export > [ํŒŒ์ผ์ด๋ฆ„].yaml

              ์ด ํŒŒ์ผ์„ ๋ฐฑ์—…ํ•˜๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์—๊ฒŒ ๊ฐ™์€ ํ™˜๊ฒฝ์„ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋‹ค.

     ๋‚˜. ๊ณต์œ ๋ฐ›์€ yamlํŒŒ์ผ๋กœ๋ถ€ํ„ฐ ๊ฐ€์ƒํ™˜๊ฒฝ ์ƒ์„ฑ

           > conda env create -f [ํŒŒ์ผ์ด๋ฆ„].yaml

       ๋‹ค. ๊ฐ€์ƒํ™˜๊ฒฝ ๋ชฉ๋ก ํ™•์ธ

           > conda env list

                          

                  ํ˜„์žฌ ํ™œ์„ฑํ™” ๋˜์–ด ์žˆ๋Š” ๊ฐ€์ƒํ™˜๊ฒฝ๋ช… ์•ž์—๋Š” * ํ‘œ์‹œ๊ฐ€ ๋ถ™๋Š”๋‹ค.

     ๋ผ. ๊ฐ€์ƒํ™˜๊ฒฝ ์ œ๊ฑฐํ•˜๊ธฐ

            > conda env remove -n [๊ฐ€์ƒํ™˜๊ฒฝ๋ช…]

              





# Download the dataset. It's small, only about 6 MB.
if not os.path.exists('./ml-1m'):
url = 'http://files.grouplens.org/datasets/movielens/ml-1m.zip'
response = requests.get(url, stream=True)
total_length = response.headers.get('content-length')
bar = tqdm.tqdm_notebook(total=int(total_length))
with open('./ml-1m.zip', 'wb') as f:
for data in response.iter_content(chunk_size=4096):
f.write(data)
bar.update(4096)
zip_ref = zipfile.ZipFile('./ml-1m.zip', 'r')
zip_ref.extractall('.')
zip_ref.close()


References

General

  • Nearly all commands can be preceded by a number for a repeat count. eg. 5dd delete 5 lines
  • <Esc> gets you out of any mode and back to command mode
  • Commands preceded by : are executed on the command line at the bottom of the screen
  • :help help with any command

Navigation

  • Cursor movement: โ†h โ†“j โ†‘k lโ†’
  • By words:
    • w next word (by punctuation); W next word (by spaces)
    • b back word (by punctuation); B back word (by spaces)
    • e end word (by punctuation); E end word (by spaces)
  • By line:
    • 0 start of line; ^ first non-whitespace
    • $ end of line
  • By paragraph:
    • { previous blank line; } next blank line
  • By file:
    • gg start of file; G end of file
    • 123G go to specific line number
  • By marker:
    • mx set mark x'x go to mark x
    • '. go to position of last edit
    • ' ' go back to last point before jump
  • Scrolling:
    • ^F forward full screen; ^B backward full screen
    • ^D down half screen; ^U up half screen
    • ^E scroll one line up; ^Y scroll one line down
    • zz centre cursor line

Editing

  • u undo; ^R redo
  • . repeat last editing command

Inserting

All insertion commands are terminated with <Esc> to return to command mode.

  • i insert text at cursor; I insert text at start of line
  • a append text after cursor; A append text after end of line
  • o open new line below; O open new line above

Changing

All change commands except r and R are terminated with <Esc> to return to command mode.

  • r replace single character; R replace multiple characters
  • s change single character
  • cw change word; C change to end of line; cc change whole line
  • c<motion> changes text in the direction of the motion
  • ci( change inside parentheses (see text object selection for more examples)

Deleting

  • x delete char
  • dw delete word; D delete to end of line; dd delete whole line
  • d<motion> deletes in the direction of the motion

Cut and paste

  • yy copy line into paste buffer; dd cut line into paste buffer
  • p paste buffer below cursor line; P paste buffer above cursor line
  • xp swap two characters (x to delete one character, then p to put it back after the cursor position)

Blocks

  • v visual block stream; V visual block line; ^V visual block column
    • most motion commands extend the block to the new cursor position
    • o moves the cursor to the other end of the block
  • d or x cut block into paste buffer
  • y copy block into paste buffer
  • > indent block; < unindent block
  • gv reselect last visual block

Global

  • :%s/foo/bar/g substitute all occurrences of "foo" to "bar"
    • % is a range that indicates every line in the file
    • /g is a flag that changes all occurrences on a line instead of just the first one

Searching

  • / search forward; ? search backward
  • * search forward for word under cursor; # search backward for word under cursor
  • n next match in same direction; N next match in opposite direction
  • fx forward to next character xFx backward to previous character x
  • ; move again to same character in same direction; , move again to same character in opposite direction

Files

  • :w write file to disk
  • :w name write file to disk as name
  • ZZ write file to disk and quit
  • :n edit a new file; :n! edit a new file without saving current changes
  • :q quit editing a file; :q! quit editing without saving changes
  • :e edit same file again (if changed outside vim)
  • :e . directory explorer

Windows

  • ^Wn new window
  • ^Wj down to next window; ^Wk up to previous window
  • ^W_ maximise current window; ^W= make all windows equal size
  • ^W+ increase window size; ^W- decrease window size

Source Navigation

  • % jump to matching parenthesis/bracket/brace, or language block if language module loaded
  • gd go to definition of local symbol under cursor; ^O return to previous position
  • ^] jump to definition of global symbol (requires tags file); ^T return to previous position (arbitrary stack of positions maintained)
  • ^N (in insert mode) automatic word completion

Show local changes

Vim has some features that make it easy to highlight lines that have been changed from a base version in source control. I have created a small vim script that makes this easy: http://github.com/ghewgill/vim-scmdiff

  1. autoenv ์„ค์น˜
git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv 
echo โ€˜source ~/.autoenv/activate.shโ€™ >> ~/.zprofile #ํ˜น์€ .bash_profile source ~/.zprofile #ํ˜น์€ .bash_profile

2. autoenv ๋””๋ ‰ํ† ๋ฆฌ์— ์„ค์ •

mkdir autoenvDir cd autoenvDir 
echo โ€œconda activate py36โ€ > .env

3. autoenv ๋™์ž‘ ํ™•์ธ

# .env ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด ๋†“์€ ํด๋”๋กœ ์ด๋™์‹œ autoenv ๋™์ž‘์„ ํ™•์ธํ•œ๋‹ค 
cd autoenvDir
autoenv:
autoenv: WARNING:
autoenv: This is the first time you are about to source /home/jjeaby/autoenvDir/.env:
autoenv:
autoenv: โ€” โ€” (begin contents) โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€”โ€” โ€” โ€” โ€” โ€”
autoenv: conda deactivate $ autoenv: conda activate py36$
autoenv:
autoenv: โ€” โ€” (end contents) โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€” โ€”โ€” โ€” โ€” โ€” โ€” โ€”
autoenv:
autoenv: Are you sure you want to allow this? (y/N) y
(py36) โžœ

ssh -i keyfile.pem -L 8888:localhost:8888 ๊ณ„์ •@10.1.1.1

Oh My Zsh์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Bash
Copy

์ž๋™์œผ๋กœ ์„ค์น˜๊ฐ€ ์ง„ํ–‰๋˜๊ณ , ๋งˆ์ง€๋ง‰์— zsh๋ฅผ ๊ธฐ๋ณธ ์‰˜๋กœ ์ง€์ •ํ•˜๊ธฐ ์œ„ํ•ด ํ˜„ ์‚ฌ์šฉ์ž ๊ณ„์ •์˜ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

๋ฐ”๋กœ ํ”Œ๋Ÿฌ๊ทธ์ธ 2๊ฐœ๋ฅผ ์„ค์น˜ํ•ด์ค๋‹ˆ๋‹ค.

# zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# zsh-autosuggestions
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
Bash
Copy

ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์ ์šฉ์‹œํ‚ค๊ธฐ ์œ„ํ•ด .zshrc๋ฅผ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์ฒ˜๋Ÿผ plugins=( ) ์— zsh-... ๋‘ ์ค„์„ ์ถ”๊ฐ€ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

vi ~/.zshrc
Bash
Copy
...

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
  zsh-syntax-highlighting
  zsh-autosuggestions
)

...
Bash
Copy
source ~/.zshrc
Bash
Copy

๋‹ค ์„ค์น˜๋์–ด์š”. ๊ฐ„๋‹จํ•œ ์˜ˆ์‹œ ์Šคํฌ๋ฆฐ์ƒท์„ ๋ณด์—ฌ๋“œ๋ฆด๊ฒŒ์š”.

์•„๋ž˜ ์Šคํฌ๋ฆฐ์ƒท์€ ์—†๋Š” ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ• ๋•Œ์™€ ๋ช…๋ น์–ด ์ž๋™ ์™„์„ฑ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค. ๋ณด์‹œ๋ฉด ๋ฐ”๋กœ ์ดํ•ด๊ฐ€ ๋  ๊ฑฐ์˜ˆ์š”.

์ŠคํŽ ๋ง ๊ฒ€์‚ฌ ๊ธฐ๋Šฅ์„ ์ผ  ๋’ค ํ…Œ์ŠคํŠธํ•ด๋ดค์Šต๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  git repository ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ–ˆ์„ ๋•Œ ์ž…๋‹ˆ๋‹ค.

+ Recent posts