<commit_before>#!/bin/sh

## mozjpeg, jpegoptim and optipng must all be installed

read -p "Would you like to BACKUP the original files? [y/N]: " response
case $response in
  [yY][eE][sS]|[yY])
    export BACKUPIMAGES=true;
    echo "You are backing things up, better safe than sorry!";
    ;;
  *)
    echo "You are a risk taker.";
    ;;
esac

if [ $BACKUPIMAGES = true ]; then
  mkdir -pv original-image-files/
  rsync -arE *.jpg original-image-files/
  rsync -arE *.png original-image-files/
  ## rsync doesn't like syncing to a higher directory,
  ## so we just move stuff
  mv original-image-files/ ../original-image-files/
fi

if [ "$( uname -s )" = Darwin ]; then
  ## mac version
  find . -name "*.jpg" -type f -exec jpegtran -copy none -optimize -outfile {} {} \;
  find . -name "*.jpg" -type f -exec jpegoptim -m65 {} \;
  find . -name "*.png" -type f -exec optipng {} \;
else
  ## add linux version here
  echo "coming soon"
fi
<commit_msg>really close, maybe even done<commit_after>#!/bin/sh

## mozjpeg, jpegoptim and optipng must all be installed
## if you don't have them
## 1. shame on you!!
## 2. brew install jpegoptim mozjpeg optipng

## linux users will compile them  ;^)

read -p "Would you like to BACKUP the original files? [y/N]: " response
case $response in
  [yY][eE][sS]|[yY])
    export BACKUPIMAGES=true;
    echo "You are backing things up, better safe than sorry!";
    ;;
  *)
    echo "You are a risk taker.";
    ;;
esac

if [ $BACKUPIMAGES = true ]; then
  mkdir -pv original-image-files/
  find . -name "*.jpg" -type f -exec cp -R {} original-image-files/ \;
  find . -name "*.png" -type f -exec cp -R {} original-image-files/ \;
  mv original-image-files/ ../original-image-files/
fi

if [ "$( uname -s )" = Darwin ]; then
  ## mac version
  find . -name "*.jpg" -type f -exec jpegtran -copy none -optimize -outfile {} {} \;
  find . -name "*.jpg" -type f -exec jpegoptim -m65 {} \;
  find . -name "*.png" -type f -exec optipng {} \;
else
  ## add linux version here
  echo "coming soon"
fi
{'fraction_non_alphanumeric': 0.15335305719921105, 'fraction_numerical': 0.0029585798816568047, 'mean_word_length': 2.78544776119403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1955386', 'n_tokens_mistral': 746, 'n_tokens_neox': 709, 'n_words': 257}