<commit_before>#!/bin/bash

function warn {
  # color:yellow
  echo -e "\033[33mWarning\033[m" "$*"
}

function error {
  # color:red
  echo -e "\033[31mError\033[m" "$*"
}

function success {
  # color:green
  echo -e "\033[32mSuccess\033[m" "$*"
}

function check_os {
  case ${OSTYPE} in
    linux*)
      success "OK"
      ;;
    *)
      error "$OSTYPE is NOT supported, exitting"
      exit 1
      ;;
  esac
}

function check_available {
  which "$1" &>/dev/null
  return $?
}

function install_zlib {
  cd ~/picnic
  wget http://zlib.net/zlib-1.2.8.tar.gz
  tar zxvf zlib-1.2.8.tar.gz
  cd zlib-1.2.8
  ./configure --prefix=$HOME/picnic
  make &&
  make install &&
  export CPPFLAGS="-I$HOME/picnic/include" LDFLAGS="-L$HOME/picnic/lib"
}


function install_git {
  cd ~/picnic
  wget https://www.kernel.org/pub/software/scm/git/git-2.8.1.tar.gz
  tar zxvf git-2.8.1.tar.gz
  cd git-2.8.1
  ./configure --prefix=$HOME/picnic --with-curl=$CURLDIR NO_OPENSSL=1 NO_CURL=1
  make &&
  make install
}

function install_curl {
  cd ~/picnic
  wget https://github.com/curl/curl/archive/curl-7_48_0.tar.gz
  tar tar zxvf curl-7_48_0.tar.gz
  cd curl-7_48_0
  ./configure --prefix=$HOME/picnic
  make &&
  make install
}

# SUBCOMMANDS

function picnic-unpack {
  check_os
  mkdir ~/picnic
  case "$(check_available curl)" in
    0 )
      $CURLDIR="$(which curl)"
      ;;
    1 )
      $CURLDIR="$HOME/picnic"
      install_curl
      ;;
  esac
  install_zlib
  install_git
  # echo "PATH=$PATH:~/picnic/bin" >> "~/.$(basename $SHELL)rc"
}

function picnic-remove {
  if [ -e ~/picnic ]; then
    rm -rf ~/picnic<commit_msg>update message<commit_after>#!/bin/bash

function warn {
  # color:yellow
  echo -e "\033[33mWarning\033[m" "$*"
}

function error {
  # color:red
  echo -e "\033[31mError\033[m" "$*"
}

function success {
  # color:green
  echo -e "\033[32mSuccess\033[m" "$*"
}

function check_os {
  case ${OSTYPE} in
    linux*)
      success "OK"
      ;;
    *)
      error "$OSTYPE is NOT supported, exitting"
      exit 1
      ;;
  esac
}

function check_available {
  which "$1" &>/dev/null
  return $?
}

function install_zlib {
  cd ~/picnic
  wget http://zlib.net/zlib-1.2.8.tar.gz
  tar zxvf zlib-1.2.8.tar.gz
  cd zlib-1.2.8
  ./configure --prefix=$HOME/picnic
  make &&
  make install &&
  success "installed zlib to $HOME/picnic"
  export CPPFLAGS="-I$HOME/picnic/include" LDFLAGS="-L$HOME/picnic/lib"
}


function install_git {
  cd ~/picnic
  wget https://www.kernel.org/pub/software/scm/git/git-2.8.1.tar.gz
  tar zxvf git-2.8.1.tar.gz
  cd git-2.8.1
  ./configure --prefix=$HOME/picnic --with-curl=$CURLDIR NO_OPENSSL=1 NO_CURL=1
  make &&
  make install &&
  success "installed git to $HOME/picnic"
}

function install_curl {
  cd ~/picnic
  wget https://github.com/curl/curl/archive/curl-7_48_0.tar.gz
  tar tar zxvf curl-7_48_0.tar.gz
  cd curl-7_48_0
  ./configure --prefix=$HOME/picnic
  make &&
  make install &&
  success "installed curl to $HOME/picnic"
}

# SUBCOMMANDS

function picnic-unpack {
  check_os
  mkdir ~/picnic
  case "$(check_available curl)" in
    0 )
      $CURLDIR="$(which curl)"
      ;;
    1 )
      $CURLDIR="$HOME/picnic"
      install_curl
      ;;
  esac
  install_zlib
  install_git
  # echo "PATH=$PATH:~/picnic/bin" >> "~/.$(basename $SHELL)rc"
}

function picnic-remove {
  if [ -e ~/picnic ]; then
    rm -rf ~/picnic
{'fraction_non_alphanumeric': 0.1588426335990552, 'fraction_numerical': 0.0354295837023915, 'mean_word_length': 2.6746203904555315, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '6553520', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1367, 'n_words': 273}