Discussed in http://superuser.com/questions/345447/how-can-i-trigger-a-notification-when-a-job-process-ends
command; command-after &| # Make sure you DELETE `/mongoindex` and `/_river/mongoindex` if they exist already | |
| # Create the index | |
| PUT /mongoindex | |
| # Create the mapping that defines your analyzers | |
| PUT /mongoindex/assets/_mapping | |
| { | |
| "assets": { | |
| "properties": { |
| import pymongo | |
| # Set up your database | |
| conn = pymongo.Connection() | |
| db = conn.eve | |
| coll = db.assets | |
| # Find every record that contains a content field | |
| change_list = list(coll.find({"content":{"$exists":True}})) |
Discussed in http://superuser.com/questions/345447/how-can-i-trigger-a-notification-when-a-job-process-ends
command; command-after &| # Same as before, with a kivy-based UI | |
| ''' | |
| Bluetooth/Pyjnius example | |
| ========================= | |
| This was used to send some bytes to an arduino via bluetooth. | |
| The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't | |
| tested without BLUETOOTH_ADMIN, maybe it works.) |
| # This sets the application to dockless | |
| defaults write /Applications/Adium.app/Contents/Info LSUIElement 1 | |
| # This signs the application with a certificate in your keychain | |
| codesign -f -s "Jen Montes" /Applications/Adium.app |
| $ curl -X POST -H "Content-Type: application/json" --data @task.json -H 'Content-Type: application/json' http://127.0.0.1:5000/api/tasks | |
| {"_updated": "15 Apr 2014 12:27:47", "_status": "OK", "_id": "534d25c3b3af65af6b51bb53", "_links": {"self": {"href": "/tasks/534d25c3b3af65af6b51bb53", "title": "task"}}, "_etag": "e7411dc170591300ecc66078b941ac371cfea1b2"} | |
| $ curl http://127.0.0.1:5000/api/tasks/534d25c3b3af65af6b51bb53 | |
| {"_updated": "15 Apr 2014 12:27:47", "name": "task", "author": "534d2371b3af65af6dcb5189", "_links": {"self": {"href": "/tasks/534d25c3b3af65af6b51bb53", "title": "task"}, "parent": {"href": "", "title": "home"}, "collection": {"href": "/tasks", "title": "tasks"}}, "_created": "15 Apr 2014 12:27:47", "_id": "534d25c3b3af65af6b51bb53", "type": "ai", "_etag": "38337469dab3827c4f71b8a51a570a21ffc51480"} |
| <html> | |
| <head> | |
| <title>ChangeLog</title> | |
| <style type="text/css"> | |
| code { | |
| display: block; | |
| padding: 1em 1em 1em 2em; | |
| background-color: #f8f8f8; | |
| border: 1px solid #f0f0f0; | |
| width: 50em; |
Except where otherwise noted, all original content on this site was created by Jen Montes and is dedicated to the public domain (CC0). All other marks, names, and copyrighted materials are property of their respective owners.
| class KeySchemaValidator(Validator): | |
| def _validate_keyschema(self, schema, field, dct): | |
| "Validate all keys of dictionary ``dct`` against schema ``schema``." | |
| for key, value in dct.items(): | |
| self._validate_schema(schema, key, value) | |
| api = Eve(API_NAME, validator=KeySchemaValidator) |