忍者ブログ

Drowsy

覚書、Mac周りのカスタマイズ、デザイン、Photoshop、Illustrator、Flash、HTML、Mobile etc..

<< 03  2024/04  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30    05 >>
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

geektool

いろいろ変えたので以前の設定を書き留めておく。

1. 日付

//西暦(XXXX表記、%y:XX表記)
date "+%Y"
//月.日.(曜日) (曜日は%A:通常、%a:短縮)
date "+%m.%d(%a)"
//時:分:秒
date "+%H:%M:%S"

2. ユーザープロセス

//ユーザープロセス(上から14行目まで)
ps -c -U XXX -o command,%cpu,%mem -r | head -n 14
//XXXにユーザー名を入れる。

3. HDD、CPU、RAM使用状況

//HDD使用領域(使用中/合計 - 空き)
df -h | grep disk0s2 | awk '{print $3 ,"/", $2, "-", $4}' | sed 's/Gi/GB/g'
//CPU使用率(ユーザー、システム)
top -l 2 |awk '/CPU usage/ && NR > 5 {print "CPU: " $3 "/us  " $5 "/sy"}'
//メモリ使用量(使用中/合計)
top -l 1 | awk '/PhysMem/ {print "RAM: " $4 " / " $8}'

4. HDD使用状況詳細

echo "Macintosh HD Usage/" && 
df -h | grep disk0s2 | awk '{printf "Total   " "%.0f" , $2 ; if ($2 < 1024) print " MB" ; else print " GB"}'
df -h | grep disk0s2 | awk '{printf "Usable  " "%.0f" , $4 ; if ($4 < 1024) print " MB" ; else print " GB"}'
df -h | grep disk0s2 | awk '{printf "Used    " "%.0f" , $3 ; if ($3 < 1024) print " MB" ; else print " GB(" $5 ")"}'

5. 天気

//東京(コード:JAXX0085)の天気
//他の地域の場合はhttp://weather.comで調べて代入
echo "Present Weather/" && 
ruby -e '%w(rubygems hpricot open-uri).each {|l| require l};
  uri  = "http://xml.weather.yahoo.com/forecastrss?p=JAXX0085&u=c";
  doc  = Hpricot(open(uri)); # <- koko dokumentti omaksi objektikseen
  cond = (doc/"yweather:condition").first;
  puts "#{cond["temp"]}°C  #{cond["text"]}"'

6. IPアドレス

printf "IP : "
perl -MLWP::Simple -le '$_=get q(http://www.formyip.com/); \
  print $1 if /IP is ((\d{1,3}\.){3}\d{1,3})/'

//もしくは

printf "IP : "
curl -s cfaj.freeshell.org/ipaddr.cgi | awk {'print $1'}

7. ネットワークに接続しているプロセス

lsof -P -i -n | cut -f 1 -d " " | uniq

以上7つのgletファイルをまとめたZIP。
Geektool_set.zip
PR
<<  14  13  12  11  10  9  8  7  6  4  3  >>
|TOP|
Post your Comment

Trackback URL
Script by : Ninja Blog
忍者ブログ [PR]
Copyright © 2011 ach.pazru.com All rights reserved.