blob: f9e1370c85f0b43449d454f6625c79147a41e2fb [file] [log] [blame]
#!/bin/bash
# For generic functions.
function ips {
ifconfig | grep "inet " | awk '{ print $2 }'
}
function myip {
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
echo "Your public IP is: ${bold_green} $res ${normal}"
}
function mkcd(){
mkdir -p "$*"
cd "$*"
}
# View man documentation in Preview
pman () {
man -t "${1}" | open -f -a $PREVIEW
}
pcurl() {
curl "${1}" | open -f -a $PREVIEW
}
pri() {
ri -T "${1}" | open -f -a $PREVIEW
}
banish-cookies() {
rm -r ~/.macromedia ~/.adobe
ln -s /dev/null ~/.adobe
ln -s /dev/null ~/.macromedia
}
# disk usage per directory
# in Mac OS X and Linux
usage ()
{
if [ $(uname) = "Darwin" ]; then
if [ -n $1 ]; then
du -hd $1
else
du -hd 1
fi
elif [ $(uname) = "Linux" ]; then
if [ -n $1 ]; then
du -h --max-depth=1 $1
else
du -h --max-depth=1
fi
fi
}