Skip to content

Instantly share code, notes, and snippets.

@zew13
Created March 7, 2023 06:23
Show Gist options
  • Save zew13/8eef9a5fcb5656d9c9cd909776a0b929 to your computer and use it in GitHub Desktop.
Save zew13/8eef9a5fcb5656d9c9cd909776a0b929 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -ex
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
sudo rm /etc/hosts
sudo ln -s $DIR/hosts /etc/hosts
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
if [ ! hash brew ] 2>/dev/null; then
git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
/bin/bash brew-install/install.sh
rm -rf brew-install
fi
if [ ! -d "/Applications/WezTerm.app" ]; then
brew tap wez/wezterm
brew install --cask wez/wezterm/wezterm
fi
npm install -g pnpm
pnpm i -g stylus-supremacy @antfu/ni npm-check-updates picgo rome@next prettier @prettier/plugin-pug
cd $DIR
crontab crontab.txt
cd $DIR/home
function init_home() {
if [ ! -L "~/$1" ]; then
rm -rf ~/$1
ln -s $DIR/home/$1 ~/
fi
}
init_home .tool-versions
init_home .picgo
init_home .gnupg
init_home .zshenv
init_home .bash_aliases
init_home .bash_profile
init_home .bin
init_home .cargo
init_home .config
init_home .gist
init_home .gitconfig
init_home .gitignore
init_home .p10k.zsh
init_home .ssh
init_home .tmux.conf
init_home .tmux.conf
init_home .tmux_default
init_home .zshrc
init_home .zinit.zsh
init_home .zprofile
init_home shutdown.sh
sudo chmod 600 ~/.ssh/*
sudo chmod 700 ~/.ssh/
if [ ! -f "$HOME/.cargo/env" ]; then
export RUSTUP_UPDATE_ROOT=https://static.rust-lang.org/rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup -v install nightly
rustup +nightly update
fi
rustup target add wasm32-unknown-unknown
cargo install --git https://github.com/user-tax-dev/ripgrep.git
cargo install cargo-watch cargo-edit cargo-update erdtree cargo-cache rtx-cli cargo-binstall wasm-pack wasm-bindgen-cli
eval "$(rtx activate bash)"
rtx install --all
if [ ! -d "$HOME/.zinit" ]; then
mkdir -p ~/.zinit &&
git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin --depth=1 &&
git clone --depth=1 https://github.com/romkatv/gitstatus.git ~/.gitstatus &&
cat $HOME/.zinit.zsh | rg "program|load|source|light" | zsh &&
source ~/.zinit/plugins/romkatv---powerlevel10k/gitstatus/install
fi
if ! [ -x "$(command -v nvim)" ]; then
brew install neovim
fi
pip3 install --upgrade pip pynvim ipython xonsh
if [ ! -f /etc/vim/plug.vim ]; then
sudo mkdir -p /etc/vim
sudo chown $USER /etc/vim
curl -fLo /etc/vim/plug.vim --create-dirs https://ghproxy.com/https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim &&
vi -E +PlugInstall +qa &&
vi +'CocInstall -sync coc-json coc-yaml coc-css coc-python coc-vetur coc-tabnine coc-svelte' +qa
fi
if ! [ -x "$(command -v bun)" ]; then
brew tap oven-sh/bun
brew install bun
fi
if [[ ! -d ~/sh ]]; then
ln -s $DIR/sh ~/sh
fi
brew tap homebrew/cask-fonts
brew install --cask font-cascadia-code
brew install --cask font-cascadia-code-pl
brew install --cask font-cascadia-mono
brew install --cask font-cascadia-mono-pl
cd $DIR
cat ./brew.txt | xargs -I % brew install %
cat ./brew-cask.txt | xargs -I % brew install %
picgo add compress-webp-lossless
picgo config plugin compress-webp-lossless
#picgo use transformer
picgo add s3
#picgo use uploader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment