<commit_before>#! /usr/bin/env bash

set -e

OS="$(uname | tr '[:upper:]' '[:lower:]')"
echo "$OS"


# There is probably a better way to do this, but this turns out to be a fiarly
# robust way to target the .nar execuatable.
NAR="$(find . | grep "typescript-.*-${OS}-x64\.nar")"
echo "$NAR"

# There is a race condition when compiling multiple ts_binaries. mkdir is
# atomic and has an error code when it can't make a file (making it a perfect
# lock). Lock on the .nar folder until .tsc_unlock is available.
if mkdir .nar 2> /dev/null; then
  until [[ -f .tsc_unlock ]]; do
    sleep .1s
  done
fi

args=()
for var in "$@"; do
  args+=("$(pwd)/${var}")
done

bash "$NAR" exec "--module amd ${FLAGS} --outFile ${args[*]}"
touch .tsc_unlock
<commit_msg>Update run script to run only the first nar<commit_after>#! /usr/bin/env bash

set -e
set -x

OS="$(uname | tr '[:upper:]' '[:lower:]')"
echo "$OS"

find . | grep "typescript-.*-${OS}-x64\.nar"

# There is probably a better way to do this, but this turns out to be a fiarly
# robust way to target the .nar execuatable.
NAR="$(pwd)/$(find . | grep "typescript-.*-${OS}-x64\.nar" | head -n 1)"

# There is a race condition when compiling multiple ts_binaries. mkdir is
# atomic and has an error code when it can't make a file (making it a perfect
# lock). Lock on the .nar folder until .tsc_unlock is available.
if mkdir .nar ; then
  until [[ -f .tsc_unlock ]]; do
    sleep .1s
  done
fi

args=()
for var in "$@"; do
  args+=("$(pwd)/${var}")
done

bash "$NAR" exec "--module amd ${FLAGS} --outFile ${args[*]}"
touch .tsc_unlock

{'fraction_non_alphanumeric': 0.1650853889943074, 'fraction_numerical': 0.006325110689437065, 'mean_word_length': 3.4313725490196076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6493622', 'n_tokens_mistral': 590, 'n_tokens_neox': 558, 'n_words': 228}