Skip to content

Instantly share code, notes, and snippets.

@tanyuan
tanyuan / example.png
Last active March 12, 2016 14:07
Plot confusion matrix in grey scale.
example.png
@tanyuan
tanyuan / sketchup.md
Last active April 20, 2016 16:18
SketchUp 建模3D列印技巧

SketchUp 建模3D列印

下載免費的 SketchUp Make 即可。注意剛開始選擇 Template 的時候選擇給3D列印,單位是 mm 的,才夠精準。

原則:精準,一次完成

  • 剛開始在紙上畫出所有精確的長度(用游標卡尺),建模時用精準的數字,因為之後不能改。
  • 移動時多利用參考線(量尺),畫出很多現之後才能精準的移動。
  • 從一個原始物件慢慢「推出」立體,而不要用許多物件組成一個物體。
@tanyuan
tanyuan / extract-bib.py
Created April 1, 2016 12:45
Rename academic papers to author-year-title.pdf.
import argparse
import bibtexparser
if __name__ == '__main__' :
parser = argparse.ArgumentParser(description='Extract bib file to author, year, and title.')
parser.add_argument('input', help='Input file (.bib)')
args = parser.parse_args()
filename = args.input
@tanyuan
tanyuan / git-merge-branch.md
Created April 5, 2016 00:47
How to merge the right and easy way.

Git: Merge remote branch

  1. git fetch origin BRANCH
  2. git merge origin BRANCH
  3. Resolve conflict:
    • Manually. grep -lr '<<<<<<<' .
  • Choose one side.git checkout --ours PATH/FILE or git checkout --theirs PATH/FILE
@tanyuan
tanyuan / processing-arduino-serial.md
Created April 13, 2016 00:58
Robust serial transmitting between Processing and Arduino

Send a big number from Processing to Arduino through serial

We would like to send a big number (0-1023) from Processing to Arduino (which can only read 0-255 at a time).

In Processing:

import processing.serial.*;

Serial arduino;
@tanyuan
tanyuan / smart-caps-lock.md
Last active May 9, 2025 20:31
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

Caps Lock 變成智慧的 Control 以及 Escape

  • 單獨輕按一下就是 Escape
  • 若按下時同時按著其他鍵,就會是 Control

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.
@tanyuan
tanyuan / mac-tips.md
Last active April 23, 2019 06:42
Mac Tips

Mac Tips

🗂 Tabs

System Preferences:

  • Dock > Prefer tabs when opening documents > Always.
  • Tabs are built in many Apple apps.
    • See an overview of tabs by View > Show All Tabs.
  • Merge tabs across windows by Window > Merge All Windows.
@tanyuan
tanyuan / mouse-button-mapping.md
Created April 18, 2016 11:22
Mouse Button Mapping on Linux

Mouse Button Mapping on Linux

I use Logitech Mouse M705 so I get extra mouse buttons to bind to desired functions.

You need xev, xbindkeys and xdotool installed.

Step 1. Find out button number

Run to find out the current keyboard/mouse key number:

@tanyuan
tanyuan / inkscape.md
Created April 20, 2016 16:09
Inkscape tips for Illustrator users

Inkscape Notes For Users From Illustrator

Shortcuts

  • In menu Edit > Preferences > left panel Interface > Keyboard Shortcuts, set Shortcut file to Adobe Illustrator, so you have V to select, A to edit nodes, P for pen tool etc.

  • Set Ctrl+D as duplicate.

  • Set zoom in and out with =, -.

@tanyuan
tanyuan / archlinux.md
Created April 21, 2016 13:20
Arch Linux 為什麼這麼迷人?

Arch Linux 為什麼這麼迷人?

Arch Linux 是眾多 Linux 作業系統中的一種,對象是有 Linux 指令操作經驗的「進階使用者」,想要打造更適合自己的環境,例如不同的桌面、視窗環境等,體驗最新的套件。

Arch Linux 只有文字介面,不包含圖形介面。也就是說,當你安裝完 Arch Linux 之後,你會看到整個螢幕黑黑一片,電腦期待著你用鍵盤輸入文字指令。Arch Linux 只提供最基本可以讓電腦跑起來的功能,其他套件都要自己安裝。

成為掌握一切的設計師

Arch Linux 不會裝你不會用到的東西,你會自己親自打造完全屬於自己的電腦。不會有程式任意自動啟動,不會有人強迫你更新。你可以把你的電腦改成任何模樣,同樣你也為你的電腦的易用性和安全性負責。