<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Murky Swamp</title>
    <description>aim at full-stack developer...</description>
    <link>http://iamdavidxie.com/</link>
    <atom:link href="http://iamdavidxie.com/feed.xml" rel="self" type="application/rss+xml" />
    
      <item>
        <title>Install Gentoo on Raspberry Pi 5</title>
        <description>&lt;p&gt;Installing Gentoo on Raspberry Pi can be easy, can be hard. There are pre-built images like &lt;a href=&quot;https://github.com/GenPi64/gentoo-on-rpi-64bit&quot;&gt;GenPi64&lt;/a&gt;, but this is not under development anymore.&lt;/p&gt;

&lt;p&gt;Another way to install Gentoo is to download the stage 3 file and install it like installing on normal PCs, except we need to download firmwares from official repositories.&lt;/p&gt;

&lt;p&gt;I have written a wiki page to demonstrate how to install Gentoo on a raspberry pi 5, and it only takes 30 minutes.&lt;/p&gt;

&lt;p&gt;https://wiki.gentoo.org/wiki/How_to_install_Gentoo_on_Raspberry_Pi_5&lt;/p&gt;

&lt;p&gt;For more details, you can always go to &lt;a href=&quot;https://wiki.gentoo.org/wiki/Raspberry_Pi_Install_Guide&quot;&gt;Raspberry Pi Install Guide&lt;/a&gt;, which is a new page contains installation guides for all raspberry pi versions.&lt;/p&gt;
</description>
        <pubDate>Sun, 04 Feb 2024 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2024/02/04/install-gentoo-on-raspberry-pi-5/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2024/02/04/install-gentoo-on-raspberry-pi-5/</guid>
      </item>
    
      <item>
        <title>Install PostgreSQL 9.4 with Homebrew</title>
        <description>&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Homebrew&lt;/code&gt; is a great tool on Mac to install 3rd-party softwares and unix softwares like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libxml2&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MySQL&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Redis&lt;/code&gt;, etc. Today let’s install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PostgreSQL 9.4&lt;/code&gt; with it.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;First, install it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Homebrew&lt;/code&gt; command:&lt;/p&gt;

    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;homebrew/versions/postgresql94
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;And then, start &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgresql&lt;/code&gt; service with following command:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; brew services start homebrew/versions/postgresql94
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;This command will make sure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgresql&lt;/code&gt; is running every time you restart your computer. If you just want to start it one time, you could try command: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgres -D /usr/local/var/postgres&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Last thing you need to do is to create a superuser &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;postgres&lt;/code&gt;:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; createuser -d -a -s -P postgres
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;After entering your password, you have a running postgresql now.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Mon, 31 Oct 2016 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2016/10/31/install-postgresql-94-with-homebrew/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2016/10/31/install-postgresql-94-with-homebrew/</guid>
      </item>
    
      <item>
        <title>Use CLI to configure Wifi on debian for Raspberry Pi</title>
        <description>&lt;p&gt;Raspbian is a customized Debian on Raspberry Pi, and it’s almost same as Debian.&lt;/p&gt;

&lt;p&gt;Thank god Raspberry Pi 3 builds with a wireless module, we don’t need to spend $10 on a USB wifi card.&lt;/p&gt;

&lt;p&gt;This post talks about how to configure wifi on CLI mode.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Update &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/network/interfaces&lt;/code&gt; and make sure it looks like below:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; auto lo
 iface lo inet loopback

 allow-hotplug wlan0
 auto wlan0

 iface wlan0 inet manual
 wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Create or update &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/wpa_supplicant/wpa_supplicant.conf&lt;/code&gt;&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; update_config=1
 network={
   ssid=&quot;Your Wifi Network&quot;
   #psk=&quot;your password&quot;
   psk=&amp;lt;encryped_passphase&amp;gt;
 }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;&lt;strong&gt;Attention: wpa will never use plain password for connecting wifi, you need to passphase it and put it here.&lt;/strong&gt;&lt;/p&gt;

    &lt;p&gt;Actually there’s a simple way to generate this file, just use command below:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; wpa_passphrase &amp;lt;your_wifi_name&amp;gt; &amp;lt;your_wifi_password&amp;gt; &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;After this, just put &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;update_config=1&lt;/code&gt; in the first line of that file.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Restart OS and you will see your Raspberry Pi is already connected to Wifi&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Mon, 27 Jun 2016 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2016/06/27/use-cli-to-configure-wifi-on-debian-for-raspberry-pi/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2016/06/27/use-cli-to-configure-wifi-on-debian-for-raspberry-pi/</guid>
      </item>
    
      <item>
        <title>Install Raspbian image on Raspberry Pi 3</title>
        <description>&lt;p&gt;For SBC, a.k.a Single Board Computer, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dd&lt;/code&gt; is our friend. Normally, this is the only tool we use to “install” OS.&lt;/p&gt;

