Tzu-Chieh Hung

@tchung

Joined on Jul 26, 2019

  • Share USB tethered phone to Raspberry Pi 4 LAN port Raspberry Pi Setup Follow the instructions on Raspberry Pi: Take into consideration that we imagined the phone virtual interface of the Raspberry Pi is usb0. Set a static IP address to the eth0 which would be router's clients' default gateway. To do it, there is plenty of procedure: Put lines below to in /etc/dhcpcd.conf: interface eth0
     Like  Bookmark
  • Install OpenSSH Server on Windows 10 Install OpenSSH Server On Windows 10 version 1803 and newer In Settings app, go to Apps > Apps & features > Manage optional features. Locate “OpenSSH server” feature, expand it, and select Install. Binaries are installed to %WINDIR%\System32\OpenSSH. Configuration file (sshd_config) and host keys are installed to %ProgramData%\ssh (only after the server is started for the first time). You may still want to use the following manual installation if you want to install a newer version of OpenSSH than the one built into Windows 10.
     Like  Bookmark
  • Raspberry Pi: Back up, Shrink, and Recovery Back up sudo umount /dev/sdX sudo dd if=/dev/sdX of=backup.img bs=4M status=progress Shrink Install PiShrink wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
     Like  Bookmark
  • Setting Power Button and LED with Device Tree Overlays Power On: short pin 5 and GND Power Off: In /boot/config.txt # use gpio to shutdown dtoverlay=gpio-shutdown,gpio_pin=26,active_low=1,gpio_pull=up # shutdown button on gpio pin 26 (physical pin 37)
     Like  Bookmark
  • Setting up External Wi-Fi Dongle on Raspberry Pi OS Disable Bulid-In Wi-Fi in /boot/config.txt dtoverlay=disable-wifi Configure WPA Supplicant in /etc/wpa_supplicant/wpa_supplicant.conf network={
     Like  Bookmark
  • --- title: 在 Ubuntu 16.04 下使用新酷音中文輸入法 tags: Ubuntu --- # 在 Ubuntu 16.04 下使用新酷音中文輸入法 ## 安裝 **方法一** 1. 進入 System Settings > Language Support 2. 在下方的 Keyboard input method system 選單中,選擇 fcitx ![Imgur](https://i.imgur.com/5pOsyiM.png) 3. 重新登入系統 4. 進入 System Settings > Text Entry 5. 點擊下方'+'號,新增 Chewing (Fcitx) 輸入法 ![Imgur](https://i.imgur.com/88MBOeA.png) **方法二** 直接使用以下指令安裝: ```bash sudo apt-get install fcitx fcitx-chewing ``` ## 設定 - 只有預編輯字串時,不顯示輸入視窗: 1. 點選右上角工具列 Fcitx 圖示,選擇 ConfigureFcitx 2.
     Like  Bookmark
  • --- title: 使用 Git Clone Remote Repository 的所有 Branch tags: Git --- # 使用 Git Clone Remote Repository 的所有 Branch ## 操作說明 `git clone`指令預設只會 clone master branch,如果想要 clone remote repository 的所有 branches,可以在進入本地 repository 資料夾後,執行以下命令: ```bash #!/bin/bash for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do git branch --track ${branch#remotes/origin/} $branch; done ``` 執行後可以使用 ```git branch``` 指令確認是否成功 --- ## 參考資料 [Git clone all remote branches locally.](https://co
     Like  Bookmark
  • --- title: 備份 Hexo 原始檔案至 GitHub tags: Hexo --- # 備份 Hexo 原始檔案至 GitHub ## 前言 Hexo 可以快速的將編輯好的 markdown 文件轉換成靜態網頁,並發布到 GitHub 上。但 Hexo 所發布的檔案僅限於最終的 html 文件,並沒有將原本的 markdown 文件與其他設定檔上傳。如果本地端檔案損毀或遺失, GitHub 上會只剩下最後生成的靜態網頁,要再對其進行編輯或新增會是一件很麻煩的事。因此在這邊紀錄如何將 Hexo 的原始檔案備份至 GitHub,這樣即使遇到檔案損毀,也只要重新從 GitHub 上把檔案拉下來就可以快速的回復之前的狀態。 ## 準備工作 已經建好一個 GitHub repository,且使用 Hexo 將靜態網頁發布至某 branch(此處假設為 master)。如果不確定 Hexo 靜態網頁發布的 branch,可以透過 `_config.yml` 查看或修改。 ``` _config.yml deploy: type: github repository: h
     Like  Bookmark
  • --- title: 使用 Hexo 在 GitHub Pages 上建立 Blog date: 2017-08-12 16:59:57 tags: Hexo, GitHub --- # 使用 Hexo 在 GitHub Pages 上建立 Blog ## 前言 最近想開始把一些學習的筆記記錄下來,但又覺得筆記分散在各個資料夾裡不容易整理,瀏覽起來也不方便,因此興起了寫網誌的念頭。本來想直接用現成的 Google Blogger 來紀錄,但覺得在網頁上進行編輯與排版實在是有點麻煩,就開始尋找一個可以將 markdown 文件轉成 html 並幫我把版面全部搞定的方案,這樣我就只要專心紀錄內容就好,不需要去煩惱排版之類的問題。 搜尋了相關資料後,發現 GitHub 提供一個免費的空間讓使用者建立網頁,而且透過 Hexo 可以快速的使用別人設計好的網頁樣板,於是開始嘗試安裝 Hexo 並把 Blog 放在 GitHub 上。 ## 事前準備 1. 一個 GitHub 帳號 2. 先 Google 搜尋一下 `Hexo Theme`,確定有喜歡的 open source 樣板,再開始
     Like  Bookmark
  • --- title: 搬移 Remote Repository 到另一個 Remote Repository tags: Git --- # 搬移 Remote Repository 到另一個 Remote Repository ## 前言 當原本的 remote repository 位於私人網域,GitHub 或 Bitbucket 可能無法透過 http 或 ssh 複製 remote repository,此時可以採用以下做法:先將 repository 拉至本地端,再重新 push 新的 repository 上。 ## 操作說明 1. clone remote repository ```bash git clone ssh://git@my_repo_host/my_repo.git ``` 2. 進入資料庫,將所有 remote branch 拉下來 ```bash cd my_repo for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `;
     Like  Bookmark
  • --- title: "Powerline: 終端機界面小工具" tags: Ubuntu --- # Powerline: 終端機界面小工具 ## 簡介 Powerline 是一個終端機的外掛小工具,支援各種常見的 Shell 與 Vim,可以讓命令提示字元與 Vim 的狀態列更美觀易讀。 ## 安裝 1. Ubuntu 14.04 之後的版本,可以直接使用以下指令安裝 ```bash sudo apt-get install powerline ``` 2. 下載 Powerline 字型與 fontconfig 字型設定檔 ```bash wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf ``` 3. 將 PowerlineSymb
     Like  Bookmark
  • --- title: 將本地 Repository 同時 push 到多個 Remote Repository 上 tags: Git --- # 將本地 Repository 同時 push 到多個 Remote Repository 上 ## 操作說明 假設 remote repository 如下: ```bash git@my_repo_host1/my_repo.git git@my_repo_host2/my_repo.git ``` 1. 進入本地 repository,確認目前的 remote repository ```bash $ cd my_repo $ git remote -v ``` 執行結果如下: ```bash origin git@my_repo_host/my_repo.git (fetch) origin git@my_repo_host/my_repo.git (push) ``` 2. 設定新的 remote repository 注意:第一個設定會覆蓋原本的設定 ```bash $ git remote set-
     Like  Bookmark
  • --- title: 還原 Hexo blog 撰寫環境 tags: Hexo --- # 還原 Hexo blog 撰寫環境 ## 事前準備 確認 Hexo 所需要的環境是否已經安裝完成 * git * Node.js * hexo-cli ## 還原 Hexo 撰寫環境 1. clone 遠端的 Repository ```bash git clone REPOSITORY_URL BLOG ``` 2. 進入 `BLOG` 資料夾,切換至 `SOURCE_BRANCH` ```bash cd BLOG git checkout SOURCE_BRANCH ``` 3. 還原所需要的 npm 套件 ```bash npm install ``` --- ## 參考資料 [Hexo - Restore blog envirement from remote repository.](http://larrynung.github.io/2016/06/12/Hexo-Restore
     Like  Bookmark