Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Status
Not open for further replies.

proofrock

macrumors newbie
Jan 9, 2010
2
0
Thanks and...

First of all...to those who have contributed code I've "borrowed", I am indebted. I love the customization options made possible by GT.

On that note: earlier in the string there is a script for current weather conditions and a forecast. (The code is copied below.)

Can someone with more knowledge of programming please explain to me how to insert a line break between the current conditions and forecast?

Also, if anyone has insight on adding a degree symbol after the temperature, I'd be very appreciative.

Best,

Proofrock

Borrowed Script below:

#!/bin/sh
normal=''
bold=''
italic=''
underline=''
boldOff=''
italicOff=''
underlineOff=''
fgBlack=''
fgRed=''
fgGreen=''

echo "Now | ${fgRed}\c"
curl --silent "http://weather.yahooapis.com/forecastrss?p=USVA0023&u=f" | grep -e "Forecast:" -A2 -B2 |tail -n 4 | grep -v orecast | sed -e 's/
//' -e 's/
//' | sed -n -E '2n;s/(.+)[ ]\-[ ](.)\..:[ ](0-9).:[ ](0-9+)/'"$normal"' Tomorrow | '"$fgRed "'\2, \3|\4 f'"$normal"'/;p' | tr '\n' ' '
 

IngeniousWafer

macrumors newbie
Jan 9, 2010
3
0
Read system.log but exclude unwanted entries

I've been using GeekTool 3.0rc5 to display the contents of the system.log using the "file" geeklet; however, I've noticed that it displays many entries I just don't care to see. For example, my Drobo software writes hundreds of entries that are all exactly the same. The people at Drobo have admitted that these entries are harmless, but they haven't fixed the bug yet. I wanted to find a way to display the contents of my system.log file but exclude those bogus entries. I came up with the following:

Code:
tail -n 10 /private/var/log/system.log | grep -v "First String To Exclude | 2nd string | 3rd string"

The "tail" command will automatically display the last 10 entries of the system.log file, so you can erase the "-n 10 " above or change the "10" to whatever number you want. A note of caution though: the "tail" command has a flag option labeled "-f" (short for "follow") that will automatically update the display whenever a new entry is made to the system.log file. While it's ok to use that flag in Terminal.app, don't use it in GeekTool or it'll beachball forever. Stick with the command above and set the refresh to...I dunno...20 seconds.

If you have lots of strings you desire to hide, you can use a slightly more sophisticated command that refers to a separate file to find out what lines it should ignore. To do this, use the following command:

Code:
tail -n 10 /private/var/log/system.log | grep -vf path_to_file/system_log_exclude_list.txt

Create a file called system_log_exclude_list.txt and place it somewhere harmless. In that file, create a list of Basic Regular Expressions you wish to exclude. For example, mine contains the following lines:

datarobotics
NetICMPSocket
last message repeated
[insert some super cool regular expression here]

Again, set this command to refresh every 20 seconds.

I'll probably use a similar script to likewise parse my secure.log file and exclude some of the harmless entries there too.

Good luck!
 

poppero

macrumors member
Jun 26, 2009
67
0
Can someone with more knowledge of programming please explain to me how to insert a line break between the current conditions and forecast?[/QUOTE]

i could be more helpful if your post the original script you "borrowed", this one is a little bit messy...
by the way to print linespaces on bash you shuld use the special character "\n", i.e. try to lunch the command
Code:
echo -e "foo\nfoo"
and watch the output.
 

BrianJ844

macrumors member
Dec 8, 2009
69
2
Houston, Tx
Geektool and a To Do List

So I was fiddling around with Geektool and looking for different ways to use it and came across an article that says how to make a To Do list that appears on your desktop. The article is here. Anyway, I can't get it to work right. Like the list appears initially but won't update when I update the txt file. Any ideas?

Thanks
 

libwolf

macrumors newbie
Jul 16, 2008
11
0
Melbourne, Australia
So I was fiddling around with Geektool and looking for different ways to use it and came across an article that says how to make a To Do list that appears on your desktop. The article is here. Anyway, I can't get it to work right. Like the list appears initially but won't update when I update the txt file. Any ideas?

Thanks

Check the refresh every time - you'll want to set it to something fairly high so it doesn't put too much of a drain on your system.
 

BrianJ844

macrumors member
Dec 8, 2009
69
2
Houston, Tx
Yeah I looked for refresh time but I chose the file setting and it doesn't have a refresh time box... Check out the screen shot of the menu below. Also, everytime I open that box in Geektool (the date is set up using a different box with shell command not file), it duplicates itself...

I just want it to display the contents of that text file...
 

Attachments

  • Screen.jpg
    Screen.jpg
    381.1 KB · Views: 254

jck1634

macrumors 6502
Mar 16, 2009
309
137
Changed my geektool layout to match the HTC sense UI. Let me know what you guys think.

4266332470_dc3884db6f.jpg


