Skip to content

Instantly share code, notes, and snippets.

View spapas's full-sized avatar

Serafeim Papastefanos spapas

View GitHub Profile
@spapas
spapas / get_attachments.py
Created December 22, 2014 18:37
Extract attachments from text mail messages
import email
import sys
if __name__=='__main__':
if len(sys.argv)<2:
print "Please enter a file to extract attachments from"
sys.exit(1)
msg = email.message_from_file(open(sys.argv[1]))
for pl in msg.get_payload():
@spapas
spapas / gist:6305393
Created August 22, 2013 10:02
Sample django models
class Category(models.Model):
name = models.CharField()
class Attribute(models.Model):
category = models.ForeignKey(Category)
name = models.CharField
class Item(models.Model):
slug = models.SlugField()
price = models.DecimalField()