Archive for January, 2008 Syntax Highlight Without Plugins

As you can maybe see from my previous post, I’ve got my syntax highlighted. There is no plugin working its magic behind it, infact, since I’m not hosting this blog myself, I can’t use plugins at all. Nevertheless, one solution for highlighting syntax is to ‘wrap’ it with html, which works with the wordpress posts. I found out that with gVim you can Syntax->Convert to HTML. With gVim you need to use the “:TOhtml” user command. All you need to do is copy the output into you post. You might want to make the font size something like 3 by adding size=”3″ into <font face=”monospace”> which is in the beginning of the output – <font face=”monospace” size=”3″>. If you know some other/better way to do this please comment. Hope this helps 😀

Python: Random IP

I’m not very experienced with python, but I occasionally program with some help from a friend. This script generates random ip addresses and tries to connect to them, displaying the addresses that work:

import socket
from random import randint

def randip():
    while True:
        yield ".".join(str(randint(1, 255)) for i in range(4))

a = []
for address in randip():
                s = socket.socket()
                s.connect((address, 80))
                print address, "WORKS!!!"
        except socket.error:
                if len(a) != 5:
                        print a
                        raw_input("press enter")

Importing Old WordPress Posts

I managed to import my first wordpress posts from the backup that I had saved in Gmail. Finding a way to retrieve the posts from the backup took a few hours, since I couldn’t find any help online. My backup consisted of the whole wordpress folder and the mysql tables. I copied all the sql entries to mysql and then changed the wp_config file a little. However, getting the posts through the old wordpress folder (http://localhost/wordpress) didn’t work because I had earlier redirected my url to For a long time I tried to look for a way to disable the redirrect, but then gave up. So here is the method I came up with:

1 from your old sql backup import wp_posts
2 download a fresh copy of wordpress and extract it to your www directory
3 install wordpress as usual, remember to make a sql database and edit wp_config
4 once you are done remove wp_posts from the new database you have just created
5 after the table has been removed import the old wp_posts table
6 now when you navigate to http://localhost/wordpress login and go to the manage tab in the dashboard
7 click on the export tab and then on download export file

Now you should have the XML file on your computer, which you can import with your other wordpress blog. The dates of when the posts were written should be included.

Pidgin and XP

Pidgin is a nice msn+yahoo+icq+aim+etc chat client. A good thing about Pidgin is that it runs on Windows and UNIX machines. I had only used GAIM with Debian, but a friend had recommended Pidgin. Now as I’m currently using TinyXp most of the time, I decided to get Pidgin for Windows. To be honest it’s very nice and simple. Best of all there are no annoying news pop-ups like in Messenger. I would recommend it to anyone for both UNIX and Windows systems.


The other day I tried the TinyXp Beast edition, a cut-down version of the normal Windows XP. The instalation took around 320mb whereas the normal XP is more or less triple that, furthermore TinyXp Beast only requires about 40mb memory (fresh install)! I don’t really have anything bad to say about it, but I wouldn’t recommend it people who don’t feel like experimenting a little since in the beginning you can run into some minor obstacles. For example me and my friends where having a lan party and wanted to play Starcraft but one of the network protocols was missing, so bits and pieces had to be downloaded and copied into windows directories. However everything has a fix. If you want to try TinyXp you should look for torrents (look in Piratebay), there’s a few different versions to choose from. You can read more about the details along with every torrent.