Does anyone know a way to remove the temperature from the current conditions. I want to go from "Cloudy, 2 C" to just "Cloudy"
 

poppero

macrumors member
Jun 26, 2009
67
0
Does anyone know a way to remove the temperature from the current conditions. I want to go from "Cloudy, 2 C" to just "Cloudy"

The "method" is the same i described some posts ago but it differs on every kind of script used. This is one possible script for your purpose:
Code:
curl --silent "http://weather.yahooapis.com/forecastrss?p=YOURCITY&u=c" | grep -E '(Current Conditions:|[A-Z]<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//' -e 's/, [0-9]* [A-Z]//' | tail -n1

the black and white date-time-weather background is just a still image drawn on the wallpaper or does you know some trick i don't??? ;-)
 

jck1634

macrumors 6502
Mar 16, 2009
309
137
Thanks so much!! That worked a treat!

4265918691_cfa4b38d11.jpg


That’s actually a .png of the HTC Sense UI. It's not on the wallpaper. I was going for this effect.

htc-sense-UI.jpg
 

jck1634

macrumors 6502
Mar 16, 2009
309
137
Yeah it's just an image file behind all the other scripts. Got the image over at the iPhone Hacks forums

2elqe5e.png


Thanks to Blinded for the image!
 

jck1634

macrumors 6502
Mar 16, 2009
309
137
lol! That’s cool. This thread has helped me enough that I'm glad I'm able to help for once.

Here's a close of up it on my desktop if it helps you.

4266768840_2e7571b859_o.png
 

bugmcw

macrumors newbie
Dec 26, 2009
26
0
sorry, I forget a space in the regular expression...

Code:
curl --silent "http://weather.yahooapis.com/forecastrss?p=YOURCITY&u=c" | grep -E '(Current Conditions:|[A-Z]<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//' [B]-e 's/[A-Z a-z]*, //'[/B] | tail -n1

this one works great!

how could i edit this script that you wrote to just show tomorrow. and edit again to just show the day after tomorrow, that way i can edit the layout as i wish?

also: in my case today it is 48F and fair, but it only says 48 F... it does not say "Fair" any ideas?
 

MacDawg

Moderator emeritus
Mar 20, 2004
19,823
4,503
"Between the Hedges"
also: in my case today it is 48F and fair, but it only says 48 F... it does not say "Fair" any ideas?

You need the full code
I think this should do it

Code:
curl "http://weather.yahooapis.com/forecastrss?p=YOURCITY&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/<description>//' -e 's/<\/description>//'

Woof, Woof - Dawg
pawprint.gif
 

bugmcw

macrumors newbie
Dec 26, 2009
26
0
You need the full code
I think this should do it

Code:
curl "http://weather.yahooapis.com/forecastrss?p=YOURCITY&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/<description>//' -e 's/<\/description>//'

Woof, Woof - Dawg
pawprint.gif

that worked perfectly, do you know how i could get that same thing for the forecast? Where it would basically say:

Rainy, 55 F

Where rainy is the forecast and 55 F is the high for tomorrow?

And the same to infinity? i have a script which shows forecast, but i do not know how to splice it day by day, nor do i know how to add days to it...

edit: GO DAWGS!
 

MacDawg

Moderator emeritus
Mar 20, 2004
19,823
4,503
"Between the Hedges"
This is the only forecast script I have
I don't know enough about the code to change it
But I am sure others do
I just borrow, copy and paste

Code:
curl  "http://weather.yahooapis.com/forecastrss?p=YOURCITY&u=f" | grep -e "Forecast:" -A 2 | tail -n 2 | sed -e 's/<br \/>//' -e 's/<BR \/>//' | sed "s/\(.*\)\.\ \(.*\)/\1\?\2/" | tr "?" "\n" | sed "s/High\:\ \(.*\)\ Low\:\ \(.*\)/\?H\: \1\  L\:\ \2/" | sed "s/\?\(.*\)/\\1/"

Woof, Woof - Dawg
pawprint.gif
 

poppero

macrumors member
Jun 26, 2009
67
0
I was going for this effect.

that interested me so much that I found a possible solution.
i just extracted the two separators from the original background and put them in a new image of the same size. if you want exaclty the same 3d shadows effect it would be necessary to draw shadows beneath the lines... then, in nerdtool or geektool, you just need to put hours and minutes script beetween the two images. mine is still a work in progress but it looks good!

20100111-htygy45xuwsxejcjjbtw8w1hb.png


And the same to infinity? i have a script which shows forecast, but i do not know how to splice it day by day, nor do i know how to add days to it...

yahoo weather forecast taken by the link of my scripts can show only today and tomorrow forecast, if you have a script which shows more days post it and we'll try to modify it according your purpose.
 

jck1634

macrumors 6502
Mar 16, 2009
309
137
Yeah I can't get that to work for me. Any chance you could share the separators you extracted?
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.