Skip to content

Instantly share code, notes, and snippets.

@thanch2n
Last active April 21, 2019 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thanch2n/d19f7ddb8affb76f852ecb1c1f87e6fd to your computer and use it in GitHub Desktop.
Save thanch2n/d19f7ddb8affb76f852ecb1c1f87e6fd to your computer and use it in GitHub Desktop.

Get a brand new Mac

System Preferences

  1. Trackpad — Tap to click
  2. Keyboard — shortcuts — input source — select the previous input source
  3. Accessibility — mouse & trackpad — trackpad options — enable dragging — without drag lock
  4. Dock — automatically hide
  5. Sharing — computer name
  6. Date & time — clock — use a 24-hour clock — show the day of the week
  7. Desktop — screen saver — hot corners — LU:mission control, LD:launchpad, RD:desktop
  8. Terminal — run “echo YOURPASSWORD | sudo -S spctl --master-disable”
  9. Terminal — run “echo YOURPASSWORD | sudo -S pmset -b tcpkeepalive 0”
  10. Security & privacy — allow apps download from: anywhere

Terminal

  1. profiles — basic — color & effects — opacity=80%, blur=0%

ClashX

# Download
gtag(){
    curl --silent https://api.github.com/repos/$1/$2/releases/latest | awk -F '"' '/tag_name/{print $4}'
}
URL=https://github.com/yichengchen/clashX/releases/download/$(gtag yichengchen clashX)/ClashX.dmg
FILE=ClashX.dmg
curl --fail --silent --show-error --location-trusted --retry 3 --retry-max-time 60 $URL -o $FILE

# Install
test ! -r "/Applications/CurrentInstalled" && mkdir -p /Applications/CurrentInstalled
hdiutil attach ClashX.dmg -mountpoint  /Volumes/tmp/
/bin/cp -a /Volumes/tmp/ClashX.app /Applications/CurrentInstalled/ClashX.app
hdiutil detach /Volumes/tmp/
rm -f ClashX.dmg

# Run
open /Applications/CurrentInstalled/ClashX.app
sed -i "" -e "/port/ s/7890/6152/" -e "/socks-port/ s/7891/6153/" ~/.config/clash/config.yml

Homebrew

alias setproxy='export https_proxy=http://127.0.0.1:6152;export http_proxy=http://127.0.0.1:6152;export all_proxy=socks5://127.0.0.1:6153'
alias unsetproxy='unset http_proxy;unset https_proxy;unset all_proxy'
setproxy
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

oh-my-zsh

# oh-my-zsh
git config --global http.proxy http://127.0.0.1:6152
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Dot conf files

cd ~/
#git clone git@bitbucket.org:thanch2n/conf_files.git .my_conf_files
git clone git@github.com:thanch2n/conf_files.git .my_conf_files
rm -f .gitconfig
ln -s .my_conf_files/gitconfig .gitconfig
ln -s .my_conf_files/Brewfile .Brewfile
brew bundle --global
ln -s .my_conf_files/tmux.conf .tmux.conf
ln -s .my_conf_files/alias .alias
rm -f .zshrc
ln -s .my_conf_files/zshrc .zshrc # watch the username
rm -f .config/clash/config.yml
cd ~/.config/clash
ln -s ~/.my_conf_files/config.yml config.yml
[ ! -e ~/.ssh ] && mkdir ~/.ssh && chmod 600 ~/.ssh
cd ~/.ssh/
ln -s ~/.my_conf_files/config config
ln -s ~/.my_conf_files/id_rsa id_rsa
chmod 600 id_rsa
ln -s ~/.my_conf_files/id_rsa.pub id_rsa.pub
gpg --list-keys
gpg --import secret_key.gpg #3344

Safari

General -- safari opens with -- all windows from last session Advanced -- show develop menu in menu bar

extension -- https://safari-extensions.apple.com

open https://safari-extensions.apple.com/details/?id=org.adblockplus.adblockplussafari-GRYYZR985A
open https://safari-extensions.apple.com/details/?id=com.grammarly.spellchecker.extension-W8F64X92K3
open https://safari-extensions.apple.com/details/?id=com.microsoft.onenote.clipper-UBF8T346G9
open https://safari-extensions.apple.com/details/?id=com.ideashower.pocket.safari-ET279A6R5N
open https://safari-extensions.apple.com/details/?id=net.tampermonkey.safari-G3XV72R5TC
open https://safari-extensions.apple.com/details/?id=com.sidetree.Translate-S64NDGV2C5
open https://safari-extensions.apple.com/details/?id=com.gggritso.vimmy-36948PQEY6
open https://safari-extensions.apple.com/details/?id=com.bumblebee.wastenotime-E6Q24JUVVZ

Apps

for i in $(ls *.dmg); do \
    hdiutil attach $i -mountpoint  /Volumes/tmp/ ;\
    APPNAME=$(basename /Volumes/tmp/*.app);\
    cp -a /Volumes/tmp/${APPNAME} /Applications/CurrentInstalled/${APPNAME}; \
    hdiutil detach /Volumes/tmp/;\ 
done

Tips:

快捷键 适用程序 功能
⌘ + ⌃ +  Space 输入法 Show facemarks & punctuation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment