Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tomthomasvempala/070b4b78e7fa02666dbb97d0252fb5d0 to your computer and use it in GitHub Desktop.
Save tomthomasvempala/070b4b78e7fa02666dbb97d0252fb5d0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
# Note: This script is specific to my setup and not useful for others.
# You can run this script using this command:
# curl -L https://gist.github.com/tomthomasvempala/070b4b78e7fa02666dbb97d0252fb5d0/raw -o fresh-install-tom.sh; chmod +x ./fresh-install-tom.sh; ./fresh-install-tom.sh
# These env vars are duplicated intentionally since this script would bootstrap the installation
USERNAME=${USERNAME:-$(whoami)}
PERSONAL_PROFILES_DIR=${PERSONAL_PROFILES_DIR:-"${HOME}/Personal/${USERNAME}/profiles"}
PERSONAL_BIN_DIR=${PERSONAL_BIN_DIR:-"${HOME}/.bin"}
rm -rf "${HOME}/.gitconfig-template.inc"
# utility functions
source "${HOME}/.aliases"
override_prompt() {
printf "$(green 'Downloading') $2 : "
if [ ! -f "$2" ]; then
echo "" # Dummy echo for new line
curl -L "$1" -o "$2"
else
read "yn?$(red 'already present'). Should I override [yn]? "
case $yn in
[Yy]*) curl -L "$1" -o "$2" ;;
[Nn]*) echo "$(yellow 'skipping')";;
esac
fi
}
override_prompt https://gist.github.com/vraravam/eb2161236d78fc0bda77/raw "${HOME}/.gemrc"
#######################
# Clone the home repo #
#######################
if [ ! -d "${HOME}/.git" ]; then
rm -rf "${HOME}/tmp"
mkdir -p "${HOME}/tmp"
git clone --depth=1 keybase://private/tomvempala/home_repo "${HOME}/tmp"
mv "${HOME}/tmp/.git" "${HOME}/"
rm -rf "${HOME}/tmp"
############################################################################################################################
# Checkout some of the common dotfiles (these should not have any modifications/conflicts with what is in the remote repo) #
############################################################################################################################
git -C "${HOME}" checkout ".[a-zA-Z]*" Personal
git -C "${HOME}" restore-mtime -c
fi
source "${HOME}/.aliases.${USERNAME}"
###########################
# Clone the profiles repo #
###########################
if [ ! -d "${PERSONAL_PROFILES_DIR}/.git" ]; then
rm -rf "${PERSONAL_PROFILES_DIR}"
git clone --depth=1 keybase://private/tomvempala/profiles_repo "${PERSONAL_PROFILES_DIR}"
git -C "${PERSONAL_PROFILES_DIR}" siu
fi
#########################################
# Fix /etc/hosts file to block facebook #
#########################################
sudo cp "${PERSONAL_BIN_DIR}/macos/etc.hosts" /etc/hosts
##################################################
# Resurrect repositories that I am interested in #
##################################################
sudo chmod -R 600 "${HOME}"/.ssh/*
resurrect-repositories.rb -r "${PERSONAL_CONFIGS_DIR}/repositories-oss.yml"
all restore-mtime -c
allow_all_direnv_configs
install_mise_versions
##################
# Install devbox #
##################
# curl -fsSL https://get.jetpack.io/devbox | bash
# mkdir -p ${HOME}/.config/devbox/lib/ && devbox completion zsh > ${HOME}/.config/devbox/lib/use_devbox.sh
source "${HOME}/.zprofile"
# exec zsh
##############################################
# Load the direnv config for the home folder #
##############################################
cd ..
cd -
# To install the latest versions of the hex, rebar and phoenix packages
# mix local.hex --force && mix local.rebar --force
# mix archive.install hex phx_new 1.4.1
# To install the native-image tool after graalvm is installed
# gu install native-image
# Enabling history for iex shell (might need to be done for each erl that is installed via mise)
# rm -rf tmp
# mkdir -p tmp
# cd tmp || exit
# git clone --depth=1 https://github.com/ferd/erlang-history.git
# cd erlang-history || exit
# sudo make install
# cd ../.. || exit
# rm -rf tmp
# vagrant plugin install vagrant-vbguest
# if installing jhipster for dot-net-core
# TODO: Use the next line since the released version is only for .net 2.2:
# npm i -g generator-jhipster-dotnetcore
# Note: '-g' didnt work. Had to do 'npm init' and then use '--save-dev' to install and link as a local dependency
# npm i -g jhipster/jhipster-dotnetcore
# npm link generator-jhipster-dotnetcore
# jhipster -d --blueprints dotnetcore
###################################################################
# Restore the preferences from the older machine into the new one #
###################################################################
# osx-defaults.sh i
capture-defaults.sh i
# Default tooling for dotnet projects
# dotnet tool install -g dotnet-sonarscanner
# dotnet tool install -g dotnet-format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment