<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>내 머릿속 데이터베이스</title>
    <description>내 머릿속 데이터베이스 (http://mydb.tistory.com) 에서 이전된 블로그.
제가 공부하며 생각한 내용을 정리한 공간입니다.
</description>
    <link>http://namioto.github.io/</link>
    <atom:link href="http://namioto.github.io/rss" rel="self" type="application/rss+xml"/>
    <pubDate>Tue, 09 Jan 2024 22:00:39 +0900</pubDate>
    <lastBuildDate>Tue, 09 Jan 2024 22:00:39 +0900</lastBuildDate>
    <generator>Jekyll v3.9.3</generator>
    
      <item>
        <title>Pandas date_range() 메소드 알아보기</title>
        <description>&lt;h1 id=&quot;python--pandas-date_range로-날짜-자유자재로-다루기&quot;&gt;[Python / Pandas] date_range()로 날짜 자유자재로 다루기&lt;/h1&gt;

&lt;p&gt;데이터를 추출하는 작업을 하다보면 특정 기간의 데이터를 쿼리로 가져온다거나 이런일들이 많다.
어떤 일들을 할 수 있는지 바로 예시부터 보자.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;h5 id=&quot;2017년-1월-1일-부터-12월-31일까지-각-주의-월요일들을-추출함&quot;&gt;2017년 1월 1일 부터 12월 31일까지 각 주의 월요일들을 추출함&lt;/h5&gt;
  &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;date_range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'1/1/2017'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'12/31/2017'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;freq&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'W-MON'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'2017-01-02'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-01-09'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-01-16'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-01-23'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-01-30'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-02-06'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-02-13'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-02-20'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-02-27'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-03-06'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-03-13'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-03-20'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-03-27'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-04-03'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-04-10'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-04-17'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-04-24'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-05-01'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-05-08'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-05-15'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-05-22'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-05-29'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-06-05'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-06-12'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-06-19'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-06-26'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-07-03'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-07-10'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-07-17'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-07-24'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-07-31'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-08-07'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-08-14'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-08-21'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-08-28'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-09-04'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-09-11'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-09-18'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-09-25'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-10-02'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-10-09'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-10-16'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-10-23'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-10-30'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-11-06'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-11-13'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-11-20'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-11-27'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-12-04'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-11'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-18'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-25'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
  &lt;h5 id=&quot;2017년-12월-달에-토일을-제외한-평일들만-추출&quot;&gt;2017년 12월 달에 토,일을 제외한 평일들만 추출&lt;/h5&gt;
  &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;date_range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'12/1/2017'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'12/31/2017'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;freq&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'B'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'2017-12-01'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-04'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-05'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-06'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-12-07'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-08'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-11'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-12'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-12-13'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-14'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-15'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-18'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-12-19'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-20'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-21'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-22'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-12-25'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-26'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-27'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-28'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;'2017-12-29'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
  &lt;h5 id=&quot;2017년-12월-10일부터-4일치-날짜를-추출&quot;&gt;2017년 12월 10일부터 4일치 날짜를 추출&lt;/h5&gt;
  &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;date_range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'12/10/2017'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;periods&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;freq&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'D'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'2017-12-10'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-11'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-12'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-13'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
  &lt;h5 id=&quot;2017년-12월-10일부터-4일전까지-날짜를-추출&quot;&gt;2017년 12월 10일부터 4일전까지 날짜를 추출&lt;/h5&gt;
  &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;date_range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'2017-12-10'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;periods&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;freq&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'D'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'2017-12-07'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-08'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-09'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'2017-12-10'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;  &lt;/div&gt;
  &lt;p&gt;기타 특정 기간의 분기별, 반기별 날짜를 추출한다거나,
1년동안의 월말, 월초, 중순 날짜를 추출하는 등의 일들이 가능합니다.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;date_range()&lt;/code&gt;는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pandas&lt;/code&gt; 패키지에 내장되어 있다.&lt;/p&gt;
</description>
        <pubDate>Thu, 07 Mar 2019 11:08:00 +0900</pubDate>
        <link>http://namioto.github.io/2019/03/07/date_range/</link>
        <guid isPermaLink="true">http://namioto.github.io/2019/03/07/date_range/</guid>
        
        <category>python</category>
        
        <category>pandas</category>
        
        
      </item>
    
      <item>
        <title>mac에 zsh을 설치해 보자</title>
        <description>&lt;h1 id=&quot;mac에-zsh-설치하기&quot;&gt;MAC에 ZSH 설치하기&lt;/h1&gt;
&lt;p&gt;그동안 bash만 쓰다가 zsh를 쓰는 동료를 보고 반해서 바로 써보기로 결정했다.
zsh은 뭘까? 바로 위키백과에 다음과 같이 정의되어 있다.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Z 셸은 상호작용 로그인 셸이자 셸 스크립트를 위한 강력한 명령 줄 인터프리터로 사용할 수 있는 유닉스 셸이다.
Zsh는 &lt;strong&gt;bash, ksh, tcsh의 일부 기능을 포함하여 수많은 개선 사항이 갖추어진 확장형 본 셸&lt;/strong&gt;이다. - &lt;a href=&quot;https://ko.wikipedia.org/wiki/Z_%EC%85%B8&quot;&gt;위키백과&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;여러 블로그 글들을 읽으면서 잘못된 내용도 혼재되어 있어, 작은 삽질을 했기 때문에 이곳에 기록을 해둔다.&lt;/p&gt;

&lt;p&gt;현재 사용중인 OS는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;High Sierra 10.13.6&lt;/code&gt;를 사용중이다.&lt;/p&gt;

&lt;h2 id=&quot;zsh-업그레이드&quot;&gt;zsh 업그레이드&lt;/h2&gt;
&lt;p&gt;맥에는 기본적으로 zsh이 설치되어 있다.&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; zsh &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
zsh 5.3 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;x86_64-apple-darwin17.0&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;하지만 현재 zsh의 버전은 5.5.1로 최신버전으로 업그레이드를 해보자.&lt;/p&gt;

&lt;p&gt;설치 방법은 여러가지가 있지만 삭제가 깔끔한 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brew&lt;/code&gt;를 이용한 설치를 선호하는 편이다.&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;zsh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;설치가 완료되면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chsh&lt;/code&gt; 명령으로 쉘을 변경하면 되는데,
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chsh -s $(which zsh)&lt;/code&gt; 커맨드로 쉘을 변경하라고 되어있는 글들이 많았다.
이 커맨드라인은 zsh이 이미 설치되어 있는 mac에 brew를 통해 설치하는 경우엔 맞지 않는 정보다.&lt;/p&gt;

&lt;p&gt;brew를 통해 설치된 zsh의 경로는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/bin/zsh&lt;/code&gt; 이다. 따라서 다음의 커맨드로 쉘을 변경한다.&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;chsh &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /usr/local/bin/zsh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;이 후 로그아웃 후 다시 터미널을 실행하면 zsh로 환경이 변해있음을 알 수 있다.&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$SHELL&lt;/span&gt;
/usr/local/bin/zsh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;oh-my-zsh-설치하기&quot;&gt;oh-my-zsh 설치하기&lt;/h2&gt;
&lt;p&gt;oh-my-zsh는 zsh의 가장 유명한 플러그인이다. 더 많은 기능과 테마를 제공한다.&lt;br /&gt;
oh-my-zsh 설치는 다음 두가지 방법 중 하나로 설치할 수 있다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# curl을 활용하는 방법&lt;/span&gt;
sh &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# wget을 활용하는 방법&lt;/span&gt;
sh &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; -&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;설정하기&quot;&gt;설정하기&lt;/h2&gt;
&lt;p&gt;zsh의 설정파일은 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.zshrc&lt;/code&gt; 이며 이 파일을 열어 편집한다.&lt;/p&gt;

&lt;h3 id=&quot;테마-변경하기&quot;&gt;테마 변경하기&lt;/h3&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.zshrc&lt;/code&gt; 파일을 열어 살펴보면 다음과 같이 기본 테마가 설정되어 있는 것을 확인할 수 있다.&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;...
&lt;span class=&quot;nv&quot;&gt;ZSH_THEME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;robbyrussell&quot;&lt;/span&gt;
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 에서 테마들을 참고하여 값을 변경 하며, 재미있는 사실은 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;random&lt;/code&gt;도 지원한다!&lt;/p&gt;

&lt;h3 id=&quot;plugins&quot;&gt;Plugins&lt;/h3&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.zshrc&lt;/code&gt; 파일엔 다음과 같은 설정도 있다.&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;plugins&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=(&lt;/span&gt;git bundler osx rake ruby&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.oh-my-zsh/plugins&lt;/code&gt; 경로에 252개의 플러그인들이 저장되어 있다. (2018-08-27 기준)&lt;/p&gt;

&lt;p&gt;나는 다음과 같은 플러그인을 사용 중 이다.&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;plugins&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=(&lt;/span&gt;
  git
  battery
  osx
  zsh-syntax-highlighting
  django
  docker
  extract
  jsontools
  jump
&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;아래 추가로 설치한 플러그인도 있으며 관련 정보를 링크해 둔다.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;zsh-autosuggestions
    &lt;ul&gt;
      &lt;li&gt;https://github.com/zsh-users/zsh-autosuggestions&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;virtualenv-autodetect
    &lt;ul&gt;
      &lt;li&gt;https://github.com/egilewski/virtualenv-autodetect&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;zsh-syntax-highlighting
    &lt;ul&gt;
      &lt;li&gt;https://github.com/zsh-users/zsh-syntax-highlighting&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;현재 사용중은 아니지만 추천할만한 플러그인도 링크한다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;alias-tips
    &lt;ul&gt;
      &lt;li&gt;https://github.com/djui/alias-tips&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Mon, 27 Aug 2018 21:41:00 +0900</pubDate>
        <link>http://namioto.github.io/2018/08/27/mac%EC%97%90-zsh%EC%9D%84-%EC%84%A4%EC%B9%98%ED%95%B4-%EB%B3%B4%EC%9E%90/</link>
        <guid isPermaLink="true">http://namioto.github.io/2018/08/27/mac%EC%97%90-zsh%EC%9D%84-%EC%84%A4%EC%B9%98%ED%95%B4-%EB%B3%B4%EC%9E%90/</guid>
        
        <category>tip</category>
        
        <category>MacOS</category>
        
        
      </item>
    
      <item>
        <title>Gitlab-CI로 자동 배포하기</title>
        <description>&lt;h1 id=&quot;gitlab-cicd로-자동-배포하기&quot;&gt;Gitlab CI/CD로 자동 배포하기&lt;/h1&gt;
&lt;p&gt;git을 통해 버전관리를 하면서도 배포 과정에선 FTP, SCP 등과 같은 절차로 너무나도 많은 시간을 소요하고 있었다.
몰론 배포 스크립트 등을 활용하는 조직도 있었으나, 팀에서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Gitlab&lt;/code&gt;을 적극적으로 활용하는 만큼 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Gitlab-CI&lt;/code&gt; 기능을 이용하여 branch commit시에 자동 배포를 하려고 마음을 먹었다.&lt;/p&gt;

&lt;p&gt;Jenkins등을 활용 할 수도 있지만, 사람은 새로운 도구보다 익숙한 도구를 좋아하는데다 같은 팀원들에게 Jenkins를 전파할 때 발생할 러닝커브도 고려하여 gitlab을 그대로 활용하기로 했다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/files/images/2018/07/multi-tasking.png&quot; alt=&quot;풀스택이 인기라지만...&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Gitlab의 CI-CD 기능을 이용하기 위해서는 원격지 서버에 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gitlab-runner&lt;/code&gt;를 설치해야한다.
처음에 이 개념을 설명하는 곳이 없어서 조금 해맸었다.&lt;/p&gt;

&lt;p&gt;원격지 서버(배포될 서버)들에 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gitlab-runner&lt;/code&gt; 들을 설치하고,
gitlab이 설치된 서버에 runner를 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;register&lt;/code&gt; 해두면 gitlab 상에서 commit와 같은 이벤트가 발생할 때, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gitlab-ci.yml&lt;/code&gt;에 작성된 스크립트가 원격지 서버에서 실행되는 게 전체 프로세스다.&lt;/p&gt;

&lt;h2 id=&quot;installing-the-runner&quot;&gt;Installing the Runner&lt;/h2&gt;
&lt;blockquote&gt;
  &lt;p&gt;원격지 서버에서 아래 작업이 수행되어야 한다.&lt;/p&gt;

  &lt;p&gt;몰론 원격지에서 Gitlab 페이지가 방화벽 등으로 막혀있지 않은지 확인해야 한다.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
  &lt;li&gt;Gitlab 공식 Repository를 추가한다.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# For Debian/Ubuntu/Mint&lt;/span&gt;
curl &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;bash

&lt;span class=&quot;c&quot;&gt;# For RHEL/CentOS/Fedora&lt;/span&gt;
curl &lt;span class=&quot;nt&quot;&gt;-L&lt;/span&gt; https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;bash
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;Gitlab Runner의 최신버전을 설치한다&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# For Debian/Ubuntu/Mint&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;gitlab-runner

&lt;span class=&quot;c&quot;&gt;# For RHEL/CentOS/Fedora&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;yum &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;gitlab-runner
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;만약 특정버전을 설치하고 싶다면 다음과 같이&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# for DEB based systems&lt;/span&gt;
apt-cache madison gitlab-runner
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;gitlab-runner&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;10.0.0

&lt;span class=&quot;c&quot;&gt;# for RPM based systems&lt;/span&gt;
yum list gitlab-runner &lt;span class=&quot;nt&quot;&gt;--showduplicates&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sort&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;yum &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;gitlab-runner-10.0.0-1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;registering-runners&quot;&gt;Registering Runners&lt;/h2&gt;
&lt;blockquote&gt;
  &lt;p&gt;원격지 서버에서 아래 작업이 수행되어야 한다.&lt;/p&gt;

  &lt;p&gt;몰론 원격지에서 Gitlab 페이지가 방화벽 등으로 막혀있지 않은지 확인해야 한다.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;root 계정에서 실행할거라면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gitlab-runner register&lt;/code&gt;을 실행하면 되지만 여기서는 따로 계정을 둬서 관리하도록 하려고 한다.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;계정을 생성
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;useradd &lt;span class=&quot;nt&quot;&gt;--comment&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'GitLab Runner'&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--create-home&lt;/span&gt; gitlab-runner &lt;span class=&quot;nt&quot;&gt;--shell&lt;/span&gt; /bin/bash
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;설치 및 실행
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;gitlab-runner &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;gitlab-runner &lt;span class=&quot;nt&quot;&gt;--working-directory&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/home/gitlab-runner
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;gitlab-runner start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Gitlab Runner 등록
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;gitlab-runner register
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;ul&gt;
      &lt;li&gt;Gitlab의 서버 주소를 입력한다.
        &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  Please enter the gitlab-ci coordinator URL &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;e.g. https://gitlab.com &lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
http://192.168.123.456
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;Gitlab CI 에서 발급된 토근 값을 입력한다.
        &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  Please enter the gitlab-ci token &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;this runner:
  1xxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;        &lt;/div&gt;
        &lt;blockquote&gt;
          &lt;p&gt;토큰 값을 확인 하는 방법은 Gitlab의 프로젝트를 선택하고 &lt;strong&gt;Settings &amp;gt; CI/CD &amp;gt; Runners settings &amp;gt; Specific Runners&lt;/strong&gt; 영역을 살펴보면 URL과 토큰 값을 확인 할 수 있다.&lt;/p&gt;

          &lt;p&gt;&lt;img src=&quot;/files/images/2018/07/gitlab-ci-token.png&quot; alt=&quot;gitlab-ci-token&quot; /&gt;&lt;/p&gt;
        &lt;/blockquote&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
  &lt;li&gt;Runner 의 설명을 추가한다.
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Please enter the gitlab-ci description &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;this runner:
Deploy Runner
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Runner의 태그를 설정한다. (중요하다.)
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Please enter the gitlab-ci tags &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;this runner &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;comma separated&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:
deploy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Runner가 어떤 작업으로 동작할지 결정
    &lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Please enter the executor: docker-ssh, ssh, virtualbox, docker, parallels, shell, docker+machine, docker-ssh+machine, kubernetes:
shell
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Runner가 정상 등록 되었다면 &lt;strong&gt;Settings &amp;gt; CI/CD &amp;gt; Runners settings &amp;gt; Specific Runners&lt;/strong&gt; 에서 다음과 같이 Runner가 등록된 것을 확인 할 수 있다.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/files/images/2018/07/gitlab-runner-added.png&quot; alt=&quot;Runner가 등록된 모습&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;gitlab-ciyml-스크립트-작성&quot;&gt;.gitlab-ci.yml 스크립트 작성&lt;/h2&gt;
&lt;div class=&quot;language-yml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# Master 브랜치에 push가 들어올 때 동작하는 job&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;deploy-to-server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;stage&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;deploy&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;only&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;master&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;echo 'hello world!'&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;tags&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;deploy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;deploy-to-server 은 임의로 지어준 JOB 이름&lt;/li&gt;
  &lt;li&gt;Gitlab 은 스테이지(단계) 별로 특정 작업들을 수행할 수 있는 큰 그룹이 정해져 있음
    &lt;ul&gt;
      &lt;li&gt;build, test, deploy 3단계의 스테이지가 있음&lt;/li&gt;
      &lt;li&gt;자세한 내용은 &lt;a href=&quot;https://docs.gitlab.com/ee/ci/yaml/README.html#stages&quot;&gt;여기&lt;/a&gt;를 참고&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;only는 master 브런치에 이벤트가 발생했을 경우 파이프라인 기능이 활성화 된다.&lt;/li&gt;
  &lt;li&gt;script 항목에선 runner에 의해 수행될 쉘 스크립트를 작성한다.&lt;/li&gt;
  &lt;li&gt;tags 는 특정 태그가 달린 runner에 명령을 내릴 수 있다. (여기서는 deploy 태그를 가진 runner에 명령을 내린다.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;위 파일을 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.gitlab-ci.yml&lt;/code&gt;로 저장하여 커밋&lt;/p&gt;

&lt;h2 id=&quot;마무리&quot;&gt;마무리&lt;/h2&gt;
&lt;p&gt;master 브런치에 커밋을 하고 &lt;strong&gt;프로젝트 &amp;gt; CI/CD &amp;gt; Pipelines 또는 Jobs&lt;/strong&gt; 에서 작업이 성공했는지 확인한다.
작업이 성공적으로 수행되었다면 대략 다음과 같은 화면을 볼 수 있다.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/files/images/2018/07/gitlab-runner-result.png&quot; alt=&quot;작업이 정상적으로 수행 된 모습&quot; /&gt;&lt;/p&gt;
</description>
        <pubDate>Mon, 16 Jul 2018 17:42:00 +0900</pubDate>
        <link>http://namioto.github.io/2018/07/16/gitlab-ci%EB%A1%9C-%EC%9E%90%EB%8F%99%EB%B0%B0%ED%8F%AC%ED%95%98%EA%B8%B0/</link>
        <guid isPermaLink="true">http://namioto.github.io/2018/07/16/gitlab-ci%EB%A1%9C-%EC%9E%90%EB%8F%99%EB%B0%B0%ED%8F%AC%ED%95%98%EA%B8%B0/</guid>
        
        <category>gitlab</category>
        
        <category>Continuous Integration</category>
        
        <category>Continuous Delivery</category>
        
        <category>배포</category>
        
        
      </item>
    
      <item>
        <title>맥 Bash 버전 업그레이드 하기</title>
        <description>&lt;h1 id=&quot;mac-osx-bash-쉘-44x로-업그레이드-하기&quot;&gt;MAC OSX BASH 쉘 4.4.x로 업그레이드 하기&lt;/h1&gt;
&lt;p&gt;macOS High Sierra 10.13.5 기준으로 설치되어 있는 bash 의 버전은 3.2.57 버전이다.&lt;/p&gt;

&lt;p&gt;bash 4.x 부터는 tab키를 눌렀을 때 한글 파일명도 &lt;strong&gt;자동완성&lt;/strong&gt;을 지원하며 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bracket expansion&lt;/code&gt; 기능에 추가된 부분이 있다.
고로 망설이지말고 업그레이드 해도 된다.&lt;/p&gt;

&lt;p&gt;bracket expansion은 다음과 같다.&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;0..10&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
0 1 2 3 4 5 6 7 8 9 10
&lt;span class=&quot;nv&quot;&gt;$&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;a..d&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
a b c d
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bash 4.x&lt;/code&gt;에 추가된 기능은 3번째 파라미터를 지원한다. (Step)&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;1..10..3&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
1 4 7 10
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;뭐 여러 글을 읽어보았지만 소스 설치를 하라는 곳이 있었고 brew로 설치해서 터미널을 설정하고 뭐 다양했는데
가장 깔끔하고 만족한 방법을 정리하고자 한다.&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$&amp;gt;&lt;/span&gt; brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;bash
&lt;span class=&quot;nv&quot;&gt;$&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;vi /etc/shells
&lt;span class=&quot;c&quot;&gt;# 문서 하단에 /usr/local/bin/bash 를 추가 해 준다.&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$&amp;gt;&lt;/span&gt; chsh &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /usr/local/bin/bash
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;bash 의 변경 사항에 대해선 아래 링크를 참고&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;&lt;a href=&quot;http://tiswww.case.edu/php/chet/bash/NEWS&quot;&gt;http://tiswww.case.edu/php/chet/bash/NEWS&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Tue, 26 Jun 2018 15:45:00 +0900</pubDate>
        <link>http://namioto.github.io/2018/06/26/%EB%A7%A5-bash-%EB%B2%84%EC%A0%84-%EC%97%85%EA%B7%B8%EB%A0%88%EC%9D%B4%EB%93%9C-%ED%95%98%EA%B8%B0/</link>
        <guid isPermaLink="true">http://namioto.github.io/2018/06/26/%EB%A7%A5-bash-%EB%B2%84%EC%A0%84-%EC%97%85%EA%B7%B8%EB%A0%88%EC%9D%B4%EB%93%9C-%ED%95%98%EA%B8%B0/</guid>
        
        <category>tip</category>
        
        <category>MacOS</category>
        
        
      </item>
    
      <item>
        <title>[Python] Jupyter 메모리 사용량 보기</title>
        <description>&lt;h1 id=&quot;jupyter-notebook-메모리-사용량-보기&quot;&gt;Jupyter Notebook 메모리 사용량 보기&lt;/h1&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;memory_profiler&lt;/code&gt; 을 설치한다.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;SHELL&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;memory_profiler
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;OR&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Jupyter&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-Python&quot;&gt;!pip install memory_profiler
&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Jupyter&lt;/code&gt;에서 외장 모듈을 불러온다
    &lt;pre&gt;&lt;code class=&quot;language-Python&quot;&gt;%load_ext memory_profiler
&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Jupyter&lt;/code&gt;에서 메모리 사용량 확인
    &lt;pre&gt;&lt;code class=&quot;language-Python&quot;&gt;%memit
&lt;/code&gt;&lt;/pre&gt;
    &lt;blockquote&gt;
      &lt;p&gt;peak memory: 75.84 MiB, increment: 0.07 MiB&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Mon, 25 Jun 2018 13:10:00 +0900</pubDate>
        <link>http://namioto.github.io/2018/06/25/python-jupyter-%EB%A9%94%EB%AA%A8%EB%A6%AC-%EC%82%AC%EC%9A%A9%EB%9F%89-%EB%B3%B4%EA%B8%B0/</link>
        <guid isPermaLink="true">http://namioto.github.io/2018/06/25/python-jupyter-%EB%A9%94%EB%AA%A8%EB%A6%AC-%EC%82%AC%EC%9A%A9%EB%9F%89-%EB%B3%B4%EA%B8%B0/</guid>
        
        <category>python</category>
        
        
      </item>
    
      <item>
        <title>[Python] Subprocessing - 외부 프로그램 실행하기</title>
        <description>&lt;h1 id=&quot;python-subprocess&quot;&gt;Python Subprocess&lt;/h1&gt;
&lt;p&gt;파이썬을 쓰다보면 외부 프로그램을 실행 시켜야 하는 경우가 종종 있는데, 이 때 Subprocess 모듈을 쓰게 된다. API 문서나 예제들을 보면 조금 어렵게 쓰여 있지만 자세히 들여다보면 엄청 간단한 모듈이다.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;내부에 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Popen&lt;/code&gt; 클래스가 있으나, 이건 로우레벨의 클래스라고 생각하면 좋을 듯 하다.&lt;/p&gt;

  &lt;p&gt;특별한 경우가 아닌 이상 사용할 일이 적으므로 이 글에선 다루지 않겠다.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Subprocess 모듈의 기능은 크게 다음 두가지로 나눠 기억하면 된다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#call&quot;&gt;&lt;strong&gt;call&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#output&quot;&gt;&lt;strong&gt;output&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;## Call&lt;a name=&quot;call&quot;&gt;&lt;/a&gt;
먼저 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Call&lt;/code&gt;은 외부 프로그램을 호출해서 그 프로그램의 종료코드(Exit Code) 값을 받아온다고 생각하면 된다.
왠만한 프로그램은 프로그램 실행 결과에 따라 종료코드를 반환한다.&lt;/p&gt;

&lt;p&gt;UNIX 시스템의 일반적인 종료코드는 정상 종료 일때 0을 반환하고 오류가 발생 했을 시, 0이 아닌 값을 반환한다.&lt;/p&gt;

&lt;p&gt;보편적인 종료코드의 대한 정의는 https://wiki.kldp.org/HOWTO/html/Adv-Bash-Scr-HOWTO/exitcodes.html 를 참고하면 될 듯 하다.&lt;/p&gt;

&lt;p&gt;어쨌거나 내가 실행 시킨 스크립트나 외부 프로그램이 정상 수행 되었는지를 판단하는데 이 종료코드를 이용할 수 있다.&lt;/p&gt;

&lt;p&gt;Call 방식의 메소드는 다음과 같이 2가지가 존재한다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;.call()&lt;/li&gt;
  &lt;li&gt;.check_call()&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;call()&lt;/code&gt; 메소드는 종료코드를 리턴 값으로 가지며, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;check_call()&lt;/code&gt; 메소드는 종료코드가 정상이 아니면 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CalledProcessError&lt;/code&gt; 예외를 발생 시키는 차이 밖에 없다.&lt;/p&gt;

&lt;p&gt;즉, call()은 프로그램 수행 결과에 대해 직접 결과코드를 체크해야하는 것이고, check_call()은 비정상 종료시 예외가 발생하므로 예외 처리에 대한 로직을 작성 해 줘야 한다는 것이다.&lt;/p&gt;

&lt;p&gt;call()의 인자는 다음과 같다. check_call() 또한 이와 동일하게 써도 무방하다.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;subprocess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;stdin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stdout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stderr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;timeout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;args : 명령행. String or List 타입을 인자로 받는다.
    &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;c1&quot;&gt;##  파일 목록이 출력된다.
&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;subprocess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'ls'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;### 이 명령도 위와 동일
&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;subprocess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'ls'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;### 단 문자열로 아래와 같이 인자를 넣는 것은 안된다.
&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;#subprocess.call('ls -alh')
&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;### 인자 전달 시엔 리스트 형태로 전달 해야한다.
&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;subprocess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'ls'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'-alh'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;shell : 별도의 서브 쉘을 실행 하고 그 쉘 위에서 명령을 실행 시키도록 함.
    &lt;blockquote&gt;
      &lt;p&gt;위의 예제 중 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;subprocess.call('ls -alh')&lt;/code&gt; 명령행에 매개변수를 삽입하는 것이 안되는 이유는 subprocess 모듈이 해당 명령 구문을 해석하지 않고 바로 실행하기 때문이다.&lt;/p&gt;

      &lt;p&gt;이 명령 구문을 해석하는 건 쉘이 담당하며, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shell=True&lt;/code&gt; 옵션을 활성화 시키면 쉘 기반 위에서 실행되므로 리스트 형태로 전달하지 않아도 된다.&lt;/p&gt;
      &lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;subprocess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'ls -alh'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;      &lt;/div&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
  &lt;li&gt;stdin, stdout, stderr : 표준 입출력에 대한 리다이렉션을 정의할 수 있다. 보통은 생략한다.&lt;/li&gt;
  &lt;li&gt;timeout : 외부 프로그램을 호출하고, 해당 프로그램이 종료될 때까지 기다리게 되는데(단위:초), 이 값을 설정하면 해당 시간 만큼 대기 후 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TimeoutExpired&lt;/code&gt; 예외를 내 뱉는다. (외부 프로그램이 행걸리는 상황에 대해 대비할 수 있다.)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;output&quot;&gt;Output&lt;a name=&quot;output&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;call은 종료코드를 리턴 값으로 받아왔다면 output은 프로그램의 출력 결과를 가져온다.&lt;/p&gt;

&lt;p&gt;output은 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;check_output()&lt;/code&gt; 메소드만 존재한다.
위 내용을 정독했다면 이 메소드도 결과에 따라 예외를 발생시킨다는 것을 짐작 할 수 있을 것이다.&lt;/p&gt;

&lt;p&gt;프로그램 종료코드 결과에 따라 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;check_call()&lt;/code&gt;과 동일한 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CalledProcessError&lt;/code&gt; 예외를 발생시킨다.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;subprocess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;check_output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;stdin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stdout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stderr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;shell&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;timeout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;universal_newlines&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;기본적으로 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;call()&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;check_call()&lt;/code&gt; 과 동일한 파라미터인데, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;check_output()&lt;/code&gt;에만 있는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;universal_newlines&lt;/code&gt;이라는 특별한 파라미터가 보인다.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;universal_newlines : (기본값 False) 표준입출력 파이프라인은 파일 형태로 되어있어, 프로그램 실행 결과가 바이너리 모드로 바이트 스트림 형태로 전달받게 된다. 이 파라미터가 True인 경우, &lt;a href=&quot;https://docs.python.org/3/library/io.html#io.TextIOWrapper&quot;&gt;io.TextIOWrapper&lt;/a&gt;을 통해 String 형태로 형변환된 결과를 받을 수 있도록 해 준다. 일반적인 경우라면 나는 이 파라미터를 항상 True에 두고 사용한다.&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Tue, 27 Mar 2018 13:28:00 +0900</pubDate>
        <link>http://namioto.github.io/2018/03/27/subprocessing/</link>
        <guid isPermaLink="true">http://namioto.github.io/2018/03/27/subprocessing/</guid>
        
        <category>python</category>
        
        
      </item>
    
      <item>
        <title>[Python] Matplotlib에 한글 출력하기</title>
        <description>&lt;h1 id=&quot;matplotlib에-한글-출력-하기&quot;&gt;matplotlib에 한글 출력 하기&lt;/h1&gt;

&lt;p&gt;matplotlib에 한글을 출력하는 경우, 폰트 문제로 한글이 깨져서 출력될 수 있다.
이런 경우 다음의 코드를 넣어주면 한글이 정상적으로 출력된다.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;font_manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rc&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;font_url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;c:/Windows/Fonts/malgun.ttf&quot;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;font_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;font_manager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FontProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;font_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;rc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'font'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;family&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;font_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;위 코드는 Windows에 맞춰서 경로가 잡혀있지만 맥 또는 리눅스라면 폰트가 저장된 경로를 확인해서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;font_url&lt;/code&gt; 변수를 수정 해 주면 된다.&lt;/p&gt;
</description>
        <pubDate>Tue, 05 Dec 2017 14:13:00 +0900</pubDate>
        <link>http://namioto.github.io/2017/12/05/matplotlib_hangle/</link>
        <guid isPermaLink="true">http://namioto.github.io/2017/12/05/matplotlib_hangle/</guid>
        
        <category>python</category>
        
        <category>matplotlib</category>
        
        <category>한글</category>
        
        
      </item>
    
      <item>
        <title>블로그 이전</title>
        <description>
&lt;h1 id=&quot;블로그-이전&quot;&gt;블로그 이전&lt;/h1&gt;

&lt;p&gt;내 블로그는 한 오년 이상을 &lt;a href=&quot;http://tistory.com&quot;&gt;티스토리&lt;/a&gt; 에서 운영을 했던 것 같다.&lt;/p&gt;

&lt;p&gt;내 블로그의 목적은 그저 내가 이런저런 잡학 지식들을 저장하고 메모하는 용도로 사용하는 것이었다.&lt;/p&gt;

&lt;p&gt;내가 궁금했던 것들. 내가 새로이 알게된 것들을 정리 해 두었을 뿐인데, 나와 같은 고민을 했었거나 같은 취미를 가졌던 사람들에게 내 글들이 도움이 되는지 꾸준한 방문자를 기록했다.&lt;/p&gt;

&lt;h2 id=&quot;블로그를-옮기게-된-이유&quot;&gt;블로그를 옮기게 된 이유&lt;/h2&gt;

&lt;p&gt;최근 웹의 트렌드는 정말로 자고 일어나면 변화한다.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://tistory.com&quot;&gt;티스토리&lt;/a&gt;는 아직 그러한 트렌드에 못따라가고 아직도 불필요한 플러그인 자바스크립트로 둘러쌓인 괴물이 되었다.&lt;/p&gt;

&lt;p&gt;본문에 소스코드를 삽입하거나, 수식을 넣거나 하는 일련의 모든 작업들이 &lt;a href=&quot;http://tistory.com&quot;&gt;티스토리&lt;/a&gt;는 너무 불편했다.&lt;/p&gt;

&lt;p&gt;사실 &lt;a href=&quot;http://tistory.com&quot;&gt;티스토리&lt;/a&gt;가 불편해졌다기보다 다른 좋은 플랫폼들이 많이 등장한 것에 비해, &lt;a href=&quot;http://tistory.com&quot;&gt;티스토리&lt;/a&gt;는 &lt;strong&gt;한 5년간 전혀 발전이 없는 것처럼 보인다!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;그래서 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Markdown&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LaTex&lt;/code&gt; 등을 지원하는 다양한 프레임웍을 고민하다, 다음 개발자들도 안쓰는 &lt;a href=&quot;http://tistory.com&quot;&gt;티스토리&lt;/a&gt;를 버리고 다음 개발자도 쓰는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;github pages + jekyll&lt;/code&gt; 조합을 사용하기로 했다.&lt;/p&gt;

&lt;h2 id=&quot;블로그를-만들면서&quot;&gt;블로그를 만들면서&lt;/h2&gt;
&lt;p&gt;커스터마이징이 안되는 블로그 프레임웍들은 커스터마이징이 안되서 불편한 점이 생기고,
&lt;a href=&quot;http://tistory.com&quot;&gt;티스토리&lt;/a&gt;나 Github Pages 같은 커스터마이징이 가능한 프레임웍은 일일히 다 만들고 커스터마이징하는데 시간이 오래 걸린다.&lt;/p&gt;

&lt;p&gt;이 점에 대해 고민하다 잘 만들어진 사이트를 가져와서 내 입맛대로 수정하는 것이 빠르겠다는 생각을 했고 tech.kakao.com 의 페이지를 clone하여 수정했다.&lt;/p&gt;

&lt;p&gt;일단 기업 홈페이지 였던터라 관련된 기업의 흔적부터 지우는 작업과, 댓글을 위한 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;disqus&lt;/code&gt; 를 달고, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Google Analytics&lt;/code&gt; 도 붙이고, CSS Style도 나에게 맞게 수정을 했다.&lt;/p&gt;

&lt;h2 id=&quot;블로그-운영&quot;&gt;블로그 운영&lt;/h2&gt;
&lt;p&gt;기존 mydb.tistory.com 의 내가 알게된 지식베이스를 구축한다는 목적을 유지하며, 이전 블로그의 포스팅들은 인기를 끌었던 포스팅부터 새롭게 쓰고자 한다.&lt;/p&gt;

&lt;p&gt;사실 이전 글들을 어떻게든 그냥 가져오려고 했지만, 지금엔 맞지 않는 부분이 여럿 발견되어 새로 쓰는 글에 잘못된 정보를 전파하고 싶지 않았다.&lt;/p&gt;

&lt;p&gt;이 블로그는 구글 애드센스를 통한 작은 수익도 창출하려고 계획 중에 있다.&lt;/p&gt;

&lt;p&gt;아직까지 계획일 뿐 차차 생각해봐야 할 일이다.&lt;/p&gt;
</description>
        <pubDate>Fri, 01 Dec 2017 10:38:00 +0900</pubDate>
        <link>http://namioto.github.io/2017/12/01/first_post/</link>
        <guid isPermaLink="true">http://namioto.github.io/2017/12/01/first_post/</guid>
        
        
      </item>
    
  </channel>
</rss>
