Planetplanet is a rss feed aggregator hacked in python.It’s extremely popular and we use it both internally and also on our GLUG site .
And the saddest thing ,it doesn’t have an installer yet :( and its a pain setting it up again and again .I have scribbled down a simple installer which *works* provided you obey all the rules it asks to :P .
here is the script
#!/usr/bin/env python
''' This script can be used to install planetplanet ,the python based RSS feed aggregator .
Author: S.Theyagarajan
Email: theyaga@gmail.com
URL : http://theyagar.info
Download URL: http://theyagar.info/code/planet-installer.txt '''
" Example Usage : ./installer-planet.py -p /home/codelabs/planet-2.0 -t fancy -o /home/codelabs/www/ -n Planet -a GLUG -e glugt@glugt.org "
from optparse import OptionParser
from commands import *
import commands
import optparse ,sys,os
usage = "Usage:\n %prog --p Planet_directory -t theme_name -o output_directory -n planet_name -a Admin_name -e Admin_email "
print usage
parser = OptionParser (usage)
parser.add_option ("-p", "--pdir", dest="pdirname")
parser.add_option ("-t", "--theme", dest="theme")
parser.add_option ("-o", "--outdir", dest="outdir")
parser.add_option ("-n", "--planetname", dest="pname")
parser.add_option ("-a", "--admin", dest="admin")
parser.add_option ("-e", "--email", dest="adminemail")
parser.add_option ("-l", "--link", dest="link")
(options, args) = parser.parse_args ()
if options.pdirname == None:
print "PlanetPlanet directory cannot be empty "
else:
pdirname=options.pdirname
print pdirname
theme=options.theme
print theme
outdir=options.outdir
print outdir
pname=options.pname
print pname
print "Planet Name is "+pname
admin=options.admin
print "Admin Name is"+ admin
adminemail=options.adminemail
print "Admin email is"+ adminemail
link=options.link
cmd= "cp -r "+ pdirname +"/examples/"+ theme +"/"+" "+ outdir
print cmd
cache_cmd= "cp -r "+ pdirname + "/examples/" + "cache" + "/" + " " + outdir
print cache_cmd
static_cmd= "cp -r "+ pdirname + "/examples/" + theme + "/*" + " " + outdir
print static_cmd
xml_cmd= "cp -r " + pdirname + "/examples/*.tmpl" + " " + outdir
print xml_cmd
rest_cmd= "cp -r " + pdirname + "/planet*" + " " + outdir
print rest_cmd
output=commands.getoutput(cmd)
output=commands.getoutput(cache_cmd)
output=commands.getoutput(xml_cmd)
output=commands.getoutput(rest_cmd)
import ConfigParser
cf=outdir + theme + "/config.ini"
print cf
config=ConfigParser.ConfigParser()
fp=file(cf,'rw')
config.readfp(fp)
print config.sections()
config.set('Planet','name',pname)
config.set('Planet','owner_name',admin)
config.set('Planet','owner_email',adminemail)
config.set('Planet','link',link)
config.set('Planet','days_per_page','100')
config.set('Planet','template_files',outdir + "" + theme + "/" + "index.html.tmpl" + " " + outdir + "atom.xml.tmpl" + " " + outdir + "foafroll.xml.tmpl" + " " + outdir + "opml.xml.tmpl" + " " + outdir+"rss20.xml.tmpl" + " " + outdir + "rss10.xml.tmpl" )
config.set('Planet','cache_directory',outdir + "/cache")
config.set('Planet','output_dir',outdir)
#config.remove_section('examples/fancy/index.html.tmpl')
config.add_section(outdir + "/" + theme + "/index.html.tmpl")
#config.set(outdir + theme + "/index.html.tmpl",'days_per_page','7')
fp.close()
fp=open(cf,'w')
config.write(fp)
fp.close()
cmd=" python " + outdir + "planet.py" + " " +outdir+theme+ "config.ini"
print cmd
output=commands.getstatusoutput(cmd)
And how do you use it ?
./installer-planet.py -p /home/codelabs/planet-2.0 -t fancy -o /home/codelabs/www/ -n Planet -a GLUG -e glugt@glugt.org
and you can also have the python file here http://theyagar.info/code/installer-python.txt
And what did i learn ? .
ConfigParser module.Its lovely ,makes it lot easier to edit the config files like the ones you find in httpd.conf so customization is just a program away no matter how many machines and time :-)
Go Python !!
[tags]planetplanet,python,hacks[/tags]
Ruby is fast becoming a popular language and ruby on rails is already the default choice for web2.0 apps .one such very popular example is twitter .
Hacketyget is a very simple and easy to use tool for those wanting to learn ruby the easy way and their slogan ” A blog in 6 lines ” is true
The above picture is how your minimal blog interface looks like :-)
and the code is even simpler
1:
2: blog = Table('MyBlog').recent(10)
3: Web.popup do
4: title("Add a blog entry")
5: editline("Title")
6: editbox()
7: buttons("cancel", "save")
8: puts blog
9: end
i would suggest people wanting to learn ruby this tool ,its easy and gets you all the basics you need from a language
download this tool from here
and for the one’s wanting to try it in linux
here it is
1: sudo apt-get install libwxgtk2.8-0
2: tar -zxvf hacketyhack*
3: cd hacketyhack-0.L LD_LIBRARY_PATH=/usr/lib/firefox:. ./hacketyhack
Technorati Tags: ruby, hacking
i was looking at the release of ubuntu studio and i was impressed by their new gdm theme,wallpaper,icon set and boot splash but installing the whole distro was of no use to me and so installed just the themes and i love this new look .
Boot splash

