Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code for GeekTool
- (Time in bottom left corner)
- (Day)
- date +%A
- (Min)
- date +"%M"
- (Hour)
- date +"%I"
- (Uptime - Adjusts if it's over or under 1 day)
- #!/bin/bash
- then=$(sysctl kern.boottime | awk '{print $5}' | sed "s/,//")
- now=$(date +%s)
- diff=$(($now-$then))
- days=$(($diff/86400));
- diff=$(($diff-($days*86400)))
- hours=$(($diff/3600))
- diff=$(($diff-($hours*3600)))
- minutes=$(($diff/60))
- seconds=$(($diff-($minutes*60)))
- function format {
- if [ $1 == 1 ]; then
- echo $1 ' ' $2
- else
- echo $1 ' ' $2's'
- fi
- }
- if [ "$days" = "0" ]; then
- echo 'Uptime: '`format $hours "hour"` `format $minutes "minute"`;
- else
- echo 'Uptime: '`format $days "day"` `format $hours "hour"`;
- fi
- (Disk Usage Percentage)
- DUtext="Disk Usage"; DUval=`df /Volumes/MacBook\ HDD | awk '{ print $5 }' | tail -n 1`;echo $DUtext":" $DUval;
- (Downloads Folder Size)
- DL=`echo "Downloads"`&& DLSize=`du -h ~/Downloads/ | tail -1 | cut -c 1-5`; echo $DL":" $DLSize;
- (IP Info)
- #!/usr/bin/perl
- $en0_info = `ifconfig en0 | grep "inet" | grep -v 127.0.0.1`;
- $en1_info = `ifconfig en1 | grep "inet" | grep -v 127.0.0.1`;
- $ext_info = `curl --silent http://checkip.dyndns.org | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'`;
- $airport_network = `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk -F: '/ SSID: / {print $2}' | sed -e 's/.*SSID: //'`;
- $output="IP: ";
- #if($ext_info) {
- # $output .= "Ext. IP: $ext_info";
- #} else {
- # $output .= "No WAN \n";
- #}
- if($en0_info) {
- $en0_info =~ /inet (.*) netmask/s;
- $output .= "LAN ($1)";
- $noLAN = 0;
- } else {
- $noLAN = 1;
- #$output .= "Ethernet: INACTIVE \n";
- }
- if($en1_info) {
- $en1_info =~ /inet (.*) netmask/s;
- $en1_info = $1;
- $output .= "WLAN($en1_info)";
- #$output .= "Network: $airport_network";
- $noWiFi = 0;
- } else {
- $noWiFi = 1;
- #$output .= "Airport: INACTIVE";
- }
- if(($noWiFi == 1) && ($noLAN == 1)){
- $output .= "No Network";
- }
- print "$output";
- (Trash Size)
- trash=`echo "Trash"`&& trashSize=`du -h ~/.Trash/ | tail -1 | cut -c 1-5`; echo $trash":" $trashSize;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement