Morten's Blog


The random output of Morten André Steinsland

Highscore module for Python using SQLite

Posted by Morten André on November 1, 2009 at 10:01. In the Python, Tutorials category.
Tags : , , , , ,

This is a simple Python module that stores highscores in an SQLite database in the same folder as the module. It’s far from watertight so tweak it according to your needs. Read source for examples.

(Read More..)

Spammer-Scammer, random e-mail generator with Python.

Posted by Morten André on May 26, 2009 at 00:23. In the Funny Stuff, Python category.
Tags : , , , ,
Spam in a can

Spam in a can

Lately I’ve received a number of messages from bots using other people’s hacked MSN accounts. The link they were pushing was basically an email confirmation link, clicking it would have told them that my e-mail address was valid, and surely landed me in some spammer’s e-mail lists. So instead i decided to try and mess around a little, and thus this little Python program was written.

It generates random fake e-mails, from three text lists, and sends them to the spammer using their own validator link, trough the Tor proxy network; making it harder to block  or locate you.

Download it here . Use it at your own risk or don’t use it at all, read the disclaimer in the source. Feel free to do whatever the heck you want with it, just don’t come back crying if you make a booboo.

(Read More..)

Getting started with Python and Eclipse on Windows

Posted by Morten André on December 9, 2008 at 02:45. In the Tutorials category.
Tags : , , ,

Eclipse is an Open Source IDE mainly used for Java development; but with the Pydev plug-in installed it becomes a powerful Python IDE. I will now show you how to get Eclipse ready for your Python code.

1. Installing Python

Before we get started, you should check whether or not Python is already installed on your computer. Look for a folder called Python25 or something similar on your C:\ partition, also check the Add/Remove Programs list in the Windows Control Panel for any Python entries.

If Python is not installed, let’s go to www.python.org and download a copy. There are newer versions, but we’ll download Python 2.5.2 to get compatibility with many extensions. You may want to download a newer release if your not too concerned about that.

Execute the Python installer you downloaded, and follow the instructions. The default installation path is “C:\Python25“. And unless that causes problems, leave it as it is.

2. Installing Java

Eclipse requires Java. So unless it’s already installed on your system, you need to get it from www.java.com, and install it before you continue.

3. Installing Eclipse

Let’s install the Eclipse IDE. Head over to www.eclipse.org and look for Eclipse Classic which will be the release we’ll download and use.

At the time of writing, Eclipse for Windows is released as a zip archive. You’ll need to extract the folder inside the zip archive, called “eclipse“. I recommend clicking on the archive to open it, and just drag the folder to a proper destination on your computer, such as the “C:\Program Files” folder. (Read More..)

Time lapse video with Python

Posted by Morten André on November 7, 2008 at 01:35. In the Music, Video & TV, Python category.
Tags : , , , , ,

This is a time lapse video i made using my digital videocamera and Python, taking a picture every 5th second. It is quite boring so i had to add some music, Rob Costlow’s “Not Alone”

This is the Python script i used:

from VideoCapture import Device
from time import sleep

SecondsBetweenFrames = 5
FilePrefix = "bilde_"
DirectoryToStore = "E:\\Basen\\"
Kamera = Device()
FrameNr = 0

while True:
    FrameNr = FrameNr + 1
    Kamera.saveSnapshot(DirectoryToStore + FilePrefix + str(FrameNr) + '.jpg')
    print "Lagret bilde: " + FilePrefix + str(FrameNr) + '.jpg'
    sleep(SecondsBetweenFrames)

* You’ll need the VideoCapture and PIL Python extensions

PHP not working on your virtual host?

Posted by Morten André on September 9, 2006 at 19:49. In the Tutorials category.
Tags : , , , ,

I was having problems getting php scripts to parse on some virtual hosts i set up on my Apache server. When i entered the address to the script in my browser, all i got was the sour message; “No input file specified“.

I searched long and hard on google for a solution, and finally found one after tedious reading of forums and articles. Now, im not really sure if this is the best way to solve this problem, or even the safest way. But it worked for me.

All i had to do was comment out the DOC_ROOT line in my PHP.INI file.

I haven’t encountered any bad side effects yet, but i take no responsibility for the safety of your server(s) if you decide to apply this solution.

Good luck :)

Powered by WordPress
Theme by Morten Andrè Steinsland
61 queries. 0.152 seconds.