<commit_before>#!/usr/bin/env bash

# open debug
set -x

# exit if command execute doesn't return 0,don't open it
# set -e 

# zsh plugin install and config file place
CUSTOM_PLUGINS="/root/.oh-my-zsh/custom/plugins"
ZSHRC="/root/.zshrc"

YUM_REPO_BACKUP="/etc/yum.repos.d/CentOS-Base.repo.backup"
YUM_EPEL="/etc/yum.repos.d/epel.repo"

if [ ! -f "$YUM_REPO_BACKUP" ]; then
	mv /etc/yum.repos.d/CentOS-Base.repo{,.backup}
	wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
fi

if [ ! -f "$YUM_EPEL" ]; then
	wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
else
	mv /etc/yum.repos.d/epel.repo{,.backup}
	wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
fi

yum clean all && yum makecache -y
# yum update -y

yum install zsh git -y
# yum install vim jq -y

# install oh-my-zsh
# sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

# install useful plugins for zsh.
git clone https://github.com/zsh-users/zsh-completions.git ${CUSTOM_PLUGINS}/zsh-completions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${CUSTOM_PLUGINS}/zsh-syntax-highlighting

sed -i -r -e 's|.*export ZSH|export ZSH|' \
          -e 's|.*ZSH_THEME.*|ZSH_THEME="agnoster"|' \
          -e 's|.*COMPLETION_WAITING_DOTS|COMPLETION_WAITING_DOTS|' \
          -e 's|.*HIST_STAMPS.*|HIST_STAMPS="yyyy-mm-dd"|' \
          -e 's|^plugins.*|plugins=(zsh-completions zsh-syntax-highlighting z httpie git autojump)|' \
          ${ZSHRC}

echo 'alias jq="jq --indent 4"' >> ${ZSHRC}
echo 'alias vi="vim"' >> ${ZSHRC}

source ${ZSHRC} > /dev/null 2>&1

# or chsh -s /bin/zsh
zsh

# view current bash
# ps | grep $$ | awk '{print $4}'<commit_msg>add bin path to zsh for golang<commit_after>#!/usr/bin/env bash

# open debug
set -x

# exit if command execute doesn't return 0,don't open it
# set -e 

# zsh plugin install and config file place
CUSTOM_PLUGINS="/root/.oh-my-zsh/custom/plugins"
ZSHRC="/root/.zshrc"

YUM_REPO_BACKUP="/etc/yum.repos.d/CentOS-Base.repo.backup"
YUM_EPEL="/etc/yum.repos.d/epel.repo"

if [ ! -f "$YUM_REPO_BACKUP" ]; then
	mv /etc/yum.repos.d/CentOS-Base.repo{,.backup}
	wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
fi

if [ ! -f "$YUM_EPEL" ]; then
	wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
else
	mv /etc/yum.repos.d/epel.repo{,.backup}
	wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
fi

yum clean all && yum makecache -y
# yum update -y

yum install zsh git -y
# yum install vim jq -y

# install oh-my-zsh
# sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

# install useful plugins for zsh.
git clone https://github.com/zsh-users/zsh-completions.git ${CUSTOM_PLUGINS}/zsh-completions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${CUSTOM_PLUGINS}/zsh-syntax-highlighting

sed -i -r -e 's|.*export ZSH|export ZSH|' \
          -e 's|.*ZSH_THEME.*|ZSH_THEME="agnoster"|' \
          -e 's|.*COMPLETION_WAITING_DOTS|COMPLETION_WAITING_DOTS|' \
          -e 's|.*HIST_STAMPS.*|HIST_STAMPS="yyyy-mm-dd"|' \
          -e 's|^plugins.*|plugins=(zsh-completions zsh-syntax-highlighting z httpie git autojump)|' \
          ${ZSHRC}

echo 'alias jq="jq --indent 4"' >> ${ZSHRC}
echo 'alias vi="vim"' >> ${ZSHRC}

# if use vim-go plugin
# echo 'export PATH=$PATH:$GOPATH/bin' >> ${ZSHRC}


source ${ZSHRC} > /dev/null 2>&1

# or chsh -s /bin/zsh
zsh

# view current bash
# ps | grep $$ | awk '{print $4}'
{'fraction_non_alphanumeric': 0.18132576734588599, 'fraction_numerical': 0.0041269022440030955, 'mean_word_length': 3.3088888888888888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7354922', 'n_tokens_mistral': 1741, 'n_tokens_neox': 1675, 'n_words': 311}