<commit_before>#!/bin/sh

WORK_DIR=/tmp
BIN_DIR=/usr/local/bin

arch() {
  ARCH=$(uname -m)
  case $ARCH in
    x86_64) ARCH=amd64;;
  esac
}

os() {
  OS=$(uname -s | tr '[:upper:]' '[:lower:]')
}

download() {
  LATEST_RELEASE_JSON="https://api.github.com/repos/malfunkt/arpfox/releases/latest"
  DOWNLOAD_URL=$(curl --silent -L $LATEST_RELEASE_JSON | grep browser_download_url | sed s/'^.*: "'//g | sed s/'"$'//g | grep "$OS.*$ARCH")

  if [ -z "$DOWNLOAD_URL" ]; then
    curl --silent -L $LATEST_RELEASE_JSON;
    echo "Github API is not working right now. Please try again later.";
    exit 1
  fi;

  BASENAME=$(basename $DOWNLOAD_URL)

  wget $DOWNLOAD_URL -O $WORK_DIR/$BASENAME

  case $BASENAME in
    *.bz2)
      bzip2 -d $WORK_DIR/$BASENAME
      FILENAME=$WORK_DIR/arpfox_${OS}_${ARCH}
      ;;
    *.gz)
      gzip -dfv $WORK_DIR/$BASENAME
      FILENAME=$WORK_DIR/arpfox_${OS}_${ARCH}
      ;;
    *.zip)
      unzip -d $WORK_DIR -o $WORK_DIR/$BASENAME
      FILENAME=$WORK_DIR/arpfox_${OS}_${ARCH}.exe
      ;;
    *)
      echo "Don't know how to handle downloaded file $BASENAME" && exit 1
      ;;
  esac

  if [ -z "$FILENAME" ]; then
    echo "Could not install." && exit 1
  fi;

  echo "This script needs root privileges in order to install into $BIN_DIR."
  sudo install -c -m 0755 $FILENAME $BIN_DIR/arpfox
  rm $FILENAME
}

arch
os
download<commit_msg>add a note on sudo password<commit_after>#!/bin/sh

WORK_DIR=/tmp
BIN_DIR=/usr/local/bin

arch() {
  ARCH=$(uname -m)
  case $ARCH in
    x86_64) ARCH=amd64;;
  esac
}

os() {
  OS=$(uname -s | tr '[:upper:]' '[:lower:]')
}

download() {
  LATEST_RELEASE_JSON="https://api.github.com/repos/malfunkt/arpfox/releases/latest"
  DOWNLOAD_URL=$(curl --silent -L $LATEST_RELEASE_JSON | grep browser_download_url | sed s/'^.*: "'//g | sed s/'"$'//g | grep "$OS.*$ARCH")

  if [ -z "$DOWNLOAD_URL" ]; then
    curl --silent -L $LATEST_RELEASE_JSON;
    echo "Github API is not working right now. Please try again later.";
    exit 1
  fi;

  BASENAME=$(basename $DOWNLOAD_URL)

  wget $DOWNLOAD_URL -O $WORK_DIR/$BASENAME

  case $BASENAME in
    *.bz2)
      bzip2 -d $WORK_DIR/$BASENAME
      FILENAME=$WORK_DIR/arpfox_${OS}_${ARCH}
      ;;
    *.gz)
      gzip -dfv $WORK_DIR/$BASENAME
      FILENAME=$WORK_DIR/arpfox_${OS}_${ARCH}
      ;;
    *.zip)
      unzip -d $WORK_DIR -o $WORK_DIR/$BASENAME
      FILENAME=$WORK_DIR/arpfox_${OS}_${ARCH}.exe
      ;;
    *)
      echo "Don't know how to handle downloaded file $BASENAME" && exit 1
      ;;
  esac

  if [ -z "$FILENAME" ]; then
    echo "Could not install." && exit 1
  fi;

  echo "Installing to $BIN_DIR... (it might require sudo password)"
  sudo install -c -m 0755 $FILENAME $BIN_DIR/arpfox
  rm $FILENAME
}

arch
os
download
{'fraction_non_alphanumeric': 0.16063675832127353, 'fraction_numerical': 0.01085383502170767, 'mean_word_length': 2.888888888888889, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4059898', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1045, 'n_words': 259}