<commit_before>#!/bin/bash
# ulogme_serve.sh for https://github.com/Naereen/uLogMe/
# MIT Licensed, https://lbesson.mit-license.org/

echo "Starting 'ulogme_serve.sh' ..."

# FIXED no need to adapt this to the path where you stored ulogme.git/
# cd ~/.local/share/ulogme/scripts/  # XXX change according to your installation
cd "$( dirname "${BASH_SOURCE[0]}" )"

port="${1:-8124}"

if pidof firefox >/dev/null; then
	echo -e "Opening 'http://localhost:${port}/' in Firefox ..."
	firefox -new-tab "http://localhost:${port}"/ &
	# xdg-open "http://localhost:${port}"/ &
else
	echo -e "Firefox is not running, by default the uLogMe page will not be opened ..."
	echo -e "('http://localhost:${port}/' is only opened in a new tab if your Firefox is already running)."
fi

echo -e "Calling 'python ulogme_serve.py ${port}' ..."
python ./ulogme_serve.py "${port}"<commit_msg>Possibly better way to open the uLogMe page in a new tab in your browser.<commit_after>#!/bin/bash
# ulogme_serve.sh for https://github.com/Naereen/uLogMe/
# MIT Licensed, https://lbesson.mit-license.org/

echo "Starting 'ulogme_serve.sh' ..."

# FIXED no need to adapt this to the path where you stored ulogme.git/
# cd ~/.local/share/ulogme/scripts/  # XXX change according to your installation
cd "$( dirname "${BASH_SOURCE[0]}" )"

port="${1:-8124}"

if pidof firefox >/dev/null; then
	echo -e "Opening 'http://localhost:${port}/' in your favorite browser ..."
	firefox -new-tab "http://localhost:${port}"/ &
    # xdg-open "http://localhost:${port}"/ &  # Generic on Linux
	# open "http://localhost:${port}"/ &      # Generic on Mac
    # XXX this should be a better and cross-platform way to do it
    # python -m webbrowser -t "http://localhost:${port}"/
else
	echo -e "Firefox is not running, by default the uLogMe page will not be opened ..."
	echo -e "('http://localhost:${port}/' is only opened in a new tab if your Firefox is already running)."
fi

echo -e "Calling 'python ulogme_serve.py ${port}' ..."
python ./ulogme_serve.py "${port}"
{'fraction_non_alphanumeric': 0.16740960871718671, 'fraction_numerical': 0.005943536404160475, 'mean_word_length': 3.63302752293578, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '2324161', 'n_tokens_mistral': 707, 'n_tokens_neox': 673, 'n_words': 226}