&lt;p&gt;Today I will take “Raspbian” for an instance. As you can see, Raspbian is debian for Raspberry Pi, and its latest version May 2016, released in 2016-05-27. Download link: &lt;a href=&quot;https://www.raspberrypi.org/downloads/raspbian/&quot;&gt;https://www.raspberrypi.org/downloads/raspbian/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After unzipping it, we get a file named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2016-05-27-raspbian-jessie-lite.img&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;OK, let’s get started.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Prepare MicroSD&lt;/p&gt;

    &lt;p&gt;My work environment is Mac OS X, so I just open &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Disk Utility&lt;/code&gt;, click on “Eject” button of my disk. Also, check device name on the right , which is some name like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;disk2&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;disk3&lt;/code&gt;. Mine here is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;disk3&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dd&lt;/code&gt;&lt;/p&gt;

    &lt;p&gt;Open terminal, run below command:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; sudo dd bs=1m if=/path/to/your/2016-05-27-raspbian-jessie-lite.img of=/dev/rdisk&amp;lt;N&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;Here, we must pay attention to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/rdisk&amp;lt;N&amp;gt;&lt;/code&gt;. If you get &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;disk2&lt;/code&gt; above, use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rdisk2&lt;/code&gt; here, and if you get &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;disk3&lt;/code&gt;, use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rdisk3&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Finish&lt;/p&gt;

    &lt;p&gt;After a while, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dd&lt;/code&gt; puts the whole image into our MicroSD card, bad thing is there’s no output of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dd&lt;/code&gt;, so we never know when it is done. Once it’s finished, all we need to do is to eject our card, and put it into Raspberry Pi and power on.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Sun, 26 Jun 2016 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2016/06/26/install-raspbian-image-on-raspberry-pi/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2016/06/26/install-raspbian-image-on-raspberry-pi/</guid>
      </item>
    
      <item>
        <title>Use email to create tasks in Omni Focus 2</title>
        <description>&lt;p&gt;There’s no doubt that Omni Focus 2 is a great GTD tool on Mac, or even in every platform. Sometimes I just feel hard to collect tasks, cause they are &lt;strong&gt;everywhere&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Imagine you are surfing on the internet and saw a really good article, and wants to read it later, you can create a take immediately in Omni Focus 2, or put it in Pocket, which is another great app for collecting articles. But, what if hundreds of articles are there? I believe no one will add them one by one.&lt;/p&gt;

&lt;p&gt;So I came up an idea to add them automatically. Thank god Omni Focus 2 supports adding tasks via email. To enable it, you need to visit &lt;a href=&quot;https://manage.sync.omnigroup.com/manage/&quot;&gt;https://manage.sync.omnigroup.com/manage/&lt;/a&gt; and sign in/sign up, and click “Add an address” in section “Mail Drop to Inbox”. After that, you will get an email address like “username.xxxx@sync.omnigroup.com”.&lt;/p&gt;

&lt;p&gt;When you want to create a task, you can just simply send an email to this address, email title will be the task title, and email body will be the task details. Task will be located in “Inbox”.&lt;/p&gt;

&lt;p&gt;Why is this cool? I created an “ifttt” task: each time a rss feed has a new item, create a task in Omni Focus 2, then, I know there’s a new article for me read. :-D&lt;/p&gt;

&lt;p&gt;P.S. You have to enable syncing in Omni Focus 2 to use this feature.&lt;/p&gt;
</description>
        <pubDate>Thu, 16 Jun 2016 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2016/06/16/use-email-to-create-tasks-for-omnifocus-2/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2016/06/16/use-email-to-create-tasks-for-omnifocus-2/</guid>
      </item>
    
      <item>
        <title>How should Evernote do right now?</title>
        <description>&lt;p&gt;A few years ago Evernote was the number 1 notes app all over the world, and everybody loves it.&lt;/p&gt;

