<commit_before>#!/usr/bin/env bash

#search for the right parent directory such that we have a common start directory
while [[ ! -f "run.sh" ]] && [[ ! -f "Vagrantfile" ]]
do
  cd ..
done

basedir=`pwd`

function sedeasy {
  sed -i "s/$(echo $1 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')/$(echo $2 | sed -e 's/[\/&]/\\&/g')/g" $3
}

function install_apt_dependencies {
  if [ -f debian.txt ] && [ which apt-get >/dev/null ]; then
    echo "--- installing apt dependencies ---"
    cd /tmp #switch to tmp directory
    set -vx #to turn echoing on and
    sudo apt-get install -y supervisor python-pip python-dev zlib1g-dev `cat ${basedir}/debian.txt`
    set +vx #to turn them both off
    cd ${basedir}
    rm debian.txt
  fi
}
function install_yum_dependencies {
  if [ -f redhat.txt ] && [ which yum >/dev/null ]; then
    echo "--- installing yum dependencies ---"
    cd /tmp #switch to tmp directory
    set -vx #to turn echoing on and
    sudo yum install -y supervisor python-pip python-devel zlib-devel `cat ${basedir}/redhat.txt`
    set +vx #to turn them both off
    cd ${basedir}
    rm redhat.txt
  fi
}
function install_pip_dependencies {
  if [ -f requirements.txt ] ; then
    echo "--- installing pip dependencies ---"
    cd /tmp #switch to tmp directory
    pip install -r ${basedir}/requirements.txt
    set -vx #to turn echoing on and
    cd ${basedir}
    rm requirements.txt
  fi
}

function create_server_config {
  local name=$1
  cd /tmp #switch to tmp directory
  pip install gunicorn setproctitle
  set -vx #to turn echoing on and
  cd ${basedir}
<commit_msg>fix setup script to check whether a program is installed<commit_after>#!/usr/bin/env bash

#search for the right parent directory such that we have a common start directory
while [[ ! -f "run.sh" ]] && [[ ! -f "Vagrantfile" ]]
do
  cd ..
done

basedir=`pwd`

function sedeasy {
  sed -i "s/$(echo $1 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')/$(echo $2 | sed -e 's/[\/&]/\\&/g')/g" $3
}

function install_apt_dependencies {
  if [ -f debian.txt ] && [ -x "$(command -v apt-get)" ]; then
    echo "--- installing apt dependencies ---"
    cd /tmp #switch to tmp directory
    set -vx #to turn echoing on and
    sudo apt-get install -y supervisor python-pip python-dev zlib1g-dev `cat ${basedir}/debian.txt`
    set +vx #to turn them both off
    cd ${basedir}
    rm debian.txt
  fi
}
function install_yum_dependencies {
  if [ -f redhat.txt ] && [ -x "$(command -v yum)" ]; then
    echo "--- installing yum dependencies ---"
    cd /tmp #switch to tmp directory
    set -vx #to turn echoing on and
    sudo yum install -y supervisor python-pip python-devel zlib-devel `cat ${basedir}/redhat.txt`
    set +vx #to turn them both off
    cd ${basedir}
    rm redhat.txt
  fi
}
function install_pip_dependencies {
  if [ -f requirements.txt ] ; then
    echo "--- installing pip dependencies ---"
    cd /tmp #switch to tmp directory
    pip install -r ${basedir}/requirements.txt
    set -vx #to turn echoing on and
    cd ${basedir}
    rm requirements.txt
  fi
}

function create_server_config {
  local name=$1
  cd /tmp #switch to tmp directory
  pip install gunicorn setproctitle
  set -vx #to turn echoing on and
  cd ${basedir}

{'fraction_non_alphanumeric': 0.1378235110695354, 'fraction_numerical': 0.0031181789834736516, 'mean_word_length': 2.695852534562212, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5063463', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1073, 'n_words': 391}