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.
Thanks a lot digitallife!

Works great. But when there is no content between <zeile2> and </zeile2>
It doesn't remove those two xml tags.
I have no idea why...
 
Thanks a lot digitallife!

Works great. But when there is no content between <zeile2> and </zeile2>
It doesn't remove those two xml tags.
I have no idea why...

Hi,

yeah it's "obvious":
replace the last part with:
Code:
sed -E 's/\<.+>(.[COLOR="Red"]*[/COLOR])\<\/.+>/\1/'

The + mean "one or more" the * means "zero or more" :)
 
I know there is already a way to get facebook notifications. Here is my version that skips the use of automator.

$ curl "http://your url here" -A "Mozilla/4.0" | grep 'title' | egrep '(commented|your Wall)' | sed -e 's/\<title\>//' -e 's/\<\/title\>//' -e "s/\&apos\;/'/" -e 's/ //' | head -n 4

The url you must have to use this can be obtained by clicking the notifications button on the lower right hand corner of any facebook page. From there click on show all. This should send you to a new page. Click the link for "Your notifications" on the right side of the screen. Now this should send you to a new page. Copy the url and paste that into your url here. To change the number of notifications shown change the last number in the code. It is currently set to show 4.

You must replace feed:// (from the facebook url) with http:// otherwise this will not work.

That should work to show facebook notifications if not write back and I'll try my best to help troubleshoot.

I'm trying to use this to view status updates. Can you save me the trouble of reverse-engineering everything and document what each section of this command is doing? I've never used 'sed' before, though I understand its power. Deciphering all of that is giving me a headache! (Though I'll get it eventually.)
 
Hi,

yeah it's "obvious":
replace the last part with:
Code:
sed -E 's/\<.+>(.[COLOR="Red"]*[/COLOR])\<\/.+>/\1/'

The + mean "one or more" the * means "zero or more" :)

thanks man.... are those regular expressions?
Now I gotta figure out how to make the headlines bold...
 
thanks man.... are those regular expressions?
Now I gotta figure out how to make the headlines bold...

Hi,

yes sed uses regular expressions.
To learn about sed and regular expressions check a post of mine 1 or 2 pages back.