&lt;p&gt;We can see articles everywhere talking about how to use it to keep notes and organize your notes, and even create your own knowledge library.&lt;/p&gt;

&lt;p&gt;But several years passed, what do we read now?&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.appinn.com/import-evernote-to-onenote/&quot;&gt;http://www.appinn.com/import-evernote-to-onenote/&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;A Chinese article about how to migrate Evernote notes to OneNote&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.appinn.com/evernote-to-apple-notes/&quot;&gt;http://www.appinn.com/evernote-to-apple-notes/&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Another article shows how to migrate Evernote notes to Apple notes&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Last word from these is really intersting, “Evernote, you should think about why pepople are trying to get rid of you!”&lt;/p&gt;

&lt;p&gt;So I wanna give Evernote some advices and hope it would be great again, and provide us good services:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Remove 60M/month limit&lt;/li&gt;
  &lt;li&gt;Add Markdown support (you should listen to the community)&lt;/li&gt;
  &lt;li&gt;Focus on notes itself (I know you are working on this, but do it better)&lt;/li&gt;
  &lt;li&gt;Free offline notes (be nice to your users)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If Evernote can fix all these things I talked about, I think it still get a chance.&lt;/p&gt;
</description>
        <pubDate>Sun, 24 Apr 2016 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2016/04/24/how-should-evernote-do-right-now/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2016/04/24/how-should-evernote-do-right-now/</guid>
      </item>
    
      <item>
        <title>Use getopt to parse script parameters</title>
        <description>&lt;p&gt;There are 3 ways to parse parameters for your CLI written by bash: position based parameter, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getopts&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getopt&lt;/code&gt;. With no doubt, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getopt&lt;/code&gt; is the most powerful one.&lt;/p&gt;

&lt;p&gt;I will use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;db-helper&lt;/code&gt; command from &lt;a href=&quot;http://killbill.io&quot;&gt;killbill&lt;/a&gt; to show you how to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getopt&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The first thing you should know is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getopt&lt;/code&gt; is not internal command for bash, if you want to use it, you have to make sure it is installed, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gnu-getopt&lt;/code&gt; is more powerful than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bsd-getopt&lt;/code&gt;, which means, if you are using Mac OS X, you need to replace it with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gnu-getopt&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;ARGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;getopt &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;a:d:h:u:p:t:f:&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;action:,driver:,database:,host:,user:,password:,test:,file:,port:,help&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;db-helper&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$@&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;eval set&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ARGS&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do
  case&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--action&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;ACTION&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift &lt;/span&gt;2&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;DRIVER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift &lt;/span&gt;2&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--database&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;DATABASE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift &lt;/span&gt;2&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;HOST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift &lt;/span&gt;2&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;HOST&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift &lt;/span&gt;2&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift &lt;/span&gt;2&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;PWD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift &lt;/span&gt;2&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;TEST_ALSO&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift &lt;/span&gt;2&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;OUTPUT_FILE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift &lt;/span&gt;2&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--help&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; usage&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;esac&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next is to think about parameters you want to use. You can use short parameter name like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-a&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-d&lt;/code&gt;, or long parameter name like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--action&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--database&lt;/code&gt;. Also, you can use both.&lt;/p&gt;

&lt;p&gt;Parameter can be a switch like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--rm&lt;/code&gt;, or a value like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--host&lt;/code&gt;.&lt;/p&gt;
</description>
        <pubDate>Tue, 01 Sep 2015 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2015/09/01/use-getopt-to-parse-your-bash-script/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2015/09/01/use-getopt-to-parse-your-bash-script/</guid>
      </item>
    
      <item>
        <title>Run psql without password</title>
        <description>&lt;p&gt;To run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;psql&lt;/code&gt; without prompting password, you need to create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$HOME/.pgpass&lt;/code&gt; file like below with correct file permission &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;600&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# host:port:database:username:password&lt;/span&gt;
