I was going to do an article on a hadith I read, but then I thought, why give my readers a fish when I can teach them how to fish!
I recently became interested in a Macintosh tool called Geektool. It's a delightful little program that runs in the background and puts one of 3 things on your desktop:
1) the output from a script (i.e it'll execute a small program and display the result)
2) text from a file
3) a picture from a folder
and using just these three things, people have come up with the most amazing desktops! Just take a look at these!
more available here: http://smokingapples.com/software/15-geektool-desktop-inspirations-for-the-weekend/
It's customizable and pretty straightforward, but most people have difficulty writing the script ones. In this article, I'll teach you how to turn a twitter feed into an rss feed and using some programming, display it on your desktop using Geektool :)
1. Download Geektool: http://itunes.apple.com/ca/app/geektool/id456877552?mt=12
2. Install it, it'll show up as a preference pane.
3. This is the twitter feed we'll be using as our source of hadiths:
http://twitter.com/#!/DailyHadith
unfortunately, none of the programs on your mac can just take the text, so we have to convert it to an RSS feed (a type of simplistic, list approach to getting information from websites) EVEN MORE UNFORTUNATELY, the option to do this from this Twitter feed has been removed, so we have to use another website. I've already done that for you so the RSS feed you'll need will be:
feed://api.twitter.com/1/statuses/user_timeline.rss?screen_name=dailyhadith
4. Make a folder on your desktop called "Geektool Desktops" and within that folder, make another one called "Common". (just do it, because that's where mine is and it makes everything easier. You can probably figure out what to change if you want to move your folder somewhere else :))
5. Now, we need to write a bit of code to automatically download the latest hadith, and save it to a text file! So, open "Automator" on your mac. If you go to the little magnifying glass in the very top corner of your screen and start typing "Automator" it'll show up. It looks like a little robot holding a tube.
6. Choose to make a new application
7. Find the "Get specified URLs" command and drag it to the workspace. Then edit it so it looks like this:
8. Below this, drag the "Get feeds from URLs"
9. Below that, drag the "Filter Articles" (we only want the most recent one). And set the options to "Any of the following are true", "Date Published" "Since Yesterday"
10. Drag "Get text from Articles" below the box made in step 9.
***UPDATE**** if you're running osX Lion, it's possible to stop the text from appearing twice. Beneath the "Get Text from Articles" add a "Filter Paragraphs"box. Under conditions set the following:
that is a "- ", there's a space after the dash. That should only save the text of the article, not the title. :)
11. Finally, drag "New Text File" beneath step 10's box, and set it as shown:
12. Finally, save the application as "Get Daily Hadith" (as an application too) inside the folder "Common" within the "Geektool Desktops" folder you created earlier, on your desktop.
13. You can run it if you like, to make sure it's working! Just double click it, or click the "run" button if you still have it open in automator. Now, you're going to have to get your hands a little dirty, because we need to stop this app from interrupting your work whenever we run it. So:
13a. right click on your "Get Daily Hadith" app
13b. select "show package contents"
13c. go into "contents"
13d. find "info.plist"
13e. right click, move to "open with" and choose "other"
13f. change "recommended applications" to "all applications" and find "textedit" in your application folder and use that to open the "info.plist" file
13g. scroll down to the bottom until you find these two lines
LSUIElement
change that "false" to "true", but without the quotes:
LSUIElement
go to the file menu, and select "save" and close all the finder windows to get out of there. What you've done is told the application to open in the background. You'll still be able to tell because your work may hiccup now and then, but at least it's not going to stop everything to load.
14. Now the Geektool code. I have to tell you though, that even the code I'm using isn't perfect. It's was adapted from the code I used to put my facebook feed on my desktop, and it has a tendency to put the hadith twice. Once for the title, and another for the content. This is because of how an RSS is set up, the title is usually a duplicate of the content. The workaround? Make the box small enough to only view one :P
Okay, open up the Geektool preference pane in system preferences and make a religion category. Drag yourself a "Shell"Geeklet to the desktop and a nice greyish square should appear, along with another preference pane that looks like this:
save it, and close the little window. Hopefully the Geeklet hasn't gone into a tizzy and started executing every time you touch it, but if it does, just...click other geektool stuff until it stops. If you click and hold some part of it, it usually pauses. Try and make the geeklet as small as possible and put it out of the way.
17. Drag another shell geeklet to the desktop, we'll use this one to display the hadith! Set your fonts and colors and groups and names and refresh rates before adding the code (this one's not so bad because it can execute from within Geektool).
18. In the command box, copy and paste this underlined text:
head -n 300 ~//Desktop/Geektool\ Desktops/Common/Daily\ hadith.txt | tr -s '[\n]' '\n' |tr '-' '~'| sed 's/~~/ /g' | sed 's/~//g' | sed 's/+0000//g' |grep '[a-zA-Z]'|sed '/$/G'
That was adapted from another geeklet I have that posts my facebook feed to my desktop, and was obtained from another site. Still, the principle is the same, you can see the address of the file, and the rest is just formatting stuff. Now, one issue I noticed is that this code removes anything in quotations. Which is kind of irritating since a lot of hadith's are quotes. I believe this is because of the grep '[a-zA-Z]' command there, but I'm not sure. If you find yourself with a hadith with missing quotes, try changing the command to this instead:
head -n 300 ~//Desktop/Geektool\ Desktops/Common/Daily\ hadith.txt | tr -s '[\n]' '\n' |tr '-' '~'| sed 's/~~/ /g' | sed 's/~//g' | sed 's/+0000//g' |sed '/$/G'
and see if that helps.
***July 16, 2012 UPDATE****
here's a link to where you can simply download a geeklet that will do all the Geektool coding for you (right click-Save as):
Daily Hadith Geeklet
it's in my public dropbox folder though, so if it suddenly becomes unavailable, just let me know and I can put it back :)
19. Finally, save the command, resize the geeklet to fit, and you should now have a hadith on your desktop! :) It should look something like this:
If you're experiencing any difficulty with this, or something's not working. Let me know, I'll try and help. :)
I recently became interested in a Macintosh tool called Geektool. It's a delightful little program that runs in the background and puts one of 3 things on your desktop:
1) the output from a script (i.e it'll execute a small program and display the result)
2) text from a file
3) a picture from a folder
and using just these three things, people have come up with the most amazing desktops! Just take a look at these!
more available here: http://smokingapples.com/software/15-geektool-desktop-inspirations-for-the-weekend/
It's customizable and pretty straightforward, but most people have difficulty writing the script ones. In this article, I'll teach you how to turn a twitter feed into an rss feed and using some programming, display it on your desktop using Geektool :)
1. Download Geektool: http://itunes.apple.com/ca/app/geektool/id456877552?mt=12
2. Install it, it'll show up as a preference pane.
3. This is the twitter feed we'll be using as our source of hadiths:
http://twitter.com/#!/DailyHadith
unfortunately, none of the programs on your mac can just take the text, so we have to convert it to an RSS feed (a type of simplistic, list approach to getting information from websites) EVEN MORE UNFORTUNATELY, the option to do this from this Twitter feed has been removed, so we have to use another website. I've already done that for you so the RSS feed you'll need will be:
feed://api.twitter.com/1/statuses/user_timeline.rss?screen_name=dailyhadith
4. Make a folder on your desktop called "Geektool Desktops" and within that folder, make another one called "Common". (just do it, because that's where mine is and it makes everything easier. You can probably figure out what to change if you want to move your folder somewhere else :))
5. Now, we need to write a bit of code to automatically download the latest hadith, and save it to a text file! So, open "Automator" on your mac. If you go to the little magnifying glass in the very top corner of your screen and start typing "Automator" it'll show up. It looks like a little robot holding a tube.
6. Choose to make a new application
7. Find the "Get specified URLs" command and drag it to the workspace. Then edit it so it looks like this:
8. Below this, drag the "Get feeds from URLs"
9. Below that, drag the "Filter Articles" (we only want the most recent one). And set the options to "Any of the following are true", "Date Published" "Since Yesterday"
10. Drag "Get text from Articles" below the box made in step 9.
***UPDATE**** if you're running osX Lion, it's possible to stop the text from appearing twice. Beneath the "Get Text from Articles" add a "Filter Paragraphs"box. Under conditions set the following:
that is a "- ", there's a space after the dash. That should only save the text of the article, not the title. :)
11. Finally, drag "New Text File" beneath step 10's box, and set it as shown:
12. Finally, save the application as "Get Daily Hadith" (as an application too) inside the folder "Common" within the "Geektool Desktops" folder you created earlier, on your desktop.
13. You can run it if you like, to make sure it's working! Just double click it, or click the "run" button if you still have it open in automator. Now, you're going to have to get your hands a little dirty, because we need to stop this app from interrupting your work whenever we run it. So:
13a. right click on your "Get Daily Hadith" app
13b. select "show package contents"
13c. go into "contents"
13d. find "info.plist"
13e. right click, move to "open with" and choose "other"
13f. change "recommended applications" to "all applications" and find "textedit" in your application folder and use that to open the "info.plist" file
13g. scroll down to the bottom until you find these two lines
change that "false" to "true", but without the quotes:
go to the file menu, and select "save" and close all the finder windows to get out of there. What you've done is told the application to open in the background. You'll still be able to tell because your work may hiccup now and then, but at least it's not going to stop everything to load.
14. Now the Geektool code. I have to tell you though, that even the code I'm using isn't perfect. It's was adapted from the code I used to put my facebook feed on my desktop, and it has a tendency to put the hadith twice. Once for the title, and another for the content. This is because of how an RSS is set up, the title is usually a duplicate of the content. The workaround? Make the box small enough to only view one :P
Okay, open up the Geektool preference pane in system preferences and make a religion category. Drag yourself a "Shell"Geeklet to the desktop and a nice greyish square should appear, along with another preference pane that looks like this:
you can name it "get daily hadith" and add it to the "religion" group.
15. Set the font and color to whatever you want, and pick a big refresh rate, it IS called Daily hadith for a reason :P I set mine to about 14400 seconds. Do this all now, because frequently, once you tell it to open anything, it won't let you touch it again without freaking out and running it's command. It calms down after a while, I have no idea why, but still.
16. Now, click on the "..." next to command, and a window will open up. This geeklet will be used to run the app you just made to download the hadith!
In this newly opened window, you will copy and paste the following underlined text:
open /Users/username/Desktop/Geektool\ Desktops/Common/Get\ Daily\ Hadith.app
you have to type it this way, replacing "username" with whatever your username is. I'll tell you a hint though, a "/" means "subfolder" and a "\" means there's a space in the file/folder name. So this says:
open the folder "users" then the subfolder "username" then the subfolder "Desktop" then the subfolder "Geektool Desktops" then the subfolder "Common" then the application "Get Daily Hadith.app".
17. Drag another shell geeklet to the desktop, we'll use this one to display the hadith! Set your fonts and colors and groups and names and refresh rates before adding the code (this one's not so bad because it can execute from within Geektool).
18. In the command box, copy and paste this underlined text:
head -n 300 ~//Desktop/Geektool\ Desktops/Common/Daily\ hadith.txt | tr -s '[\n]' '\n' |tr '-' '~'| sed 's/~~/ /g' | sed 's/~//g' | sed 's/+0000//g' |grep '[a-zA-Z]'|sed '/$/G'
That was adapted from another geeklet I have that posts my facebook feed to my desktop, and was obtained from another site. Still, the principle is the same, you can see the address of the file, and the rest is just formatting stuff. Now, one issue I noticed is that this code removes anything in quotations. Which is kind of irritating since a lot of hadith's are quotes. I believe this is because of the grep '[a-zA-Z]' command there, but I'm not sure. If you find yourself with a hadith with missing quotes, try changing the command to this instead:
head -n 300 ~//Desktop/Geektool\ Desktops/Common/Daily\ hadith.txt | tr -s '[\n]' '\n' |tr '-' '~'| sed 's/~~/ /g' | sed 's/~//g' | sed 's/+0000//g' |sed '/$/G'
and see if that helps.
***July 16, 2012 UPDATE****
here's a link to where you can simply download a geeklet that will do all the Geektool coding for you (right click-Save as):
Daily Hadith Geeklet
it's in my public dropbox folder though, so if it suddenly becomes unavailable, just let me know and I can put it back :)
19. Finally, save the command, resize the geeklet to fit, and you should now have a hadith on your desktop! :) It should look something like this:
If you're experiencing any difficulty with this, or something's not working. Let me know, I'll try and help. :)