Skip to content

Instantly share code, notes, and snippets.

View antiface's full-sized avatar

A.G. antiface

View GitHub Profile
@scripting
scripting / gist:24a97569e8103799d942
Created September 19, 2014 12:50
An example of the metadata Twitter keeps about an individual tweet.
{
"created_at": "Fri Sep 19 12:20:23 +0000 2014",
"id": 512939257850511360,
"id_str": "512939257850511360",
"text": "\"I never used the Blackberry again.\" https://t.co/CYsbbBDtOh",
"source": "<a href=\"http://radio3.io/\" rel=\"nofollow\">radio3.io</a>",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
{
"created_at": "Fri Sep 19 12:20:23 +0000 2014",
"id": 512939257850511360,
"id_str": "512939257850511360",
"text": "\"I never used the Blackberry again.\" https://t.co/CYsbbBDtOh",
"source": "<a href=\"http://radio3.io/\" rel=\"nofollow\">radio3.io</a>",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
@antiface
antiface / pets.py
Last active August 29, 2015 14:06 — forked from jhamrick/pets.py
class Pet(object):
def __init__(self, name, species):
self.name = name
self.species = species
def getName(self):
return self.name
def getSpecies(self):
@jcsalterego
jcsalterego / hashtag_wordle.py
Created January 28, 2009 13:07
Script to generate word list from search results
#!/usr/bin/env python
#
# Generates non-unique word list from Twitter Search meeting certain
# criteria (as set in the configuration, below).
#
# EXAMPLE (word wrap inserted for ease of reading):
#
# $ python hashtag_wordle.py
# Fetching http://search.twitter.com/search.json?q=%23spinuzzi-project&rpp=30&page=1...
# Fetching http://search.twitter.com/search.json?q=%23spinuzzi-project&rpp=30&page=2...
http://search.twitter.com/search.json?q=%40human_bot
{
"results": [{
"text": "@human_bot Are you feeling okay? Sounds like you've been smoking some crack with the way you've been talking lately.",
"to_user_id": 5740619,
"to_user": "human_bot",
"from_user": "taboularasa",
"id": 1306533155,
"""
walk through related tags on twitter.
start it with something like python twitterwalk.py sxsw
"""
import sys, re
from twitter import Twitter
if len(sys.argv) > 1:
# print a user's tweets
import simplejson
import re
import urllib2
import string
me = urllib2.urlopen('http://twitter.com/statuses/user_timeline/peteskomoroch.json?count=200')
for tweet in simplejson.loads(me.read()):
print tweet['text'].encode('utf-8')
# poll a search term every 60 seconds and print tweets out
import time
import simplejson
import re
import urllib2
import urllib
last_id = False
while True:
import gaerun
from google.appengine.ext import db
from google.appengine.api import urlfetch
from google.appengine.api import memcache
import simplejson
import logging
class User(db.Model):
name = db.StringProperty()
import nltk
import random
class Categorizer(object):
def __init__(self, categories):
self.categories = categories
def prep_seed(self, content):
"""Convert seed content into nltk.Text"""
raw = nltk.clean_html(content)