<commit_before>#! /bin/bash
# <http://tools.suckless.org/dmenu/scripts>.

font="Monospace-12"
prompt="$USER@`hostname`"
normal_fg="white"
normal_bg="black"
selected_fg="black"
selected_bg="OrangeRed1"
history_path=$HOME/.dmenu_history

touch $history_path

# Adds \n at the end of the file only if it doesn’t already end with a newline
# <http://unix.stackexchange.com/questions/31947/how-to-add-a-newline-to-the-end-of-a-file#31955>,
# <http://unix.stackexchange.com/questions/31947/how-to-add-a-newline-to-the-end-of-a-file#comment-43399>.
sed -i -e '$a\' $history_path

function get_commands {
    # Executable exists?
    # <http://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script#677212>.
    if hash stest 2>/dev/null; then
        IFS=:
        stest -flx $PATH
    else
        dmenu_path
    fi
}

(
    # (tac $history_path ; stest -flx $PATH | sort -u) \ # reverse order of lines <http://stackoverflow.com/questions/742466/how-can-i-reverse-the-order-of-lines-in-a-file#742485>
    #                                                    # pipe multiple commands to a single command <http://stackoverflow.com/questions/11917708/pipe-multiple-commands-to-a-single-command#11917709>
    #     | awk ' !x[$0]++'                              # removing duplicate lines without sorting <http://stackoverflow.com/questions/11532157/unix-removing-duplicate-lines-without-sorting#11532197><commit_msg>refactor my dmenu run script<commit_after>#! /bin/bash
# <http://tools.suckless.org/dmenu/scripts>.

font=Monospace-12
prompt="$USER@`hostname`"
normal_fg=white
normal_bg=black
selected_fg=black
selected_bg=OrangeRed1
history_path=$HOME/.dmenu_history

touch $history_path

# Adds \n at the end of the file only if it doesn’t already end with a newline
# <http://unix.stackexchange.com/questions/31947/how-to-add-a-newline-to-the-end-of-a-file#31955>,
# <http://unix.stackexchange.com/questions/31947/how-to-add-a-newline-to-the-end-of-a-file#comment-43399>.
sed -i -e '$a\' $history_path

function get_commands {
    # Executable exists?
    # <http://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script#677212>.
    if hash stest 2>/dev/null; then
        IFS=:
        stest -flx $PATH
    else
        dmenu_path
    fi
}

(
    # (tac $history_path ; stest -flx $PATH | sort -u) \ # reverse order of lines <http://stackoverflow.com/questions/742466/how-can-i-reverse-the-order-of-lines-in-a-file#742485>
    #                                                    # pipe multiple commands to a single command <http://stackoverflow.com/questions/11917708/pipe-multiple-commands-to-a-single-command#11917709>
    #     | awk ' !x[$0]++'                              # removing duplicate lines without sorting <http://stackoverflow.com/questions/11532157/unix-removing-duplicate-lines-without-sorting#11532197>
{'fraction_non_alphanumeric': 0.1442941380506417, 'fraction_numerical': 0.05619146722164412, 'mean_word_length': 2.9889349930843707, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '614028', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1008, 'n_words': 165}