<commit_before>#!/bin/bash
#
# Blue Box NOC installation script
#
# Run this as root from a fresh git checkout to install the Blue Box NOC.
#
# Variables in BLUEBOXNOC_ALL_CAPS style below may be overridden in
# the environment, e.g.
#
#   export BLUEBOXNOC_VAR_DIR=/var/snazzy/blueboxnoc
#   sudo install_noc.sh

set -e -x

cd "$(dirname "$0")"
. shlib/functions.sh

: ${BLUEBOXNOC_CODE_DIR:="$PWD"}

: ${BLUEBOXNOC_DEV_ONLY_INSTALL:=""}
if running_on_mac && [ -z "$BLUEBOXNOC_DEV_ONLY_INSTALL" ]; then
    (set +x; bannermsg "Performing Mac OS X developer-only install")
    BLUEBOXNOC_DEV_ONLY_INSTALL=1
fi

if [ -n "$BLUEBOXNOC_DEV_ONLY_INSTALL" ]; then
    # Dev install
    : ${BLUEBOXNOC_VAR_DIR:="$HOME/srv/blueboxnoc"}
else
    # Prod install
    : ${BLUEBOXNOC_VAR_DIR:="/srv/blueboxnoc"}
    ensure_running_as_root
    ensure_docker 1.4.0
fi

# Build the Docker image
mkdir -p "${BLUEBOXNOC_VAR_DIR}"
: ${BLUEBOXNOC_DOCKER_NAME:=epflsti/blueboxnoc}
docker build -t "$BLUEBOXNOC_DOCKER_NAME":latest .

if [ -n "$BLUEBOXNOC_DEV_ONLY_INSTALL" ]; then
    substitute_shell BLUEBOXNOC_ < run_noc.sh > /etc/init.d/blueboxnoc
    chmod a+x /etc/init.d/blueboxnoc
fi

set +x
echo
echo "All done, now see run_noc.sh"
echo
<commit_msg>More bugfixes and code improvements<commit_after>#!/bin/bash
#
# Blue Box NOC installation script
#
# Run this as root from a fresh git checkout to install the Blue Box NOC.
#
# Variables in BLUEBOXNOC_ALL_CAPS style below may be overridden in
# the environment, e.g.
#
#   export BLUEBOXNOC_VAR_DIR=/var/snazzy/blueboxnoc
#   sudo install_noc.sh

set -e -x

cd "$(dirname "$0")"
. shlib/functions.sh

: ${BLUEBOXNOC_CODE_DIR:="$PWD"}

: ${BLUEBOXNOC_DEV_ONLY_INSTALL:=""}
if running_on_mac && [ -z "$BLUEBOXNOC_DEV_ONLY_INSTALL" ]; then
    (set +x; bannermsg "Performing Mac OS X developer-only install")
    BLUEBOXNOC_DEV_ONLY_INSTALL=1
fi

if [ -n "$BLUEBOXNOC_DEV_ONLY_INSTALL" ]; then
    # Dev install
    : ${BLUEBOXNOC_VAR_DIR:="$HOME/srv/blueboxnoc"}
else
    # Prod install
    : ${BLUEBOXNOC_VAR_DIR:="/srv/blueboxnoc"}
    ensure_running_as_root
    ensure_docker 1.4.0
fi

# Build the Docker image
mkdir -p "${BLUEBOXNOC_VAR_DIR}"
: ${BLUEBOXNOC_DOCKER_NAME:=epflsti/blueboxnoc}
docker build -t "$BLUEBOXNOC_DOCKER_NAME":latest .

if [ -z "$BLUEBOXNOC_DEV_ONLY_INSTALL" ]; then
    substitute_shell BLUEBOXNOC_ < run_noc.sh > /etc/init.d/blueboxnoc
    chmod a+x /etc/init.d/blueboxnoc
fi

(set +x; bannermsg "All done, now see run_noc.sh")

{'fraction_non_alphanumeric': 0.12078651685393259, 'fraction_numerical': 0.0040128410914927765, 'mean_word_length': 4.384449244060475, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '55232', 'n_tokens_mistral': 1033, 'n_tokens_neox': 1012, 'n_words': 224}