Mac

Show dotfiles

CMD + SHIFT + .

PostgreSQL

$ brew install postgresql
$ brew services start postgresql
$ createdb `whoami`

Nginx

$ brew install nginx
$ brew services start nginx

OpenResty

$ brew install openresty/brew/openresty
$ brew services start openresty

V2Ray

$ brew tap v2ray/v2ray
$ brew install v2ray-core
$ brew services start v2ray-core

Brew

列出某个包安装的所有文件:

$ brew list postgresql
$ brew list -v postgresql

Bash

$ brew install bash
$ brew install bash-completion@2
$ brew install git

sudo

sudo 使用 Touch ID,将下面一行放到 /etc/pam.d/sudo 的最上面:

auth sufficient pam_tid.so

Python

$ brew install python
$ ln -s -f /usr/local/bin/python3.7 /usr/local/bin/python
$ ln -s -f /usr/local/bin/pip3 /usr/local/bin/pip

JDK

$ brew tap homebrew/cask-versions
$ brew cask install java11
$ brew cask info java11

Ctrl+w everywhere

$ vim ~/Library/KeyBindings/DefaultKeyBinding.dict

{
    "^w" = "deleteWordBackward:";
}

VScode key repeating

$ defaults delete com.microsoft.VSCode ApplePressAndHoldEnabled
$ defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false

Font Smoothing

$ defaults -currentHost write -g AppleFontSmoothing -int 0
$ reboot

Note that you can adjust the level of smoothing more granually by changing the number at the end of this command. The “0” disables font smoothing, while “1” enables light font smoothing, “2” enables default medium smoothing, and “3” enables strong smoothing. For example, if after disabling font smoothing you want to return to the default setting, replace the “0” at the end of the command with a “2.”

html {
    -webkit-font-smoothing: antialiased;
}

for Safari, save this with a .css extension somewhere and select it as the custom stylesheet in Preferences > Advanced.

defaults write com.apple.Safari AppleFontSmoothing -int 0 would also disable subpixel rendering in the UI.