localhost:5432:&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;:postgres:postgres&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Update it with corrent values and there you go!&lt;/p&gt;
</description>
        <pubDate>Tue, 01 Sep 2015 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2015/09/01/run-psql-without-password-prompt/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2015/09/01/run-psql-without-password-prompt/</guid>
      </item>
    
      <item>
        <title>Increase your disk size for boot2docker</title>
        <description>&lt;p&gt;You searched for this article, so I assume you know what boot2docker is and are using it. That’s good, so am I.&lt;/p&gt;

&lt;p&gt;But how many times have you got errors like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;no space left&lt;/code&gt; when you tried to pull a new image and running a command with container? I’ll tell you what, there’s a way to increase your disk size.&lt;/p&gt;

&lt;p&gt;Find &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.boot2docker/profile&lt;/code&gt; or create one if you cannot find it. For Windows, try &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%USERPROFILE%/.boot2docker/profile&lt;/code&gt;. There’s a configuration called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DiskSize&lt;/code&gt;, change it to any size you want.&lt;/p&gt;

&lt;p&gt;Make the whole configuraion file look like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# boot2docker profile filename: /Users/lxie/.boot2docker/profile&lt;/span&gt;
Init &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;false
&lt;/span&gt;Verbose &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;false
&lt;/span&gt;Driver &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;virtualbox&quot;&lt;/span&gt;
SSH &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ssh&quot;&lt;/span&gt;
SSHGen &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ssh-keygen&quot;&lt;/span&gt;
SSHKey &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/Users/lxie/.ssh/id_boot2docker&quot;&lt;/span&gt;
VM &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;boot2docker-vm&quot;&lt;/span&gt;
Dir &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/Users/lxie/.boot2docker&quot;&lt;/span&gt;
ISOURL &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://api.github.com/repos/boot2docker/boot2docker/releases&quot;&lt;/span&gt;
ISO &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/Users/lxie/.boot2docker/boot2docker.iso&quot;&lt;/span&gt;
DiskSize &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 32000
Memory &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2048
SSHPort &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2022
DockerPort &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 0
HostIP &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;192.168.59.3&quot;&lt;/span&gt;
DHCPIP &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;192.168.59.99&quot;&lt;/span&gt;
NetMask &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;255, 255, 255, 0]
LowerIP &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;192.168.59.103&quot;&lt;/span&gt;
UpperIP &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;192.168.59.254&quot;&lt;/span&gt;
DHCPEnabled &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true
&lt;/span&gt;Serial &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;false
&lt;/span&gt;SerialFile &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/Users/lxie/.boot2docker/boot2docker-vm.sock&quot;&lt;/span&gt;
Waittime &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 300
Retries &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 75&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Destroy your existing boot2docker-vm by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;boot2docker destroy&lt;/code&gt;, and then use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;boot2docker init&lt;/code&gt; to create a new one.&lt;/p&gt;

&lt;p&gt;Enjoy your new environment!&lt;/p&gt;
</description>
        <pubDate>Sat, 28 Feb 2015 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2015/02/28/increase-your-disk-for-boot2docker/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2015/02/28/increase-your-disk-for-boot2docker/</guid>
      </item>
    
      <item>
        <title>Kill containers in Docker</title>
        <description>&lt;p&gt;After using Docker for a while, you may find out there are so many containers in stopped status, and they are not deleted. You can delete them one by one with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker rm&lt;/code&gt;, but we are developers, how can we bear this?&lt;/p&gt;

&lt;p&gt;Thank god Docker provides a parameter named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-q&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker ps&lt;/code&gt; command to just print container IDs on console.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Delete all stopped containers&lt;/p&gt;

    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker rm $(docker ps -f status=stopped -q)&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Delete all containers&lt;/p&gt;

    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker rm -f $(docker ps -a -q)&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Isn’t it cool? If not, make some alias for this, like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alias drma=docker rm -f $(docker ps -a -q)&lt;/code&gt;, that’s how it’s done!&lt;/p&gt;
</description>
        <pubDate>Tue, 30 Dec 2014 00:00:00 +0000</pubDate>
        <link>http://iamdavidxie.com/2014/12/30/kill-containers-in-docker/</link>
        <guid isPermaLink="true">http://iamdavidxie.com/2014/12/30/kill-containers-in-docker/</guid>
      </item>
    
  </channel>
</rss>
