Skip to content

Instantly share code, notes, and snippets.

@blw9u2012
blw9u2012 / threadworms
Created September 10, 2014 03:40
I modified a scraper to leverage the Thread class in the threading module via passing each thread a target function to run. This gist is to illustrate another way of leveraging threads by subclassing the Thread class. Taken from here: http://inventwithpython.com/blog/2013/04/22/multithreaded-python-tutorial-with-threadworms/
# Threadworms (a Python/Pygame threading demonstration)
# By Al Sweigart al@inventwithpython.com
# http://inventwithpython.com/blog
# Released under a "Simplified BSD" license
# This is meant to be an educational example of multithreaded programming,
# so I get kind of verbose in the comments.
import random
import pygame
@blw9u2012
blw9u2012 / python_reddit
Last active August 29, 2015 14:04
Just a simple Python script showing how easy it is to use feedparser
import feedparser
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import smtplib
import re
def getFeeds(rssfeed, regex=None):
feed_dict = {}
for feed in rssfeed.entries: