<commit_before>#!/bin/bash
if [ "$(whoami)" != "root" ]; then
	echo "Sorry, you are not root. Re-run this script using sudo"
	exit 1
fi

# install dependencies
apt-get install pwauth openssl
wget https://nodejs.org/dist/v4.2.0/node-v4.2.0-linux-armv6l.tar.gz
tar -xvf node-v4.2.0-linux-armv61.tar.gz
cd node-v4.2.0-linux-armv61
cp -R * /usr/local
cd ../
rm -rf node-v4.2.0-linux-armv61

# generate a self signed ssl cert
ifconfig | grep 'inet ' | awk '{print $2}' | while read -r line
do
    if [[ $line != '127.0.0.1' ]]; then
        mkdir ssl
        openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -subj "/C=US/CN=$line" -keyout ssl/server.key -out ssl/server.crt
        break
    fi
done

# build the app
npm install
NODE_ENV=production ./node_modules/.bin/gulp clean
NODE_ENV=production ./node_modules/.bin/gulp build
npm prune --production

# set the app-server to auto start on boot
cp upstart.conf /etc/init/itgetsthehose.conf
cwd=$(pwd)
sed -i.bak 's|CWD|'"$cwd"'|g' /etc/init/itgetsthehose.conf<commit_msg>Fixes to install script<commit_after>#!/bin/bash
if [ "$(whoami)" != "root" ]; then
	echo "Sorry, you are not root. Re-run this script using sudo"
	exit 1
fi

# install dependencies
apt-get install pwauth openssl
if !(command -v node >/dev/null 2>&1) then
    wget https://nodejs.org/dist/v4.2.0/node-v4.2.0-linux-armv6l.tar.gz
    tar -xvf node-v4.2.0-linux-armv6l.tar.gz
    cd node-v4.2.0-linux-armv6l
    cp -R * /usr/local
    cd ../
    rm -rf node-v4.2.0-linux-armv6l
fi

# generate a self signed ssl cert
ifconfig | grep 'inet ' | awk '{print $2}' | while read -r line
do
    if [[ $line != '127.0.0.1' ]]; then
        mkdir ssl
        openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -subj "/C=US/CN=$line" -keyout ssl/server.key -out ssl/server.crt
        break
    fi
done

# build the app
npm install
NODE_ENV=production ./node_modules/.bin/gulp clean
NODE_ENV=production ./node_modules/.bin/gulp build
npm prune --production

 set the app-server to auto start on boot
cp upstart.conf /etc/init/itgetsthehose.conf
cwd=$(pwd)
sed -i.bak 's|CWD|'"$cwd"'|g' /etc/init/itgetsthehose.conf
{'fraction_non_alphanumeric': 0.1487058823529412, 'fraction_numerical': 0.03811764705882353, 'mean_word_length': 2.9738317757009347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4390045', 'n_tokens_mistral': 896, 'n_tokens_neox': 849, 'n_words': 228}