Monthly Archives: January 2009

Python: Grab Email from Gmail and Insert into MySql Database

This script will:

  • Log into Gmail Pop
  • Read the email
  • Delete the read email
  • Insert the email’s text into a MySql database
  • Sleep for 1800 seconds, and repeat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
try:
        import poplib, sys, time
        import string, random
        import StringIO, rfc822
        import datetime
        SERVER = "pop.gmail.com"
        USER  = "gmailusername"
        PASSWORD = "gmailpassword"
        i = 0;
        print """
        |------------------------------------------|
        |  This is a python program that checks a  |
        |  POP account and if there is a message,  |
        |  it adds it to the SQL server.           |
        |------------------------------------------|
                  by: Daniel Folkes
                         email: danfolkes@gmail.com
 
        (every 180 seconds)
        Checking POP server....
"""
        while 1:
                try:
                        server = poplib.POP3_SSL(SERVER, 995)
                        server.user(USER)
                        server.pass_(PASSWORD)
                except:
                        print "error setting up server."
 
 
                resp, items, octets = server.list()
                # download a random message
                try:
                        id, size = string.split(items[0])
                        resp, text, octets = server.retr(id)
 
                        text = string.join(text, "\n")
                        file = StringIO.StringIO(text)
                        note = ""
                        name = ""
                        message = rfc822.Message(file)
                        for k, v in message.items():
                                if k=='from':
                                                name = v[:12]
                        note = message.fp.read()[:50]
                        print "note: ", note
                        server.dele(1) #this will delete the message after you read it
                        server.quit()
                #-------------------------------------------
                        if note !="":
                                import MySQLdb
                                db = MySQLdb.connect(host="localhost", user="USERNAME", passwd="PASSWORD",db="DATABASENAME")
 
                                cur2 = db.cursor()
                                if name:
                                        cur2.execute("INSERT INTO note (note, name) VALUES (%s, %s)", (note, name))
                                else:
                                        cur2.execute("INSERT INTO note (note) VALUES (%s)", (note))
                except:
                        i+=1
                        #print "Unexpected error:", sys.exc_info()[0]
                        time.sleep(1800)
except:
        print "Failed Unexpectedly"

Darkness is Spreading – Backstory – Game – How to Play

BACK STORY

In the year 2920, the Golden Age of Psionics is unlocking worlds of
possibilities for humankind. The psionically gifted are recruited at
a young age to participate in the Planetary Defense Force’s psi-ops
program, where their talents are honed through
cybernetically-interactive mind games. These games can reprogram the
trainees’ subconscious minds for optimal psionic output, all in
parallel with the conscious effort toward solving the puzzle.

DARKNESS IS SPREADING
Continue reading

CoreLaborate – Document Elaboration on the Core Formats

Document Elaboration on the Core Formats

Document Elaboration on the Core Formats

A site I created so that collaborating on Photoshop, Illustrator, GIMP, SVG files would be easier. All of those binary formats that are complicated to share and elaborate on.

I hope this is helpful to many people. Especially in the Open Source world.

Supports: PSD,AI,PDF,XCF,SVG.

Thanks,
Daniel Folkes

Third Eye Blind – Jumper – Chords Lyrics – Best – Notas

This is a hybrid of:
http://www.fretplay.com/tabs/t/third_eye_blind/jumper-crd.shtml
http://www.ultimate-guitar.com/tabs/t/third_eye_blind/jumper_ver2_crd.htm

Hope you enjoy.

E A D G B E
Fmaj7 – X 3 3 2 1 0
C – X 3 2 0 1 0
G – 3 2 0 0 3 3
Am - X 0 2 2 1 0
D9sus2 - X 5 4 0 3 0

Continue reading

DiS – Darkness is Spreading Version 08.1218

A new version of DiS – Darkness is Spreading Version is out. Version 08.1218

I have added a whole host of features. I wish I had a list, but I don’t!

Here’s a picture:

DiS - Darkness is Spreading Version 08.1218

DiS - Darkness is Spreading Version 08.1218

Here is the page on sourceforge:
http://dis-game.sourceforge.net/

Here is the Play page on sourceforge:
http://dis-game.sourceforge.net/play.php