Skip to content

Commit cac5280

Browse files
committedOct 8, 2012
all scripts added
will need more comments on what they do, how to setup, etc...
1 parent 28f9c14 commit cac5280

File tree

7 files changed

+76
-0
lines changed

7 files changed

+76
-0
lines changed
 

‎butler_Macmini_client/._butler.sh

4 KB
Binary file not shown.

‎butler_Macmini_client/butler.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#bash script for butler program.
2+
#This script is the main brains of the whole operation.
3+
osascript -e 'set volume output volume 100'
4+
5+
say "Hello. The time is currently"
6+
say `date "+%l %M"`
7+
echo `ssh pi@192.168.1.64 weather fat` | awk '{print $1, $2, $3, $4". " $21, $22, "fahrenheit.", $26, $27, $28".", $29, $36, "Miles per hour.", $40, $41, $42, $43, $44, $45, $46}' |say
8+
echo `ssh pi@192.168.1.64 weather -f fat |grep FRESNO| awk {'print "Forcast for today. High of ", $2 ". Low of "$3"." '}` | say
9+
gigs=`ssh -t pi@192.168.1.64 /home/pi/bytes.bash | awk {'print $3'}`
10+
say "We have currently used $gigs Gigabytes this month."
11+
say "Internet percentage: $((${gigs}*100/250)) %"
12+
13+
say "The agenda for today and tomorrow: " `ssh pi@192.168.1.64 sh agenda.sh`
14+
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if [ "`date "+%H" | awk '{print $1}'`" -le "21" -a "`date "+%H" | awk '{print $1}'`" -ge "6" ] ; then sh butler.sh; fi;
2+
exit 0;

‎butler_pi_server/agenda.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
current_date=`date | awk {'print $2"/"$3"/"$6'}`
4+
tomorrow_date=`date --date='2 days' | awk {'print $2"/"$3"/"$6'}`
5+
echo `gcalcli --user usernamegoogle --pw 'userpasswordgoogle' agenda $current_date $tomorrow_date` | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
6+
7+
exit 0;

‎butler_pi_server/bytes.bash

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
curl -silent http://192.168.1.254/xslt?PAGE=C_1_0 > snapshot.html
2+
3+
line_number=`more snapshot.html| grep '<td class="indent">Receive</td>' -n | awk '{ print $1 }'| sed "s/:$//"`
4+
#echo $line_number
5+
6+
line_number=$((line_number+1))
7+
8+
#echo $line_number
9+
10+
#Now we know the line number so forget being precise for later updates. Ill change it when the time comes.
11+
specific_line_in_text_file=`sed -n 168p snapshot.html`
12+
13+
echo $specific_line_in_text_file > snapshot_today.txt
14+
15+
#Getting the number from snapshot_today
16+
numbers=`cat snapshot_today.txt`
17+
18+
transmit_in_bytes=`cat snapshot_today.txt | sed 's/<[./]*t[rd]>/\n/g' | awk 'NF'`
19+
#Done with getting snapshot of transmit but now need the recieving end.
20+
21+
#new
22+
specific_line_in_text_file=`sed -n 169p snapshot.html`
23+
24+
25+
echo $specific_line_in_text_file > snapshot_today.txt
26+
27+
# Got both numbers in text file, now need to extract them and add them together.
28+
29+
sent_in_bytes=`cat snapshot_today.txt | sed 's/<[./]*t[rd]>/\n/g' | awk 'NF'`
30+
31+
#echo $((($transmit_in_bytes+$sent_in_bytes)))
32+
33+
total_bytes=$((($transmit_in_bytes+$sent_in_bytes)))
34+
35+
#Formatting of output
36+
37+
#one line
38+
echo $total_bytes" bytes "$((total_bytes/1073741824))" GB "$((total_bytes/1048576))" MB "`date`
39+
40+
#multiple lines
41+
#echo $total_bytes$" bytes"
42+
#echo $((total_bytes/1048576))$" MB"
43+
#echo $((total_bytes/1073741824))$" GB "
44+
#date | awk '{ print $2" "$3" "$6}'
45+
exit 0

‎butler_pi_server/calendar_agenda.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gcalcli --user usernamegoogle --pw 'userpasswordgoogle' agenda

‎butler_pi_server/weather.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
echo "Weather right now"
2+
weather fat
3+
4+
5+
echo "weather for today"
6+
echo " TEMPERATURE / PRECIPITATION"
7+
weather fat -f | grep FRESNO

0 commit comments

Comments
 (0)
Please sign in to comment.