date "+%a %d %b" | tr '[a-z]' '[A-Z]'
date "+%H:%M"
uptime | sed 's/.*up \(.*\), [0-9]* user.*/Uptime: \1/'
top -l 2 | awk '/CPU usage/ && NR > 5 {print $12, $13}'
Veronica skrev:Kodene jeg har brukt her:
Klokke: date "+%H:%M"
Dato: date +%d
Dag: date +%A
År: date +%Y
Måned: date "+%B"
Uptime: uptime | sed -e "s/:/ /2" | sed -e "s/,/ /2" | awk '{print "Up " $3 " " $4 " " $5 " hours and " $6 " minutes"}'
Batteri: my_ac_adapt=`ioreg -w0 -l | grep ExternalConnected | awk '{print $5}'`
if [ "$my_ac_adapt" == "Yes" ]
then
echo "Power : External"
else
cur_power=`ioreg -w0 -l | grep CurrentCapacity | awk '{print $5}'`
max_power=`ioreg -w0 -l | grep MaxCapacity | awk '{print $5}'`
bat_percent=`echo "scale=2;$cur_power / $max_power" | bc`
bat_percent=`echo "$bat_percent * 100" | bc | sed 's/.00//'`
cyc_count=`ioreg -w0 -l | grep "Cycle Count" | awk 'BEGIN { FS = "=" } ; {print $8}' | awk 'BEGIN { FS = "}" } ; {print $1}'`
echo "Power : Battery ($bat_percent%)"
echo "Cycles : $cyc_count"
fi
CPU: ps -arcwwwxo "command %cpu %mem" | grep -v grep | head -11
Været fra yr.no – Takk Einar!: curl --silent http://www.yr.no/stad/Noreg/Troms/Troms ... varsel.xml | grep 'temperature\|windSpeed'|head -n 2|cut -d \" -f 4 >/tmp/foo; echo C >>/tmp/foo; FOO=`cat /tmp/foo`; echo $FOO
(Bytt ut url-en til det stedet er på)
Sangen som spilles i iTunes vises med et program som heter Bowtie
For mer Geeklets, sjekk ut http://www.macosxtips.co.uk/geeklets/collections
Lykke til
uptime
curl -s www.whatismyip.com/automation/n09230945.asp | awk {'print "External : " $1'}
nslookup mittdomene.dyndns.org | grep "Address: " | awk '{print "mittdomene.dyndns.org: " $2}'
ifconfig en0 | grep "inet " | awk '{print "Ethernet: " $2}'
ifconfig en1 | grep "inet " | awk '{print "AirPort: "$2}'
echo New Mail
echo 'tell application "Mail" to return unread count of inbox as string & ""' | osascript | grep -v ‘0’
date +%H
date +%M
date +%S
date +%A
date +%d
date +%m
date +%B
date +%Y
echo Weather In Harstad
curl --silent "http://weather.yahoo.com/norway/troms-fylke/harstad-859418/" | grep "forecast-icon" | sed "s/.*background\:url(\'\(.*\)\')\;\ _background.*/\1/" | xargs curl --silent -o /tmp/weather.png
file:///tmp/weather.png
curl --silent "http://weather.yahooapis.com/forecastrss?p=NOXX0052&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's///' -e 's/<\/description>//'
curl --silent "http://weather.yahooapis.com/forecastrss?p=NOXX0052&u=f" | grep -E '(Current Conditions:|F<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's///' -e 's/<\/description>//'
echo Tasks
osascript users/user/path-to-script/scriptname.scpt
echo Macintosh HD:
df -hl | grep 'disk0s2' | awk '{print $4"/"$2" ledig ("$5" brukt)"}'
echo Papirkurv:
du -sh ~/.Trash/ | awk '{print $1}'
echo Oppetid:
uptime | awk '{sub(/[0-9]|user\,|users\,|load/, "", $6); sub(/mins,|min,/, "min", $6); sub(",", "min", $5); sub(":", "t ", $5); sub(/mins,|min,/, "min ", $4); ; sub(" t ", " t", $4); sub(/day,/, "dag ", $4); sub(/days,/, "dager ", $4); sub(":", "t ", $3); sub(",", "min ", $3); print $3 $4 $5 $6 " våken"}' | sed -e 's/1days/1day /g' -e 's/min1/min/g' -e 's/usersmin//g'
# Change this to en0 for an ethernet connection instead of airport
INTF=en1
# get the current number of bytes in and bytes out
sample1=(`/usr/sbin/netstat -ib | awk "/$INTF/"'{print $7" "$10; exit}'`)
# wait one second
sleep 1
# get the number of bytes in and out one second later
sample2=(`/usr/sbin/netstat -ib | awk "/$INTF/"'{print $7" "$10; exit}'`)
# find the difference between bytes in and out during that one second
# and convert bytes to kilobytes
results=(`echo "2k ${sample2[0]} ${sample1[0]} - 1024 / p" "${sample2[1]} ${sample1[1]} - 1024 / p" | dc`)
# print the results
printf "In: %.2f Kb/sec\nOut: %.2f Kb/sec\n" ${results[0]} ${results[1]}
my_ac_adapt=`ioreg -w0 -l | grep ExternalConnected | awk '{print $5}'`
if [ "$my_ac_adapt" == "Yes" ]
then
echo "Strøm : Ekstern"
else
cur_power=`ioreg -w0 -l | grep CurrentCapacity | awk '{print $5}'`
max_power=`ioreg -w0 -l | grep MaxCapacity | awk '{print $5}'`
bat_percent=`echo "scale=2;$cur_power / $max_power" | bc`
bat_percent=`echo "$bat_percent * 100" | bc | sed 's/.00//'`
cyc_count=`ioreg -w0 -l | grep "Cycle Count" | awk 'BEGIN { FS = "=" } ; {print $8}' | awk 'BEGIN { FS = "}" } ; {print $1}'`
echo "Strøm : Batteri ($bat_percent%)"
echo "Sykluser : $cyc_count"
fi
URL="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/technology/rss.xml"
maxLength="500"
start="3"
end="9"
curl --silent "$URL" |
sed -e :a -e '$!N;s/\n//;ta' |
sed -e 's/<title>/\
<title>/g' |
sed -e 's/<\/title>/<\/title>\
/g' |
sed -e 's/<description>/\
<description>/g' |
sed -e 's/<\/description>/<\/description>\
/g' |
grep -E '(title>|description>)' |
sed -n "$start,$"'p' |
sed -e 's/<title>//' |
sed -e 's/<\/title>//' |
sed -e 's/<description>/ /' |
sed -e 's/<\/description>//' |
sed -e 's/<!\[CDATA\[//g' |
sed -e 's/\]\]>//g' |
sed -e 's/</</g' |
sed -e 's/>/>/g' |
sed -e 's/<[^>]*>//g' |
cut -c 1-$maxLength |
head -$end |
sed G |
fmt
curl -s -u username:password
http://twitter.com/statuses/friends_timeline.rss | egrep "<title>|<pubDate>" | head -n 31 | tail -n 30 | sed -E 's/^[ ]+//' | sed -n -E '1h;1!{;/<title>.+<\/pubDate>/ !H;g;/<title>.+<\/pubDate>/ {;s/<title>(.+)<\/title>.+<pubDate>.+([0-9]{2}:[0-9]{2}:[0-9]{2}).+<\/pubDate>/\2 – \1/g;p;n;h;};h;};$p' | sed -e 's/<br \/>//' -e 's/Mac_Life/Mac Life:/g' -e 's/ö/ö/g' -e 's/ü/ü/g' -e 's/Ü/ü/g' -e 's/ä/ä/g' -e 's/ß/ß/g' -e 's/"/"/g' -e 's/::/:/g' -e 's/ / /g' -e 's/#//g' | sed 4q
echo Todays Events
/usr/local/bin/icalBuddy -ec 901EF7D4-FA91-4EC7-94E7-22E2380B228B,BAFDD9C8-4571-4EFD-ACEC-2651CC1337EF,67821C2A-A4F7-4A37-AD26-C131C7D0F85A,95EA7205-0F4D-441F-BBEE-F8843245EBC7 -nc -po datetime, title -eep notes,location -tf "%1I:%M" -ps "|: |" eventsToday
echo Birthday´s
/usr/local/bin/icalBuddy -ec 901EF7D4-FA91-4EC7-94E7-22E2380B228B,BAFDD9C8-4571-4EFD-ACEC-2651CC1337EF,67821C2A-A4F7-4A37-AD26-C131C7D0F85A,95EA7205-0F4D-441F-BBEE-F8843245EBC7,3F6636B8-F2CC-4A46-B18A-5B68A87FEBFD,BD08F89E-9609-46B5-BD30-AD525FC7A993 -nc -po datetime, title -eep notes,location -tf "%1I:%M" -ps "|: |" eventsToday+7
curl --silent http://www.yr.no/sted/Norge/Oppland/Gj%C3%B8vik/Gj%C3%B8vik/varsel.xml | grep 'temperature\|windSpeed'|head -n 2|cut -d \" -f 4 >/tmp/foo; echo C >>/tmp/foo; FOO=`cat /tmp/foo`; echo $FOO
Returner til Diverse programvare
Registrerte brukere: Google [Bot]