WhatsMyPorts
You can put the following in your .bash_profile:
# planet argon general purpose digits:
PORTDIGITS=$(printf '%03d' $(($UID % 1000)))
# 2036 => '036', octal when numeric
declare -i portvalue
portvalue=$(($UID % 1000))
# 2036 => 36, decimal number
# PostgreSQL Port
export PGPORT=$((5400 + $portvalue))
export POUNDPORT=$((8000 + $portvalue))
export MONGPORT0=1${PORTDIGITS}0
export MONGPORT1=1${PORTDIGITS}1