Skip to content

Instantly share code, notes, and snippets.

View lyshie's full-sized avatar

HSIEH, Li-Yi (SHIE, Li-Yi) lyshie

View GitHub Profile
@lyshie
lyshie / gist:12c3737ce999b0f4ac435c2e738a7451
Last active August 16, 2017 11:31 — forked from samhocevar/gist:00eec26d9e9988d080ac
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <sam@hocevar.net>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-i686-editrights
#
@lyshie
lyshie / test_dcs.sh
Last active September 9, 2017 16:13
Connection test for dcs.tn.edu.tw
# IPv4
curl -# -v -4 http://chpsxoops.dcs.tn.edu.tw/1gb 2>&1 > /dev/null
# IPv6
curl -# -v -6 http://chpsxoops.dcs.tn.edu.tw/1gb 2>&1 > /dev/null
@lyshie
lyshie / aqi.html
Created September 9, 2017 16:16
AQI (Air Quality Index) for Tainan
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title></title>
<script src="//code.jquery.com/jquery-latest.min.js"></script>
</head>
@lyshie
lyshie / pm25.html
Created September 9, 2017 16:18
EDIMAX Airbox (PM2.5)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>PM2.5</title>
</head>
<body>
@lyshie
lyshie / code_org_print_cards.css
Last active October 30, 2017 01:12
Code.org 列印登入卡片,節省紙張使用與方便裁剪。
div.all_cards {
margin: 0px !important;
}
div.signin_card {
margin: 0px !important;
padding: 1px !important;
}
div.signin_card dl:nth-child(1) {
@lyshie
lyshie / README.md
Last active December 15, 2017 12:56
Linux 下使用 BLE (Bluetooth Low Energy) 與 Micro:bit 溝通

安裝 Gobot

$ go get -d -u gobot.io/x/gobot/...

安裝 gort

$ cd /tmp
$ wget https://s3.amazonaws.com/gort-io/0.9.0/gort_0.9.0_linux_amd64.tar.gz
$ tar xvfz gort_0.9.0_linux_amd64.tar.gz
@lyshie
lyshie / terminal_free_20ms_before.py
Last active December 27, 2017 15:00
Micro:bit hangs at read_analog() - MicroPython
# Add your Python code here. E.g.
from microbit import *
uart.init(115200)
x = 0
pin0.write_analog(80)
sleep(1000)
while True:
@lyshie
lyshie / gitbook-to-rpm.md
Last active July 17, 2018 07:00
Convert GitBook from deb to rpm (tested on Fedora 26/27)

Convert deb to rpm

$ sudo alien -r --keep-version gitbook-editor-7.0.12-linux-x64.deb
$ rpmrebuild -pe gitbook-editor-7.0.12-1.x86_64.rpm

Delete unnecessary lines in rpm spec

Requires:      libnode.so()(64bit)
Requires:      libffmpeg.so()(64bit)
@lyshie
lyshie / upgrade_tn_iaas.md
Last active June 17, 2019 13:00
如何升級臺南市 IaaS 虛擬主機的 Ubuntu (How to upgrade Ubuntu from 12 to the latest version?)

原理

因臺南市 IaaS 虛擬主機沒有提供 console 畫面進行管理,所以必須透過 SSH 遠端登入來操作。網路連線實為必要,如在 VM 上可透過 PXE 優先開機,便可使用以下方法進行移機。透過 PXE Server 的啟用與停用,等同於切換網路開機或本機開機。最後使用 chroot 方式轉移系統。

一、設定 PXE Server

透過 PXE Server 派送 IP 與作業系統給 IaaS 上的 Ubuntu 主機,提供網路開機與簡易的 GNU/Linux 作業系統環境。

二、切換開機模式

  • 設定 VM 開機順序第一個是 PXE,下一個是本機硬碟,停用網路開機就可回到本機硬碟開機。
  • 將 PXE Server 置於同網段內,提供網路開機,派送 SystemRescueCd
  • 開機順序
@lyshie
lyshie / README.md
Last active July 2, 2019 08:37
Batch convert docx/doc to pdf with powershell (課程計畫上傳PDF使用)

如何使用 docx2pdf 工具將 docx/doc 檔案批次轉換為 pdf

  • 下載 docx2pdf
  • 解壓縮後,將 docx2pdf.cmddocx2pdf.ps1 檔案放置於最上層目錄
  • 執行 docx2pdf.cmd