-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbrew.sh
executable file
·94 lines (74 loc) · 3.98 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
#!/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
# 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
curl https://mise.run | sh
eval "$(mise activate zsh)"
mise install -y
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall -y usage-cli
# 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
# tried bun + pnpm, but they do not have as good support by mise, it's easier to use npm for tooling
npm install -g npm
npm install -g hostile
npm install -g yarn
npm install -g @sourcegraph/cody
# 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 --state=all -L100 --author $(git config github.user) $@ | fzf | cut -f1); [ -n "$id" ] && gh pr view "$id" --web && echo "$id"'