used_percent=`echo $used_percent | cut -d . -f 1`
# Default output. Place a # (comment) sign at the start of the next "echo" line if wishing top use the Extended output.
# Extended output. Remove the # sign from the "echo" line below to use.
ioreg=`ioreg -w0 -l | grep "ExternalConnected\|CurrentCapacity\|MaxCapacity" | awk '{print $5}'`
Load Average
top -n1 -l1 | grep "Load Avg" | sed 's/.*usage: //; s/ user.*//;'
top -n1 -l1 | grep "Load Avg" | sed 's/.*user, //; s/ sys.*//;'
top -n1 -l1 | grep "Load Avg" | sed 's/.*sys, //; s/ idle.*//;'
Good calendar red
cal | sed -E '1,$'"s/ ($(date +%e))( |$)/ $(echo '\033[1;31m')\1$(echo '\033[0m')\2/"
For the weather create an image screen with this url:
Then create a separate script with one of these:
Weather radar NY
curl --silent "http://www.weather.com/weather/map/USNY1265" | grep "mapImg" | sed 's/^.*src="//' | sed 's/".*$//' | xargs curl --silent -o /tmp/weather_map_satelite.jpg\
Weather Radar TX
curl --silent "http://www.weather.com/weather/map/USTX0617" | grep "mapImg" | sed 's/^.*src="//' | sed 's/".*$//' | xargs curl --silent -o /tmp/weather_map_satelite.jpg\
Weather radar MA
curl --silent "http://www.weather.com/weather/map/ USMA0102" | grep "mapImg" | sed 's/^.*src="//' | sed 's/".*$//' | xargs curl --silent -o /tmp/weather_map_satelite.jpg\
Weather Radar LA
curl --silent "http://www.weather.com/weather/map/ USCA0638
" | grep "mapImg" | sed 's/^.*src="//' | sed 's/".*$//' | xargs curl --silent -o /tmp/weather_map_satelite.jpg\
Weather Radar London
curl --silent "http://www.weather.com/weather/map/ UKXX0085
" | grep "mapImg" | sed 's/^.*src="//' | sed 's/".*$//' | xargs curl --silent -o /tmp/weather_map_satelite.jpg\
Weather Radar Rome
curl --silent "http://www.weather.com/weather/map/ ITXX0067
" | grep "mapImg" | sed 's/^.*src="//' | sed 's/".*$//' | xargs curl --silent -o /tmp/weather_map_satelite.jpg\
Weather Radar Istanbul
curl --silent "http://www.weather.com/weather/map/ TUXX0014
" | grep "mapImg" | sed 's/^.*src="//' | sed 's/".*$//' | xargs curl --silent -o /tmp/weather_map_satelite.jpg\
Weather Radar Philly
curl --silent "http://www.weather.com/weather/map/ USPA1276
" | grep "mapImg" | sed 's/^.*src="//' | sed 's/".*$//' | xargs curl --silent -o /tmp/weather_map_satelite.jpg\
Wifi
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk -F: '/ SSID: / {print $2}' | sed -e 's/SSID: //' | sed -e 's/ //'
local IPs
echo "Local IPs";ifconfig | grep "inet" | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}'
External IPs
echo External IP: `curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'`
CPU/ memory usage chart
ps -amcwwwxo "command %mem %cpu" | grep -v grep | head -19
load average
top -n1 -l1 | grep "Load Avg" | sed 's/.*sys, //; s/ idle.*//;'
KB/ second
EN0=`ifconfig en0 | grep 'status' | awk '{print $2}'`
EN1=`ifconfig en1 | grep 'status' | awk '{print $2}'`
if [ $EN0 == 'active' ] ; then
INTERFACE=en0
elif [ $EN1 == 'active' ] ; then
INTERFACE=en1
fi
SAMPLE_A=(`/usr/sbin/netstat -bI "$INTERFACE" | awk "/$INTERFACE/"'{print $7" "$10; exit}'`);
sleep 1;
SAMPLE_B=(`/usr/sbin/netstat -bI "$INTERFACE" | awk "/$INTERFACE/"'{print $7" "$10; exit}'`);
BANDWIDTH_USAGE=(`echo "2k ${SAMPLE_B[0]} ${SAMPLE_A[0]} - 1024 / p" "${SAMPLE_B[1]} ${SAMPLE_A[1]} - 1024 / p" | dc`);printf "In: \t%.2f Kb/sec\nOut: \t%.2f Kb/sec\n" ${BANDWIDTH_USAGE[0]} ${BANDWIDTH_USAGE[1]};
Memory
df -H -l
ITunes info
DATA=$(osascript -e 'tell application "System Events"
set myList to (name of every process)
end tell
if myList contains "iTunes" then
tell application "iTunes"
if player state is stopped then
set output to "Stopped"
else
set trackname to name of current track
set artistname to artist of current track
set albumname to album of current track
if player state is playing then
set output to trackname & " | " & artistname & " | " & albumname & "new_line" & "Playing on iTunes | "
else if player state is paused then
set output to trackname & " | " & artistname & " | " & albumname & "new_line" & "Paused | "
end if
end if
end tell
else
set output to "iTunes is not running"
end if')
echo $DATA | awk -F new_line '{print $1}'
echo $DATA | awk -F new_line '{print $2}'
Today in history
curl http://www.infoplease.com/rss/dayinhistory.rss | grep CDATA | sed -e 's/\(.*\[\)//' -e 's/\].*//'
Weather prediction
curl --silent "http://xml.weather.yahoo.com/forecastrss?p=10580&u=f" | grep -E '(High:)' | sed -e 's/<BR \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<br \/>//'
Date in numbers (xx-xx-xx)
date +%D