<commit_before>#!/bin/bash

YUM_CMD=$(command -v yum)
APT_CMD=$(command -v apt-get)

if [ -n "${YUM_CMD}" ]; then
  echo "Installing unzip and daemon via yum."
  ${YUM_CMD} -q makecache
  ${YUM_CMD} -y -q install unzip daemon
elif [ -n "${APT_CMD}" ]; then
  echo "Installing unzip and daemon via apt-get."
  ${APT_CMD} -qq update
  ${APT_CMD} -y -qq install unzip daemon
else
  echo "Please make sure unzip and daemon are installed."
fi

VER="v1.7"

ARCH=$(uname -m)
VDIS="64"

if [[ "$ARCH" == "i686" ]] || [[ "$ARCH" == "i386" ]]; then
  VDIS="32"
elif [[ "$ARCH" == *"armv7"* ]]; then
  VDIS="arm"
elif [[ "$ARCH" == *"armv8"* ]]; then
  VDIS="arm64"
fi

DOWNLOAD_LINK="https://github.com/v2ray/v2ray-core/releases/download/${VER}/v2ray-linux-${VDIS}.zip"

rm -rf /tmp/v2ray
mkdir -p /tmp/v2ray

# Download release with proxy or not
echo 'Direct start downloading release,'
echo 'Or Enter a proxy URI for Downloading release.'
echo 'ex: socks5://127.0.0.1:1080'
echo 'ex: http://127.0.0.1:3128'
read PROXY_URI

if [ -n "${PROXY_URI}" ]; then
  curl -x ${PROXY_URI} -L -o "/tmp/v2ray/v2ray.zip" ${DOWNLOAD_LINK}
else
  curl -L -o "/tmp/v2ray/v2ray.zip" ${DOWNLOAD_LINK}
fi
unzip "/tmp/v2ray/v2ray.zip" -d "/tmp/v2ray/"

# Create folder for V2Ray log.
mkdir -p /var/log/v2ray

# Stop v2ray daemon if necessary.
SYSTEMCTL_CMD=$(command -v systemctl)
SERVICE_CMD=$(command -v service)<commit_msg>prefer command line flags over interaction<commit_after>#!/bin/bash

while [[ $# > 0 ]]
do
key="$1"

case $key in
    -p|--proxy)
    PROXY="$2"
    shift # past argument
    ;;
    -h|--help)
    HELP="1"
    shift
    ;;
    *)
            # unknown option
    ;;
esac
shift # past argument or value
done

if [[ "$HELP" == "1" ]]; then
  echo "./install-release.sh [-p proxy]"
  echo "To download through a proxy server, use -p socks5://127.0.0.1:1080 or -p http://127.0.0.1:3128 etc"
  exit
fi

YUM_CMD=$(command -v yum)
APT_CMD=$(command -v apt-get)

if [ -n "${YUM_CMD}" ]; then
  echo "Installing unzip and daemon via yum."
  ${YUM_CMD} -q makecache
  ${YUM_CMD} -y -q install unzip daemon
elif [ -n "${APT_CMD}" ]; then
  echo "Installing unzip and daemon via apt-get."
  ${APT_CMD} -qq update
  ${APT_CMD} -y -qq install unzip daemon
else
  echo "Please make sure unzip and daemon are installed."
fi

VER="v1.7"

ARCH=$(uname -m)
VDIS="64"

if [[ "$ARCH" == "i686" ]] || [[ "$ARCH" == "i386" ]]; then
  VDIS="32"
elif [[ "$ARCH" == *"armv7"* ]]; then
  VDIS="arm"
elif [[ "$ARCH" == *"armv8"* ]]; then
  VDIS="arm64"
fi

DOWNLOAD_LINK="https://github.com/v2ray/v2ray-core/releases/download/${VER}/v2ray-linux-${VDIS}.zip"

rm -rf /tmp/v2ray
mkdir -p /tmp/v2ray

if [ -n "${PROXY}" ]; then
  curl -x ${PROXY} -L -o "/tmp/v2ray/v2ray.zip" ${DOWNLOAD_LINK}
else
  curl -L -o "/tmp/v2ray/v2ray.zip" ${DOWNLOAD_LINK}
fi
unzip "/tmp/v2ray/v2ray.zip" -d "/tmp/v2ray/"

# Create folder for V2Ray log.
mkdir -p /var/log/v2ray

# Stop v2ray daemon if necessary.
SYSTEMCTL_CMD=$(command -v systemctl)
SERVICE_CMD=$(command -v service)
{'fraction_non_alphanumeric': 0.1886356128179716, 'fraction_numerical': 0.036009250082590025, 'mean_word_length': 3.3694083694083696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4120776', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1254, 'n_words': 336}