<commit_before>#!/bin/bash

readonly ROOT=$( dirname $(dirname $(realpath $0) ) )
readonly TARGET=$ROOT/README.md
readonly HEADER=$(cat << EOT
# TIL

Today I Learned

- - -
EOT
)

readonly CATEGORIES=$(find $ROOT -mindepth 1 -maxdepth 1 -name "[a-zA-Z]*" -type d)

{
    echo "$HEADER"
    echo ""
} > $TARGET

{
    echo "### Categories"
    echo ""
} >> $TARGET

for p in $CATEGORIES
do
    category_name=$(basename $p)
    echo "- [${category_name}](#${category_name})" >> $TARGET
done

{
    echo ""
    echo "- - -"
    echo ""
} >> $TARGET

for p in $CATEGORIES
do
    category_name=$(basename $p)
    echo "### ${category_name}" >> $TARGET

    echo "" >> $TARGET<commit_msg>Print til title<commit_after>#!/bin/bash

readonly ROOT=$( dirname $(dirname $(realpath $0) ) )
readonly TARGET=$ROOT/README.md
readonly HEADER=$(cat << EOT
# TIL

Today I Learned

- - -
EOT
)

readonly CATEGORIES=$(find $ROOT -mindepth 1 -maxdepth 1 -name "[a-zA-Z]*" -type d)

{
    echo "$HEADER"
    echo ""
} > $TARGET

{
    echo "### Categories"
    echo ""
} >> $TARGET

for p in $CATEGORIES
do
    category_name=$(basename $p)
    echo "- [${category_name}](#${category_name})" >> $TARGET
done

{
    echo ""
    echo "- - -"
    echo ""
} >> $TARGET

for p in $CATEGORIES
do
    category_name=$(basename $p)
    echo "### ${category_name}" >> $TARGET
    echo "" >> $TARGET

    for f in $(find $p -type f)
    do
        title=$(head -1 $f)
        echo "- [${title#\# *}](${f#$ROOT/})" >> $TARGET
    done

    echo "" >> $TARGET
{'fraction_non_alphanumeric': 0.19369665134602757, 'fraction_numerical': 0.004596191726854892, 'mean_word_length': 2.819548872180451, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, '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': '4084101', 'n_tokens_mistral': 600, 'n_tokens_neox': 575, 'n_words': 145}