This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import urllib | |
>>> import simplejson | |
>>> url = urllib.urlopen('http://search.twitter.com/search.json?q=j2labs&rpp=1') # limit search to just 1 tweet | |
>>> json = url.read() | |
>>> usable_data = simplejson.loads(json) | |
>>> usable_data | |
{'next_page': '?page=2&max_id=6038882667&rpp=1&q=j2labs', 'completed_in': 0.039456999999999999, 'refresh_url': '?since_id=6038882667&q=j2labs', 'results': [{'iso_language_code': 'en', 'text': "Marc and Adam Allen's new band, Helen Earth Band, have released their new cd!! http://bit.ly/91HpIq :: Please RT #helenearthband", 'created_at': 'Wed, 25 Nov 2009 03:16:18 +0000', 'profile_image_url': 'http://a1.twimg.com/profile_images/435479248/Picture_1_normal.png', 'source': '<a href="http://twitter.com/">web</a>', 'from_user': 'j2labs', 'from_user_id': 54476112, 'to_user_id': None, 'geo': None, 'id': 6038882667L}], 'since_id': 0, 'results_per_page': 1, 'query': 'j2labs', 'max_id': 6038882667L, 'page': 1} | |
>>> usable_data['results'][0]['text'] | |
"Marc and Adam Allen's ne |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# query server for hit count | |
query_mt('get_hit_count', server_key, secret_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# query server for hit count | |
query_mt('get_hit_count', server_key, secret_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import uuid | |
from boto.mturk.connection import MTurkConnection | |
from boto.mturk.question import Question, QuestionForm | |
from boto.mturk.question import QuestionContent, ExternalQuestion | |
from boto.mturk.question import AnswerSpecification, FreeTextAnswer | |
from boto.mturk.question import SelectionAnswer | |
from boto.mturk.question import Overview | |
from boto.mturk.qualification import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from arabic_rtlize.process import rtlize | |
from PIL import Image, ImageFont, ImageDraw | |
real_urdu = "اس صفحہ کو ترامیم کیلیۓ نـیـم محفوظ کر دیا گیا ہے اور صارف کو اندراج کر کے داخل نوشتہ ہونا لازم ہے۔" | |
urdu = rtlize(unicode(real_urdu, 'UTF-8')) | |
img = Image.new("L", (1000,200)) | |
draw = ImageDraw.Draw(img) | |
f = ImageFont.truetype('/Users/jd/Desktop/urduimg/geeza.ttf', 20) | |
draw.text((10,40), urdu, fill=255, font=f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo "اس صفحہ کو ترامیم کیلیۓ نـیـم محفوظ کر دیا گیا ہے اور صارف کو اندراج کر کے داخل نوشتہ ہونا لازم ہے۔" \ | |
> | convert label:@- ~/Desktop/imagemagick.gif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port install git-core sqlite3 virtualenv virtualenvwrapper libyaml py26-pil | |
mkdir ~/.virtualenv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export WORKON_HOME=$HOME/.virtualenvs | |
source /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/virtualenvwrapper_bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python | |
>>> import nltk | |
>>> import nltk.download('all') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd wt-app | |
./manage.py syncdb | |
./manage.py runserver |