2018年5月30日 星期三

讓 Linux 主機查詢 DNS 時優先查找 IPV4 IP

如主機環境無法連 IPV6,但是要連線的 FQDN 有 IPV6 與 IPV4 兩種 IP
連線時就必須等 IPV6 連線逾時才會嘗試連 IPV4 IP
此時可新增如下設定,就會優先查 IPV4 IP

# vim /etc/gai.conf

precedence ::ffff:0:0/96 100

2018年5月18日 星期五

ssh 指定預設登入的使用者

 ssh 預設在建立連線時,會帶目前登入的使用者名稱,但實際上我們幾乎不會用目前登入的使用者名稱去連對方的機器,這時候只要在登入的家目錄設定一個 .ssh/config 檔案,就可以了

Host *
    User

Host example
    HostName example.net
    User buck

注意 .ssh/config 的權限需要是 600 才行

Bootstrap-Vue Table 綁定 row click 方法

藏在 document 的 Event 裡面...
找半天沒看到,結果 Google 看到 Github issue 也有人在討論 XD
<b-table bordered striped hover 
         :items="environments"
         :fields="fields"
         :current-page="currentPage"
         :per-page="perPage"
         :filter="filter"
         v-model="shownItems"
         @row-clicked="myRowClickHandler"
>
  <template slot="actions" scope="environment">
    <b-btn size="sm" @click="log(environment.item)">Details</b-btn>
  </template>
</b-table>
methods: {
  myRowClickHandler(record, index) {
    // 'record' will be the row data from items
    // `index` will be the visible row number (available in the v-model 'shownItems')
    log(record); // This will be the item data for the row
  }
}
https://github.com/bootstrap-vue/bootstrap-vue/issues/774
https://bootstrap-vue.js.org/docs/components/table#component-reference

2018年5月14日 星期一

Ubuntu 18.04 server 網卡配置設定

Ubuntu 18.04 採用了 netplan 來管理網路, 設定檔的部分採用 yaml 格式來撰寫,
預設路徑位於 /etc/netplan/, 設定好後執行 netplan apply 就套用新的設定了。

官網有很詳細的說明跟範例: https://netplan.io/examples

如何在 golang 裡面引用 gitlab private repo

參考文章:https://stackoverflow.com/questions/27500861/whats-the-proper-way-to-go-get-a-private-repository 原文是用 gitlab.company.com 當範例,這邊改成一般帳號...