<commit_before># Opens the current directory, otherwise opens the given file, directory or URL
function o() {
    local parameter="$@"

    if [ $# -eq 0 ]; then
        parameter="."
    fi

    if [[ "$OSTYPE" =~ ^darwin ]]; then
        open $parameter
    else
        (xdg-open $parameter &> /dev/null &)
    fi
}

# Simple calculator
function calc() {
    local result=""
    result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')"
    #                       └─ default (when `--mathlib` is used) is 20
    #
    if [[ "$result" == *.* ]]; then
        # improve the output for decimal numbers
        printf "$result" |
        # add "0" for cases like ".5"
        # add "0" for cases like "-.5"
        # remove trailing zeros
        sed -e 's/^\./0./' \
            -e 's/^-\./-0./' \
            -e 's/0*$//;s/\.$//'
    else
        printf "$result"
    fi
    printf "\n"
}

# Converts px to rem
function rem() {
    calc "$1/16"
}

# Create a new directory and enter it
function mkd() {
    mkdir -p "$@" && cd "$_";
}

# Determine size of a file or total size of a directory<commit_msg>functions: automatically copy rem result to clipboard<commit_after># Opens the current directory, otherwise opens the given file, directory or URL
function o() {
    local parameter="$@"

    if [ $# -eq 0 ]; then
        parameter="."
    fi

    if [[ "$OSTYPE" =~ ^darwin ]]; then
        open $parameter
    else
        (xdg-open $parameter &> /dev/null &)
    fi
}

# Simple calculator
function calc() {
    local result=""
    result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')"
    #                       └─ default (when `--mathlib` is used) is 20
    #
    if [[ "$result" == *.* ]]; then
        # improve the output for decimal numbers
        printf "$result" |
        # add "0" for cases like ".5"
        # add "0" for cases like "-.5"
        # remove trailing zeros
        sed -e 's/^\./0./' \
            -e 's/^-\./-0./' \
            -e 's/0*$//;s/\.$//'
    else
        printf "$result"
    fi
}

# Converts px to rem
function rem() {
    local result=$(calc "$1/16")
    printf $result
    printf $result | pbcopy 2> /dev/null
}

# Create a new directory and enter it
function mkd() {
    mkdir -p "$@" && cd "$_";
}

# Determine size of a file or total size of a directory
{'fraction_non_alphanumeric': 0.16695352839931152, 'fraction_numerical': 0.01333907056798623, 'mean_word_length': 1.7978339350180506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '1980528', 'n_tokens_mistral': 778, 'n_tokens_neox': 749, 'n_words': 261}