Skip to content

Instantly share code, notes, and snippets.

@mayani
Last active May 4, 2023 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayani/7f55a3a6453fa6fbb9b540418ce5de49 to your computer and use it in GitHub Desktop.
Save mayani/7f55a3a6453fa6fbb9b540418ce5de49 to your computer and use it in GitHub Desktop.
Scitech Mac Setup

Install Rosetta (Only on Apple Silicon)

softwareupdate --install-rosetta --agree-to-license

Setup SSH

mkdir ~/.ssh
 
cd ~/.ssh
 
ssh-keygen -t ed25519 -C "$USER"
# Enter a password when prompted
 
# Send id_ed25519.pub file to group admins.

Setup GitHub

  1. Copy contents of ~/.ssh/id_ed25519.pub file to the clipboard and add a new SSH key to your GitHub account at https://github.com/settings/keys.

  2. If you will be working on PegasusHub, then generate a new Personal access token from https://github.com/settings/tokens with repo scope selected.

Setup Brew

Install Brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Add Brew Taps

brew tap homebrew/cask
brew tap homebrew/core
brew tap homebrew/services
brew tap pegasus-isi/tools

Install Packages

# On Apple Silicon do not install virtualbox virtualbox-extension-pack
brew install --cask chromedriver docker r vagrant virtualbox virtualbox-extension-pack xquartz zoom zotero

brew install ant ant-contrib coreutils direnv geckodriver git git-lfs graphviz htcondor libyaml maven mysql pyenv pyenv-virtualenv sphinx-doc tox twine-pypi watch wget yarn

brew services start htcondor
git lfs install
sudo git lfs install --system

cat >> ~/.zprofile <<EOF
# ---------
# ISI Setup
# ---------

brewup () {
  brew upgrade
  brew upgrade --cask \`brew list --cask -1\`
  brew cleanup
  brew services cleanup
  yarn global upgrade
}

pipup () {
  for i in \`find ~/.pyenv/versions -type l -depth 1 | sort\`; do
    NAME=\`basename $i\`
    echo "-- \$NAME --"
    pyenv shell \$NAME
    pip install -U pip setuptools
    pyenv shell --unset
  done
}

venvclear () {
  for NAME in \$@; do
    echo "-- \$NAME --"
    pyenv shell \$NAME
    pip freeze | cut -d'=' -f1 | cut -d' ' -f1 | grep -vE '(pip|^-e|#)' | xargs pip uninstall -y
    pyenv shell --unset
  done
}

LIBRARY_PATH=\`brew --prefix openssl\`/lib
LDFLAGS="-L\${LIBRARY_PATH}"

# pyenv
eval "\$(pyenv init --path)"

# pyenv-virtualenv
PYENV_VIRTUALENV_DISABLE_PROMPT=1

# Pegasus disable R builds
PEGASUS_BUILD_R_MODULES=0

PEGASUSHUB_TOKEN="<PERSONAL_ACCESS_TOKEN_FROM_GITHUB_GENERATED_ABOVE>" 

export LIBRARY_PATH LDFLAGS PEGASUS_BUILD_R_MODULES PEGASUSHUB_TOKEN PYENV_VIRTUALENV_DISABLE_PROMPT
EOF

Start Docker from Mac's Applications

Setup Python

Install Python Versions

# List Python Versions
pyenv install -l | grep -E "^  3.*"

# Install 3.{5,6,..}.<X>, X is the highest stable version available
pyenv install 3.5.<X>
pyenv install 3.6.<X> 
.
.
pyenv install 3.<MAX>.<X>

Common tools

pyenv virtualenv -p python3 3.7.<X> pytools
pyenv shell pytools
pip install -U pip setuptools wheel autoflake pyupgrade isort black flake8 flake8-bugbear flake8-docstrings mypy pytest tox pre-commit rope
pyenv shell --unset

yarn global add commitizen

For each project create and use a Virtualenv

# For Pegasus
git clone git@github.com:pegasus-isi/pegasus.git

cd pegasus

# Replace the .1 below with the version installed earlier
pyenv virtualenv -p python3 3.5.1 pegasus-35
pyenv virtualenv -p python3 3.6.1 pegasus-36
pyenv virtualenv -p python3 3.7.1 pegasus-37
pyenv virtualenv -p python3 3.8.1 pegasus-38
pyenv virtualenv -p python3 3.9.1 pegasus-39
pyenv virtualenv -p python3 3.10.1 pegasus-310

pyenv local pegasus-35 pegasus-36 pegasus-37 pegasus-38 pegasus-39 pegasus-310 pytools

Generate hashed password

docker run -it --rm centos:7 python -c 'import crypt,getpass; print(crypt.crypt(getpass.getpass()))'
# Enter your ISI ADS password when prompted

# Send the hashed password to group admins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment