# Makes colorizing output a bit easier.
# $1: string to be colorized
# $2: tput color code
# $3: flag for bold text
function echo_c {
    local setcolor="$(tput setaf "$2")"
    local setnormal="$(tput sgr0)"
    [[ ${3:-} == "-b" ]] && local setbold="$(tput bold)"

    echo "${setbold:-}${setcolor}$1${setnormal}"
}

# Timer for various simple timing needs.
# $1: time in seconds (mandatory)
function timer {
    if [[ $1 == "" ]]; then
        echo "$(echo_c "ERROR:" 1 -b) Missing parameter"
        return
    elif ! [[ $1 =~ '^[0-9]+$' ]]; then
        echo "$(echo_c "ERROR:" 1 -b) Not a number"
        return
    fi

    for i in {1..$1}; do sleep 1; echo -n -e $i\\r; done
}


# Makes colorizing output a bit easier.
# $1: string to be colorized
# $2: tput color code
# $3: flag for bold text
function echo_c {
    local setcolor="$(tput setaf "$2")"
    local setnormal="$(tput sgr0)"
    [[ ${3:-} == "-b" ]] && local setbold="$(tput bold)"

    echo "${setbold:-}${setcolor}$1${setnormal}"
}

# Timer for various simple timing needs.
# $1: time in seconds (mandatory)
function timer {
    if [[ $1 == "" ]]; then
        echo "$(echo_c "ERROR:" 1 -b) Missing parameter"
        return
    elif ! [[ $1 =~ '^[0-9]+$' ]]; then
        echo "$(echo_c "ERROR:" 1 -b) Not a number"
        return
    fi

    for i in {1..$1}; do sleep 1; echo -n -e $i\\r; done
}

# Find process using a port
# $1: port number
function port_user() {
  lsof -nP "-iTCP:$1" | grep LISTEN
}


Add helper for finding the user of a port
zsh: Add helper for finding the user of a port
