Install ImageMagick for image conversion:
brew install imagemagick
Install tesseract for OCR:
brew install tesseract --all-languages
Or install without --all-languages
and install them manually as needed.
#!/usr/bin/python | |
# Raja Selvaraj <rajajs at gmail> | |
""" | |
Demonstrate use of pymongo to connect to a mongodb database on a hosted server, | |
specifically mongolab | |
""" | |
# Use a database already created on mongolab |
Install ImageMagick for image conversion:
brew install imagemagick
Install tesseract for OCR:
brew install tesseract --all-languages
Or install without --all-languages
and install them manually as needed.
{ | |
"AL": "Alabama", | |
"AK": "Alaska", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or | |
distribute this software, either in source code form or as a compiled | |
binary, for any purpose, commercial or non-commercial, and by any | |
means. | |
In jurisdictions that recognize copyright laws, the author or authors | |
of this software dedicate any and all copyright interest in the | |
software to the public domain. We make this dedication for the benefit |
This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:
*nix
based command prompt (but not the default Windows Command Prompt!)cd ~/.ssh
. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\
on Windows).ssh
folder, there should be these two files: id_rsa
and id_rsa.pub
. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls
to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa
and id_rsa.pub
in order for Git, GitHub, and BitBucket to recognize them by default.ssh-keygen -t rsa -C "[email protected]"
. Thlicense: apache-2.0 |
This is a very simple node-based client demonstrating how you can use the Twitter streaming API with the locations parameter specified. It uses geojson.io to map any tweets it hears within a user-specified duration.
Before running the map.coffee
script, place your app's OAuth keys in keys.json
and run npm install
to install dependencies (viz., ntwitter
and opener
).
>>> from pymongo import MongoClient | |
>>> import datetime | |
post = {"author": "Mike","text": "My first blog post!","tags": ["mongodb", "python", "pymongo"], "date": datetime.datetime.utcnow()} | |
>>> uri = "mongodb://pyladies:[email protected]:27167/series4ladies" | |
>>> client = MongoClient(uri) | |
>>> client | |
MongoClient('dbh16.mongolab.com', 27167) | |
>>> client.series4ladies | |
Database(MongoClient('dbh16.mongolab.com', 27167), u'series4ladies') | |
>>> db = client.series4ladies |
I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)
from datetime import datetime | |
import string | |
from nltk.stem.lancaster import LancasterStemmer | |
from nltk.corpus import stopwords | |
#Gets the tweet time. | |
def get_time(tweet): | |
return datetime.strptime(tweet['created_at'], "%a %b %d %H:%M:%S +0000 %Y") |