<commit_before>#!/bin/bash

## A quick and dirty script to losslessly compress my jpegs using Dropbox's lepton tool.
## https://github.com/dropbox/lepton

set -euo pipefail
IFS=$'\n\t'
shopt -s nullglob

# Checks if Lepton's installed. 
type lepton >/dev/null 2>&1 || { echo >&2 "::: Lepton not installed.  Aborting."; exit 1; }

PNG_TO_JPEG(){
	for i in *.png ; do 
		convert "$i" "${i%.*}.jpg"
	done
}

JPEG_TO_LEP(){
	for j in *.jpg ; do
		lepton "$j" "${j%.*}.lep"
	done
}

LEP_TO_JPEG(){
	for j in *.lep ; do
		lepton "$j" "${j%.*}.jpg"
	done
}

png_array=(`find ./ -maxdepth 1 -name "*.png"`)
if [[ ${#png_array[@]} -gt 0 ]] ; then
	# Checks if convert/imagemagick is installed
	type convert >/dev/null 2>&1 || { echo >&2 "::: Convert/ImageMagick not installed." ; exit 1; }
	read -rp "::: PNG's found. Convert them to JPEGs first? (Y/N)  " PNG_CHOICE
	case "$PNG_CHOICE" in
		[yY])
			PNG_TO_JPEG
			rm -- *.png
			;;
		*)
			;;
	esac
fi
<commit_msg>	modified:   lepton_compression.sh<commit_after>#!/bin/bash

## A quick and dirty script to losslessly compress my jpegs using Dropbox's lepton tool.
## https://github.com/dropbox/lepton

set -euo pipefail
IFS=$'\n\t'
shopt -s nullglob

# Checks if Lepton's installed. 
type lepton >/dev/null 2>&1 || { echo >&2 "::: Lepton not installed.  Aborting."; exit 1; }

PNG_TO_JPEG(){
	for i in *.png ; do 
		convert "$i" "${i%.*}.jpg"
	done
}

JPEG_TO_LEP(){
	for j in *.jpg ; do
		lepton "$j" "${j%.*}.lep"
	done
}

LEP_TO_JPEG(){
	for j in *.lep ; do
		lepton "$j" "${j%.*}.jpg"
	done
}

png_array=(`find ./ -maxdepth 1 -name "*.png"`) # bit of a legacy array method, but it works.
if [[ ${#png_array[@]} -gt 0 ]] ; then
	# Checks if convert/imagemagick is installed
	type convert >/dev/null 2>&1 || { echo >&2 "::: Convert/ImageMagick not installed." ; exit 1; }
	read -rp "::: PNG's found. Convert them to JPEGs first? (Y/N)  " PNG_CHOICE
	case "$PNG_CHOICE" in
		[yY])
			PNG_TO_JPEG
			rm -- *.png
			;;
		*)
			;;
	esac
fi

{'fraction_non_alphanumeric': 0.1872791519434629, 'fraction_numerical': 0.010095911155981827, 'mean_word_length': 3.137787056367432, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '7352292', 'n_tokens_mistral': 889, 'n_tokens_neox': 816, 'n_words': 241}