GDM theme

and now how to get them
From your terminal run the following two commands
sudo su -c 'echo deb http://archive.ubuntustudio.org/ubuntustudio feisty main >> /etc/apt/sources.list’
wget -q http://archive.ubuntustudio.org/ubuntustudio.gpg -O- | sudo apt-key add - && sudo apt-get update
and then
sudo apt-get install ubuntustudio-theme ubuntustudio-icontheme ubuntustudio-icon ubuntustudio-wallpaper ubuntustudio-artwork
and then to set the boot splash screen ,this command should work
sudo update-alternatives --config usplash-artwork.so
This will display all the available boot splash themes on your system and choose the studio one .
and to set the gdm theme , exec
choose the studio theme ,similarly for icon and theme
sudo gdmsetup
and choose
sudo gnome-theme-manager
Enjoy the new look :)
[tags] ubuntu,ubuntustudio,linux[/tags]
How many of you think having a nice wallpaper is cool ? well with firefox being the most used browser then how about a background image for firefox everytime you have an empty tab open .
here is how you achieve it . First decide on a picture
1 . Change to firefox directory
cd .mozilla
2.change to firefox and the default user profile directory
cd firefox/*.Default\ User\chrome
3. copy the file name UserContent-example.css and rename to userContent.css
and insert the following code there
@-moz-document url(about:blank) {
html {
background: url("URL_OF_THE_IMAGE") no-repeat center center fixed black !important;
}
}
and restart the browser, and open up about:blank and you will see the background
[tags]firefox,hacks[/tags]
xmpppy is a wonderful little package to make Google chat bots or in general any jabber chat bot .Remember the conference bot posted earlier ?
lets see how we can actually login to our GTalk and send messages to our friends through xmpppy
first install xmpppy from its homepage.
python >> from xmpp inport *
>>c=Client('gmail.com')
>>c.connect(server=('talk.google.com',5223))
>>c.auth('yourusernamewithout"@gmail.com"','yourpassword')
>>c.send(Message('theyaga@gmail.com','Test message'))
quite simple isnt it ? .Iam working on making a simple conference bot and its not far from being finished :)
[tags]xmppy,google[/tags]




