-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinit-app-preference.sh
More file actions
115 lines (89 loc) · 5.42 KB
/
init-app-preference.sh
File metadata and controls
115 lines (89 loc) · 5.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env zsh
set -ex
# Git Config
git config --global init.defaultBranch main
git config --global user.name zthxxx
git config --global user.email zthxxx.me@gmail.com
git config --global core.ignorecase false
git config --global core.quotepath false
git config --global pull.ff only
## https://github.com/banga/git-split-diffs
## install `git-split-diffs` in 'init-application.sh'
git config --global core.pager "git-split-diffs --color | less -RFX"
git config --global split-diffs.theme-name dark
## push the current branch with the same name on the remote
## https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault
git config --global push.default simple
## Reuse Recorded Resolution in git-rebase
## https://blog.gitbutler.com/git-tips-1-theres-a-git-config-for-that/#reuse-recorded-resolution
git config --global rerere.enabled true
git config --global rerere.autoUpdate true
## https://blog.gitbutler.com/git-tips-2-new-stuff-in-git/#some-git-branch-stuff
git config --global branch.sort -committerdate
git config --global column.ui auto
## https://blog.gitbutler.com/git-tips-2-new-stuff-in-git/#safe-force-pushing
## always using `git push --force-with-lease` instead of `git push --force`
git config --global alias.pushf push --force-with-lease
## https://docs.gitlab.com/ee/user/project/repository/signed_commits/ssh.html#verify-commits-locally
touch ~/.ssh/allowed_signers
git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers
### if allowed_signers file not contains public key, append it
if ! grep -qFf ~/.ssh/zthxxx.ed25519.pub ~/.ssh/allowed_signers 2>/dev/null; then
# format of "ALLOWED SIGNERS" section in `ssh-keygen`
echo "zthxxx.me@gmail.com $(cat ~/.ssh/zthxxx.ed25519.pub)" >> ~/.ssh/allowed_signers
fi
## https://blog.gitbutler.com/git-tips-1-theres-a-git-config-for-that/#conditional-configs
mkdir -p ~/.config/git
git config --file ~/.config/git/github.zthxxx user.name zthxxx
git config --file ~/.config/git/github.zthxxx user.email zthxxx.me@gmail.com
git config --file ~/.config/git/github.zthxxx user.signingKey '~/.ssh/zthxxx.ed25519'
git config --file ~/.config/git/github.zthxxx commit.gpgsign true
git config --file ~/.config/git/github.zthxxx gpg.format ssh
git config --global 'includeIf.hasconfig:remote.*.url:git@github.com:zthxxx/**.path' '~/.config/git/github.zthxxx'
if ! grep -qFf ~/.ssh/zthxxx.claw.ed25519.pub ~/.ssh/allowed_signers 2>/dev/null; then
# format of "ALLOWED SIGNERS" section in `ssh-keygen`
echo "zthxxx.me@gmail.com $(cat ~/.ssh/zthxxx.claw.ed25519.pub)" >> ~/.ssh/allowed_signers
fi
git config --file ~/.config/git/github.kachya-claw user.name kachya-claw
git config --file ~/.config/git/github.kachya-claw user.email zthxxx.me+claw@gmail.com
git config --file ~/.config/git/github.kachya-claw user.signingKey '~/.ssh/zthxxx.claw.ed25519'
git config --file ~/.config/git/github.kachya-claw commit.gpgsign true
git config --file ~/.config/git/github.kachya-claw gpg.format ssh
git config --file ~/.config/git/github.kachya-claw core.sshCommand 'ssh -o IdentitiesOnly=yes -i ~/.ssh/zthxxx.claw.ed25519'
git config --global 'includeIf.hasconfig:remote.*.url:git@github.com:kachya-claw/**.path' '~/.config/git/github.kachya-claw'
git config --global 'includeIf.gitdir:~/Project/Homelab/Claw/.path' '~/.config/git/github.kachya-claw'
# gpg for Git committer for all web commits made on GitHub.com
curl -sS https://github.com/web-flow.gpg | gpg --import
# # screen & tmux config
# https://github.com/zthxxx/tmux-config
# curl -sLH 'Cache-Control: no-cache' https://gist.github.com/zthxxx/df7e121048b12c80f260285d88e1091f/raw/.screenrc -o ~/.screenrc
# curl -sLH 'Cache-Control: no-cache' https://gist.github.com/zthxxx/bbbb37c100254d688236c21e8b977b85/raw/.tmux.conf -o ~/.tmux.conf
# mackup setting: https://github.com/lra/mackup/blob/master/doc/README.md#icloud
cp ./app-preferences/mackup.cfg ~/.mackup.cfg
# pip config
mkdir -p ~/.pip/
cp ./app-preferences/pip.conf ~/.pip/pip.conf
# aria2 config: https://aria2.github.io/manual/en/html/aria2c.html#aria2-conf
mkdir -p ~/.aria2/
cp ./app-preferences/aria2.conf ~/.aria2/aria2.conf
local bt_tracker=`curl -sSL -H 'Cache-Control: no-cache' https://github.com/ngosang/trackerslist/raw/master/trackers_all.txt | perl -0pe "s/\n+/,/gms"`
perl -i -pe "s#^bt-tracker=.*#bt-tracker=${bt_tracker}#g" ~/.aria2/aria2.conf
# iTerm2 preference
# Save:
# - iTerm2 menu > Preferences > "General" tab > "Preferences" > Load preferences from a custom folder > Save Now
# then, change file name to `iTerm2.plist`.
# `mv app-preferences/com.googlecode.iterm2.plist app-preferences/iTerm2.plist`
#
# - iTerm2 menu > Profiles > Localhost > Other Actions > Save Profile As JSON
## https://iterm2.com/documentation-dynamic-profiles.html
## https://stackoverflow.com/questions/22943676/how-to-export-iterm2-profiles
defaults import com.googlecode.iterm2 ./app-preferences/iTerm2.plist
## iTerm2 plist 中已经包含所有 profiles
# mkdir -p ~/Library/Application\ Support/iTerm2/DynamicProfiles
# cp ./app-preferences/iTerm2-profile-Localhost.json ~/Library/Application\ Support/iTerm2/DynamicProfiles/Localhost.json
## iTerm2 lrzsz setup
# https://gist.github.com/zthxxx/9171c12538605d92781b74274ba8b9e1
# https://github.com/laggardkernel/iterm2-zmodem
# https://github.com/laggardkernel/homebrew-tap/blob/master/Formula/iterm2-zmodem.rb
brew info laggardkernel/tap/iterm2-zmodem
open "https://github.com/laggardkernel/homebrew-tap/blob/master/Formula/iterm2-zmodem.rb"