Skip to content

Instantly share code, notes, and snippets.

@yakimka
Last active February 19, 2022 13:38
Show Gist options
  • Save yakimka/211f7cf2ea0ff50545259dd0db1c65f1 to your computer and use it in GitHub Desktop.
Save yakimka/211f7cf2ea0ff50545259dd0db1c65f1 to your computer and use it in GitHub Desktop.
Update configs from my GitHub repositories
#!/bin/bash
###
# Config
###
GITCONFIG=https://gist.githubusercontent.com/yakimka/2642f68bb40b247e13d39f9cf0ac3ea3/raw/.gitconfig
GITEXCLUDES=https://gist.githubusercontent.com/yakimka/2642f68bb40b247e13d39f9cf0ac3ea3/raw/.gitexcludes
GITCONFIG_LOCATION=~/.gitconfig
GITEXCLUDES_LOCATION=~/.gitexcludes
ZSH_CONFIGS_REPO_NAME=zsh-configs
ZSH_CONFIGS_REPO=https://github.com/yakimka/$ZSH_CONFIGS_REPO_NAME.git
ZSH_CONFIGS_LOCATION=~/.zshconfigs
DEFAULT_PROMPT_FOR_IPYTHON=https://gist.githubusercontent.com/yakimka/10b83754dedd1484a5ae255e648ced5d/raw/python_interp_prompt.py
###
###
echo Configure gitconfig
###
wget $GITCONFIG -O $GITCONFIG_LOCATION --quiet
if [[ ! -v GIT_NAME ]]; then
read -p "Enter a user git name: " GIT_NAME
fi
if [[ ! -v GIT_EMAIL ]]; then
read -p "Enter a user git email: " GIT_EMAIL
fi
sed -e '
s/{{git_name}}/'"$GIT_NAME"'/
s/{{git_email}}/'"$GIT_EMAIL"'/' -i $GITCONFIG_LOCATION
wget $GITEXCLUDES -O $GITEXCLUDES_LOCATION --quiet
echo 'Done
'
###
echo Update zsh configs
###
ZSH_CONFIGS_TMP_DIR=/tmp/$ZSH_CONFIGS_REPO_NAME
rm -rf $ZSH_CONFIGS_TMP_DIR
git clone --quiet $ZSH_CONFIGS_REPO $ZSH_CONFIGS_TMP_DIR
mkdir -p $ZSH_CONFIGS_LOCATION
mv -f $ZSH_CONFIGS_TMP_DIR/* $ZSH_CONFIGS_LOCATION
rm -rf $ZSH_CONFIGS_TMP_DIR
touch $ZSH_CONFIGS_LOCATION/local
echo 'Done
Now you can add these lines to your .zshrc
source '"$ZSH_CONFIGS_LOCATION"'/common
source '"$ZSH_CONFIGS_LOCATION"'/pydev
source '"$ZSH_CONFIGS_LOCATION"'/js
source '"$ZSH_CONFIGS_LOCATION"'/docker
source '"$ZSH_CONFIGS_LOCATION"'/local
'
###
echo 'Configure default python interpreter prompts for ipython'
###
mkdir -p ~/.ipython/profile_default/startup/
wget $DEFAULT_PROMPT_FOR_IPYTHON -O ~/.ipython/profile_default/startup/python_interp_prompt.py --quiet
echo Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment