<commit_before>#!/bin/bash

CURL=$(which curl)
PWD="`pwd`"
INFO_SH="info.sh"
REMOTE_DIR="/htdocs"
ZIP=$(which zip)
EXTRACT=0
COLS=`tput cols`
BOLD=`tput bold`
NORMAL=`tput sgr0`
INTERACTIVE=1
OVERWRITE=1
KEEPARCHIVE=0

if [[ ${#CURL} -eq 0 ]]; then
    echo "Install curl first."
    exit 1
fi

if [[ ${#ZIP} -eq 0 ]]; then
    echo "Install zip first."
    exit 1
fi

QUERY_URL="http://cp.hichina.com/AJAXPage.aspx"

USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) \
AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"

HELP()
{
    echo "Usage: $0 [OPTIONS...]"
    echo "Options:"
    echo "  -h, --help                   Show this help and exit"
    echo "  -f, -from <file>             File to upload, directory will be 
                               compressed as zip file"
    echo "  -t, --to <path>              Remote path relative to ${REMOTE_DIR}"
    echo "  -e, --extract <file.zip>     Remote zip file to extract"
    echo "  -d, --destination <path>     Extract files to path"
    echo "  -s, --no-overwrite           Do not overwrite existing files"
    echo "  -k, --keep-archive           Do not delete the archive file"
    echo "  -y, --assumeyes, -n, --non-interactive"
    echo "                               Execute commands without confirmations"
    exit 0
}

INFORM()
{
    printf "\e[1;30;42m"
    FRONT_SPACES=$(( ($COLS - ${#1}) / 2 ))
    printf "${BOLD}%*s" $FRONT_SPACES
    printf "${1}"
    printf "%*s" $(( $COLS - ${#1} - $FRONT_SPACES ))
    printf "${NORMAL}\n"
}

[ $# -eq 0 ] && HELP

while [[ $# -gt 0 ]]; do
    case "$1" in
        -f|--from)
            shift
            if [[ $# -gt 0 ]]; then
                FROM="$1"
                if [[ ! -e $FROM ]]; then
                    echo "[Error] $FROM : No such file or directory."
                    exit 1
                fi
                shift
            fi
            ;;
        -t|--to)
            shift
            if [[ $# -gt 0 ]]; then
                TO="$1"
                shift
            fi
            ;;<commit_msg>change inform text color;<commit_after>#!/bin/bash

CURL=$(which curl)
PWD="`pwd`"
INFO_SH="info.sh"
REMOTE_DIR="/htdocs"
ZIP=$(which zip)
EXTRACT=0
COLS=`tput cols`
BOLD=`tput bold`
NORMAL=`tput sgr0`
INTERACTIVE=1
OVERWRITE=1
KEEPARCHIVE=0

if [[ ${#CURL} -eq 0 ]]; then
    echo "Install curl first."
    exit 1
fi

if [[ ${#ZIP} -eq 0 ]]; then
    echo "Install zip first."
    exit 1
fi

QUERY_URL="http://cp.hichina.com/AJAXPage.aspx"

USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) \
AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"

HELP()
{
    echo "Usage: $0 [OPTIONS...]"
    echo "Options:"
    echo "  -h, --help                   Show this help and exit"
    echo "  -f, -from <file>             File to upload, directory will be 
                               compressed as zip file"
    echo "  -t, --to <path>              Remote path relative to ${REMOTE_DIR}"
    echo "  -e, --extract <file.zip>     Remote zip file to extract"
    echo "  -d, --destination <path>     Extract files to path"
    echo "  -s, --no-overwrite           Do not overwrite existing files"
    echo "  -k, --keep-archive           Do not delete the archive file"
    echo "  -y, --assumeyes, -n, --non-interactive"
    echo "                               Execute commands without confirmations"
    exit 0
}

INFORM()
{
    printf "\e[1;33;42m"
    FRONT_SPACES=$(( ($COLS - ${#1}) / 2 ))
    printf "${BOLD}%*s" $FRONT_SPACES
    printf "${1}"
    printf "%*s" $(( $COLS - ${#1} - $FRONT_SPACES ))
    printf "${NORMAL}\n"
}

[ $# -eq 0 ] && HELP

while [[ $# -gt 0 ]]; do
    case "$1" in
        -f|--from)
            shift
            if [[ $# -gt 0 ]]; then
                FROM="$1"
                if [[ ! -e $FROM ]]; then
                    echo "[Error] $FROM : No such file or directory."
                    exit 1
                fi
                shift
            fi
            ;;
        -t|--to)
            shift
            if [[ $# -gt 0 ]]; then
                TO="$1"
                shift
            fi
            ;;
{'fraction_non_alphanumeric': 0.15197495183044316, 'fraction_numerical': 0.025529865125240848, 'mean_word_length': 1.554120541205412, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2032076', 'n_tokens_mistral': 1537, 'n_tokens_neox': 1425, 'n_words': 407}