<commit_before>__red_stderr()
{
    "$@" 2> >(sed -e 's/\(^.*$\)/'$'\033''[31m\1'$'\033''[0m/g' 1>&2)
}

__verbose_do()
{
    echo -e "\e[1m=> $@\e[0m"
    eval "$@"
    return $?
}

__highlighted_echo()
{
    echo -e "\e[1m$@\e[0m"
}

__red_echo()
{
    echo -e "\e[31m$@\e[0m"
}

__has make && alias make=__smart_make
__smart_make()
{
    dir=.
    while true; do
        echo "** Attempting make in $(builtin cd "$dir"; pwd)"
        if [ -f $dir/Makefile ] || [ -f $dir/makefile ] || [ -f $dir/GNUmakefile ]; then
            command make -C "$dir" $@
            return $?
        fi

        if [ "$(builtin cd "$dir"; pwd)" = / ]; then
            __red_echo "** Cannot find makefile"
            return 1
        fi

        dir+=/..
    done
}

__infinite_bash()
{
    true
    while [ "$?" != 200 ]; do
        clear
        echo
        echo "+============================================================+"
        echo "|                         Bash Trap                          |"
        echo "+------------------------------------------------------------+"
        echo "| ** This session will be RESTARTED on normal exit.          |"
        echo "| ** To escape, use exit code 200.                           |"
        echo "+============================================================+"
        echo
        bash
    done
    return 0
}
alias bashtrap=__infinite_bash<commit_msg>Alias git to hub (github) if possible<commit_after>__red_stderr()
{
    "$@" 2> >(sed -e 's/\(^.*$\)/'$'\033''[31m\1'$'\033''[0m/g' 1>&2)
}

__verbose_do()
{
    echo -e "\e[1m=> $@\e[0m"
    eval "$@"
    return $?
}

__highlighted_echo()
{
    echo -e "\e[1m$@\e[0m"
}

__red_echo()
{
    echo -e "\e[31m$@\e[0m"
}

__has make && alias make=__smart_make
__smart_make()
{
    dir=.
    while true; do
        echo "** Attempting make in $(builtin cd "$dir"; pwd)"
        if [ -f $dir/Makefile ] || [ -f $dir/makefile ] || [ -f $dir/GNUmakefile ]; then
            command make -C "$dir" $@
            return $?
        fi

        if [ "$(builtin cd "$dir"; pwd)" = / ]; then
            __red_echo "** Cannot find makefile"
            return 1
        fi

        dir+=/..
    done
}

__infinite_bash()
{
    true
    while [ "$?" != 200 ]; do
        clear
        echo
        echo "+============================================================+"
        echo "|                         Bash Trap                          |"
        echo "+------------------------------------------------------------+"
        echo "| ** This session will be RESTARTED on normal exit.          |"
        echo "| ** To escape, use exit code 200.                           |"
        echo "+============================================================+"
        echo
        bash
    done
    return 0
}
alias bashtrap=__infinite_bash

__has hub && alias git=hub
{'fraction_non_alphanumeric': 0.2752454417952314, 'fraction_numerical': 0.019635343618513323, 'mean_word_length': 1.5136563876651983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2450529', 'n_tokens_mistral': 957, 'n_tokens_neox': 888, 'n_words': 217}