<commit_before>#!/bin/sh

MACHINE=${MACHINE:-"ultra3d"}
EXTRUDER=${EXTRUDER:-"left"}
MATERIAL=${MATERIAL:-"inland_pla"}

if [ -z "$1" ]; then
	echo "usage: $0 binary_stl[.gz|.bz2|.xz|.lz4] [shiv_options]"
	exit 1
fi

DECOMPRESS=""
BASE_DIR="$HOME/src/shiv"
CONFIG_DIR="$BASE_DIR/configs"
INFILE="$1"
INFILE_BASE="$(basename "$INFILE")"
INFILE_DIR="$(dirname "$INFILE")"
EXT="${INFILE_BASE##*.}"
case "$EXT" in
	gz)  DECOMPRESS="gzip -dc" ;;
	bz2) DECOMPRESS="bzip2 -dc" ;;
	xz)  DECOMPRESS="xz -dc" ;;
	lz4) DECOMPRESS="lz4 -dc" ;;
esac
OUTFILE="$INFILE_DIR/${INFILE_BASE%%.*}.gcode"
shift 1

run_shiv() {
	time "$BASE_DIR/shiv" \
		-S gcode_variable=date="$(date)" \
		-S gcode_variable=machine="$MACHINE" \
		-S gcode_variable=extruder="$EXTRUDER" \
		-S gcode_variable=material="$MATERIAL" \
		-c "$CONFIG_DIR/global" \
		-c "$CONFIG_DIR/$MACHINE/$MACHINE" \
		-c "$CONFIG_DIR/$MACHINE/$EXTRUDER" \
		-c "$CONFIG_DIR/$MACHINE/$MATERIAL" \
		"$@"
}

if [ -n "$DECOMPRESS" ]; then
	$DECOMPRESS "$INFILE" | run_shiv -o "$OUTFILE" - "$@"
else
	run_shiv -o "$OUTFILE" "$INFILE" "$@"
fi<commit_msg>shiv_export.sh: Fix argument order; minor refactor.<commit_after>#!/bin/sh

MACHINE=${MACHINE:-"ultra3d"}
EXTRUDER=${EXTRUDER:-"left"}
MATERIAL=${MATERIAL:-"inland_pla"}

if [ -z "$1" ]; then
	echo "usage: $0 binary_stl[.gz|.bz2|.xz|.lz4] [shiv_options]"
	exit 1
fi

BASE_DIR="$HOME/src/shiv"
CONFIG_DIR="$BASE_DIR/configs"
INFILE="$1"
INFILE_BASE="$(basename "$INFILE")"
INFILE_DIR="$(dirname "$INFILE")"
EXT="${INFILE_BASE##*.}"
OUTFILE="$INFILE_DIR/${INFILE_BASE%%.*}.gcode"
shift 1

run_shiv() {
	time "$BASE_DIR/shiv" \
		-S gcode_variable=date="$(date)" \
		-S gcode_variable=machine="$MACHINE" \
		-S gcode_variable=extruder="$EXTRUDER" \
		-S gcode_variable=material="$MATERIAL" \
		-c "$CONFIG_DIR/global" \
		-c "$CONFIG_DIR/$MACHINE/$MACHINE" \
		-c "$CONFIG_DIR/$MACHINE/$EXTRUDER" \
		-c "$CONFIG_DIR/$MACHINE/$MATERIAL" \
		"$@"
}

case "$EXT" in
	gz)  gzip  -dc "$INFILE" | run_shiv -o "$OUTFILE" "$@" - ;;
	bz2) bzip2 -dc "$INFILE" | run_shiv -o "$OUTFILE" "$@" - ;;
	xz)  xz    -dc "$INFILE" | run_shiv -o "$OUTFILE" "$@" - ;;
	lz4) lz4   -dc "$INFILE" | run_shiv -o "$OUTFILE" "$@" - ;;
	*)   run_shiv -o "$OUTFILE" "$@" "$INFILE" ;;
esac
{'fraction_non_alphanumeric': 0.23367392270102177, 'fraction_numerical': 0.010661928031985785, 'mean_word_length': 4.588089330024814, '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': '2431674', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1004, 'n_words': 164}