<commit_before>#! /bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#===============================================================================================
#   System Required:  CentOS, Debian, Ubuntu
#   Description:  One click Install Shadowsocks(go)
#   Author: Teddysun <<EMAIL>>
#   Intro:  http://boxcore.org
#===============================================================================================

clear
echo ""
echo "#############################################################"
echo "# One click Install Shadowsocks(go)"
echo "# Intro: http://boxcore.org"
echo "#"
echo "# Author: BoxCore <<EMAIL>>"
echo "#"
echo "#############################################################"
echo ""

# Make sure only root can run our script
function rootness(){
    if [[ $EUID -ne 0 ]]; then
       echo "Error:This script must be run as root!" 1>&2
       exit 1
    fi
}

# Check OS
function checkos(){
    if [ -f /etc/redhat-release ];then
        OS=CentOS
    elif [ ! -z "`cat /etc/issue | grep bian`" ];then
        OS=Debian
    elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then
        OS=Ubuntu
    else
        echo "Not supported OS, Please reinstall OS and retry!"
        exit 1
    fi
}

# Get version
function getversion(){
    if [[ -s /etc/redhat-release ]];then
        grep -oE  "[0-9.]+" /etc/redhat-release
    else    
        grep -oE  "[0-9.]+" /etc/issue
    fi    
}

# CentOS version
function centosversion(){
    local code=$1
    local version="`getversion`"
    local main_ver=${version%%.*}
    if [ $main_ver == $code ];then
        return 0
    else
        return 1
    fi        
}

# is 64bit or not
function is_64bit(){
    if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then
        return 0
    else
        return 1
    fi        
}

# Disable selinux
function disable_selinux(){
if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config; then
    sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
    setenforce 0
fi
}

# Pre-installation settings
function pre_install(){
    # Set shadowsocks-go config password
    echo "Please input password for shadowsocks-go:"
    shadowsockspwd="<PASSWORD>"
    echo "password:$<PASSWORD>"
    echo "####################################"
    get_char(){
        SAVEDSTTY=`stty -g`
        stty -echo
        stty cbreak
        dd if=/dev/tty bs=1 count=1 2> /dev/null
        stty -raw
        stty echo
        stty $SAVEDSTTY
    }
    echo ""
    echo "Press any key to start...or Press Ctrl+C to cancel"
    char=`get_char`
    #Install necessary dependencies
    if [ "$OS" == 'CentOS' ];then
        yum install -y wget unzip gzip curl
    else
        apt-get -y update
        apt-get install -y wget unzip gzip curl
    fi
    # Get IP address
    echo "Getting Public IP address, Please wait a moment..."
    IP=$(curl -s -4 icanhazip.com)
    if [[ "$IP" = "" ]]; then
        IP=$(curl -s -4 ipinfo.io | grep "ip" | awk -F\" '{print $4}')
    fi
    echo -e "Your main public IP is\t\033[32m$IP\033[0m"
    echo ""
    #Current folder
    cur_dir=`pwd`
}

# Download shadowsocks-go
function download_files(){
    cd $cur_dir
    if is_64bit; then
        if ! wget -c http://lamp.teddysun.com/shadowsocks/shadowsocks-server-linux64-1.1.4.gz;then<commit_msg>add test file<commit_after>#! /bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#===============================================================================================
#   System Required:  CentOS, Debian, Ubuntu
#   Description:  One click Install Shadowsocks(go)
#   Author: Teddysun <<EMAIL>>
#   Intro:  http://boxcore.org
#===============================================================================================

clear
echo ""
echo "#############################################################"
echo "# One click Install Shadowsocks(go)"
echo "# Intro: http://boxcore.org"
echo "#"
echo "# Author: BoxCore <<EMAIL>>"
echo "#"
echo "#############################################################"
echo ""

# Make sure only root can run our script
function rootness(){
    if [[ $EUID -ne 0 ]]; then
       echo "Error:This script must be run as root!" 1>&2
       exit 1
    fi
}

# Check OS
function checkos(){
    if [ -f /etc/redhat-release ];then
        OS=CentOS
    elif [ ! -z "`cat /etc/issue | grep bian`" ];then
        OS=Debian
    elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then
        OS=Ubuntu
    else
        echo "Not supported OS, Please reinstall OS and retry!"
        exit 1
    fi
}

# Get version
function getversion(){
    if [[ -s /etc/redhat-release ]];then
        grep -oE  "[0-9.]+" /etc/redhat-release
    else    
        grep -oE  "[0-9.]+" /etc/issue
    fi    
}

# CentOS version
function centosversion(){
    local code=$1
    local version="`getversion`"
    local main_ver=${version%%.*}
    if [ $main_ver == $code ];then
        return 0
    else
        return 1
    fi        
}

# is 64bit or not
function is_64bit(){
    if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then
        return 0
    else
        return 1
    fi        
}

# Disable selinux
function disable_selinux(){
if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config; then
    sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
    setenforce 0
fi
}

# Pre-installation settings
function pre_install(){
    # Set shadowsocks-go config password
    echo "Please input password for shadowsocks-go:"
    shadowsockspwd="<PASSWORD>"
    echo "password:$<PASSWORD>"
    echo "####################################"
    # get_char(){
    #     SAVEDSTTY=`stty -g`
    #     stty -echo
    #     stty cbreak
    #     dd if=/dev/tty bs=1 count=1 2> /dev/null
    #     stty -raw
    #     stty echo
    #     stty $SAVEDSTTY
    # }
    # echo ""
    # echo "Press any key to start...or Press Ctrl+C to cancel"
    # char=`get_char`
    #Install necessary dependencies
    if [ "$OS" == 'CentOS' ];then
        yum install -y wget unzip gzip curl
    else
        apt-get -y update
        apt-get install -y wget unzip gzip curl
    fi
    # Get IP address
    echo "Getting Public IP address, Please wait a moment..."
    IP=$(curl -s -4 icanhazip.com)
    if [[ "$IP" = "" ]]; then
        IP=$(curl -s -4 ipinfo.io | grep "ip" | awk -F\" '{print $4}')
    fi
    echo -e "Your main public IP is\t\033[32m$IP\033[0m"
    echo ""
    #Current folder
    cur_dir=`pwd`
}

# Download shadowsocks-go
function download_files(){
    cd $cur_dir
    if is_64bit; then
        if ! wget -c http://lamp.teddysun.com/shadowsocks/shadowsocks-server-linux64-1.1.4.gz;then
{'fraction_non_alphanumeric': 0.22681630242173656, 'fraction_numerical': 0.013290017720023627, 'mean_word_length': 2.6789788158609453, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3724083', 'n_tokens_mistral': 2330, 'n_tokens_neox': 2173, 'n_words': 619}