-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
brew.sh
executable file
·137 lines (109 loc) · 5.35 KB
/
brew.sh
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
if ! command -v brew >/dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "Brew is installed. Make sure bootstrap.bash has been run and then rerun this command"
exit 0
fi
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Make sure we’re using the latest Homebrew, and upgrade any already-installed formulae
brew update && brew upgrade
brew bundle -v || (echo "Brewfile failed, exiting early" && exit 1)
brew cleanup
brew services start redis
# shell
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
(cd ~/.config/ && curl -LO https://raw.githubusercontent.com/sindresorhus/iterm2-snazzy/master/Snazzy.itermcolors) && open ~/.config/Snazzy.itermcolors
# run after nanorc is copied, this modifies nanorc
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | bash -s -- --lite
# iTerm copy mode conflicted with a previous shortcut that I have seared into my memory
# however, I can remap this via macos config. TODO would be great to move this over to `osx.sh`
# https://www.intego.com/mac-security-blog/how-to-make-custom-keyboard-shortcuts-for-any-macos-menu-items-and-to-launch-your-favorite-apps/
# set zsh as default shell
# https://rick.cogley.info/post/use-homebrew-zsh-instead-of-the-osx-default/
sudo dscl . -create $HOME UserShell /opt/homebrew/bin/zsh
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
source ~/.asdf/asdf.sh
# install all plugins in tool-versions
# by adding ~/.tool-versions this sets the default for the whole system
cat ~/.tool-versions | cut -d' ' -f1 | grep "^[^\#]" | xargs -I{} asdf plugin add {}
# fail on subshell error when installing language versions
set -e
asdf install
asdf reshim
set +e
# php / WordPress
# https://github.com/asdf-community/asdf-php/blob/248e9c6e2a7824510788f05e8cee848a62200b65/bin/install#L22
# common php extensions
# check if pecl extension redis is installed as a shell script
# https://stackoverflow.com/questions/592620/how-can-i-check-if-a-program-exists-from-a-bash-script
echo "Installing PHP pecl extensions..."
pecl install redis </dev/null
# imagick is not supported on php8 yet
# https://github.com/Imagick/imagick/issues/358
pecl install imagick </dev/null
pecl install ast </dev/null
pecl install xdebug </dev/null
echo "extension=redis.so
extension=ast.so
extension=imagick.so
zend_extension=$(asdf where php)/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so
display_errors=1
error_reporting=E_ALL
memory_limit=1024M
# xdebug.mode = debug
# xdebug.start_with_request = yes
# xdebug.client_port = 9000
" > $(asdf where php)/conf.d/php.ini
# node
# remember to use `npx npkill` to remove unneeded `node_modules` folders
npm install -g npm
npm install -g hostile
npm install -g yarn
# python
# note: for each python version installed, you'll need to do this
# for the breakpoint() magic to work properly
pip install --upgrade pip
pip install ipython ipdb pdbr ipython-autoimport rich docrepr colorama
# mysql setup
# brew services start mysql
# make sure you run `mysql_secure_installation` and set password to root
# ruby configuration
gem install notes
gem install bundle
gem install method_log
gem install bundler-patch
gem install bundler-audit
# irb / rails console additions
gem install awesome_print
gem install brice
gem install added_methods
gem install looksee
gem install solargraph
# parallel bundler job processing
# https://gist.github.com/cbrunsdon/f9cfe01d7278e2bbc0d4
bundle config --global jobs 4
bundle config --global path vendor/bundle
bundle config --global disable_shared_gems 1
bundle config --global disable_local_branch_check true
# enable touchid sudo
# https://github.com/guillaumegete/touchid-sudo-enabler/blob/main/touchid-sudo-enabler.sh
if [ ! -f /etc/pam.d/sudo_local ] || ! grep -q '^#.*pam_tid.so' /etc/pam.d/sudo_local; then
sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local.template_backup
sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local
sudo sed -i '' '/pam_tid.so/ s/^#//' /etc/pam.d/sudo_local
fi
# let programs that don't properly source the shell know where gpg is
# https://github.com/denolehov/obsidian-git/issues/21
git config --global gpg.program $(which gpg)
# easily create new codespaces for a repo
gh alias set cs-create --shell 'gh cs create --repo $(gh repo view --json nameWithOwner | jq -r .nameWithOwner)'
# create a new public repo from the current directory and enable github actions
gh alias set repo-create --clobber --shell 'repo=$(basename $PWD) && gh repo create --public --source $PWD $repo && owner=$(gh repo view --json owner -q .owner.login) && gh api -X PUT repos/$owner/$repo/actions/permissions -F enabled=true'
gh alias set repo-url --clobber --shell 'url=$(gh repo view --json url --jq ".url" | tr -d " \n"); echo -n "$url" | pbcopy && echo "$url"'
gh alias set repo-events --clobber --shell 'gh api repos/$(gh repo view --json owner -q ".owner.login")/$(gh repo view --json name -q ".name")/events'
gh alias set myprs --clobber --shell 'id=$(set -e; gh pr list -L100 --author $(git config github.user) $@ | fzf | cut -f1); [ -n "$id" ] && gh pr view "$id" --web && echo "$id"'
# docker config
yq -i '.psFormat = "table {{.ID}}\t{{.Image}}\t{{.Names}}"' ~/.docker/config.json