Regarding bold a can say the ANSI code for it is [1m.
Check another post of mine also a couple pages back regarding the usage of ANSI color codes.

So you should get to a result like this: :D
Code:
curl https://www.rz.fh-hannover.de/etech/schoof/meldungen/export/meldungen.xml | grep -E '(ueberschrift|zeile)' | sed -E 's/\<zeile/  &/1' | sed -E 's/\<ueberschrift>(.+)\<\/ueberschrift>/[COLOR="Magenta"]^[[/COLOR][1m\1[COLOR="Magenta"]^[[/COLOR][0m/' |sed -E 's/\<.+>(.+)\<\/.+>/\1/'
Please note that the '^[' is only 1 character and has to be typed in a special way (refer to my post on ANSI colors)
 
Hi all,

Been going thru all the excellent scripts here and deciding which ones I would like to try to get my feet under me before I start work on some of my own. One question for this n00b though .... When one makes their geeklets, do they all go under the "default group" or should one create a group of each geeklet you write or a group for each type of geeklet?

I hope I worded that correctly.

Thanks in advance for any advice anyone can give me.

Scott
 
Been going thru all the excellent scripts here and deciding which ones I would like to try to get my feet under me before I start work on some of my own. One question for this n00b though .... When one makes their geeklets, do they all go under the "default group" or should one create a group of each geeklet you write or a group for each type of geeklet?

I setup separate groups so that I can turn some of them on and off when I change my desktop without needing to recreate them every time.
 
Thanks. Do you mean a group for shell geeklets, a group for file geeklets, and a group for image geeklets? Or something else instead - like a group for date/calendar geeklets, a group for AppleScript geeklets, etc...?

Thanks.

Scott
 
Thanks. Do you mean a group for shell geeklets, a group for file geeklets, and a group for image geeklets? Or something else instead - like a group for date/calendar geeklets, a group for AppleScript geeklets, etc...?

Thanks.

Scott

Group them however you want. I use a group for iTunes related stuff, my Date and Time, and then System Info.
 
Can someone look at my multiple calenders code and see why I'm repeating January 2009 instead of displaying January 2010. Just noticed this when November hit. Thanks for the help
Code:
# prev month
cal -m $(date -v-1m +%b)

#next month
cal -m $(date -v+1m +%b)

#Month after next
cal -m $(date -v+2m +%b)
And my Desktop running the cal.
Nov.png
 
Can someone look at my multiple calenders code and see why I'm repeating January 2009 instead of displaying January 2010. Just noticed this when November hit. Thanks for the help
Code:
# prev month
cal -m $(date -v-1m +%b)

#next month
cal -m $(date -v+1m +%b)

#Month after next
cal -m $(date -v+2m +%b)
And my Desktop running the cal.
Nov.png

Hi,

that happens because the "date -v-2m +%b" returns the month (january). Since you don't specify the year, it assumes it's the current year,therefore you get January 2009.

Instead of
date -v+2m +%b
use
date -v+2m "+%b %Y"

It should work (didn't test it)
 
Hi,

yes sed uses regular expressions.
To learn about sed and regular expressions check a post of mine 1 or 2 pages back.

Regarding bold a can say the ANSI code for it is [1m.
Check another post of mine also a couple pages back regarding the usage of ANSI color codes.

So you should get to a result like this: :D
Code:
curl https://www.rz.fh-hannover.de/etech/schoof/meldungen/export/meldungen.xml | grep -E '(ueberschrift|zeile)' | sed -E 's/\<zeile/  &/1' | sed -E 's/\<ueberschrift>(.+)\<\/ueberschrift>/[COLOR="Magenta"]^[[/COLOR][1m\1[COLOR="Magenta"]^[[/COLOR][0m/' |sed -E 's/\<.+>(.+)\<\/.+>/\1/'
Please note that the '^[' is only 1 character and has to be typed in a special way (refer to my post on ANSI colors)

Great, thanks a lot!
But I just can't figure out how to type the Escapecharacter into NerdTool. I can use them in the terminal, but when I copy and paste it into Nerdtool, it becomes two characters :-(
I s there another ways excpet for STRG+v and then ESC?
Sory, for asking this, but I did not get it from your previous post :-/
 
Great, thanks a lot!
But I just can't figure out how to type the Escapecharacter into NerdTool. I can use them in the terminal, but when I copy and paste it into Nerdtool, it becomes two characters :-(
I s there another ways excpet for STRG+v and then ESC?
Sory, for asking this, but I did not get it from your previous post :-/

Don't know about Nerdtool.
But you can always put the command in a shell script file and run that from nerdTool
 
it's supposed to support ANSI ESC characters.
But the only way I get one of those is in the terminal via strg+v and ESC. When i move the cursor in the terminal line, it's recognized as one character, but when i select it with the mouse it's two characters. And that's how it gets pasted into Textedit.app when I try to write a shell script. Or Nerdtool, when I try to set it as shell command.... always two characters. Is there any other way to print these?
I always end up having printed the two characters:

Bildschirmfoto%202009-11-02%20um%2020.42.40.png
 
it's supposed to support ANSI ESC characters.
But the only way I get one of those is in the terminal via strg+v and ESC. When i move the cursor in the terminal line, it's recognized as one character, but when i select it with the mouse it's two characters. And that's how it gets pasted into Textedit.app when I try to write a shell script. Or Nerdtool, when I try to set it as shell command.... always two characters. Is there any other way to print these?
I always end up having printed the two characters:

Bildschirmfoto%202009-11-02%20um%2020.42.40.png

Hi,

copying&pasting won't work. You need to input those directly in nerdtool or in the shell script file.
You know how to create/edit a file in terminal right?
Then do that, put the command in it, make it executable (chmod u+x filename) and point nerdtool to this file.
 
I just tried it using the editor 'vi'. I get one character when using str+v ESC , then I save, but when I use the shellscript in Nerdtool it prints [1m
no bold...
what am I doing wrong??
 
okay, no I tried using:

Code:
echo "curl https://www.rz.fh-hannover.de/etech/schoof/meldungen/export/meldungen.xml | grep -E '(ueberschrift|zeile)' | sed -E 's/\<zeile/  &/1' | sed -E 's/\<ueberschrift>(.+)\<\/ueberschrift>/^[[1m\1^[[0m/' |sed -E 's/\<.+>(.*)\<\/.+>/\1/'" > news3.sh

I replaced the "two characters" with the escape character, then hit enter to write the file....
doesnt work. Nerdtool prints [1m and [0m

:-(
 
okay, no I tried using:

Code:
echo "curl https://www.rz.fh-hannover.de/etech/schoof/meldungen/export/meldungen.xml | grep -E '(ueberschrift|zeile)' | sed -E 's/\<zeile/  &/1' | sed -E 's/\<ueberschrift>(.+)\<\/ueberschrift>/^[[1m\1^[[0m/' |sed -E 's/\<.+>(.*)\<\/.+>/\1/'" > news3.sh

I replaced the "two characters" with the escape character, then hit enter to write the file....
doesnt work. Nerdtool prints [1m and [0m

:-(

2 things:
- are you sure Nerdtool supports these color codes?
- if, in Terminal, you type: cat news3.sh do you see the ^[[Xm or you see the '\1' in bold?

edit: take the attached zip (uncompress it), place it in a known directory, go to terminal, make this script executable (chmod u+x sysinfo.sh) and set nerdtool to use it.

This one I'm sure it works! (if it doesn't then it's nerdtool problem... - you can also test it in Terminal to see that it actually works)
 

Attachments

  • sysinfo.zip
    476 bytes · Views: 144
okay, I am trying geektool 3 RC5 right now....
But is there a trick? when i try to run a shell command like curl, I dont get any output. Little snitch says geektool transfers data, but I don't see anything in the grey frame.
A command like "echo test" works fine....
maybe because it's a release candidate?
 
okay, I am trying geektool 3 RC5 right now....
But is there a trick? when i try to run a shell command like curl, I dont get any output. Little snitch says geektool transfers data, but I don't see anything in the grey frame.
A command like "echo test" works fine....
maybe because it's a release candidate?

Hi,
there's no trick. It's still an RC but there's no trick.
Check the colors in Geektool, maybe it's outputting black text on a black background...but if echo works then curl works too.

My suggestion is to do everything in terminal and put all the commands in shell scripts. Then call the script from GT.

Good luck
 
Hi,

that happens because the "date -v-2m +%b" returns the month (january). Since you don't specify the year, it assumes it's the current year,therefore you get January 2009.

Instead of
date -v+2m +%b
use
date -v+2m "+%b %Y"

It should work (didn't test it)
It gives me the whole year for 2010 instead of just January 2010.
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.