A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| def verify_sign(public_key_loc, signature, data): | |
| ''' | |
| Verifies with a public key from whom the data came that it was indeed | |
| signed by their private key | |
| param: public_key_loc Path to public key | |
| param: signature String signature to be verified | |
| return: Boolean. True if the signature is valid; False otherwise. | |
| ''' | |
| from Crypto.PublicKey import RSA | |
| from Crypto.Signature import PKCS1_v1_5 |
| connection cloudmqtt | |
| try_private false | |
| address broker.cloudmqtt.com:<port> | |
| start_type automatic | |
| username <your_username_here> | |
| password <your_password_here> | |
| clientid <any_clientid_here> | |
| notifications true |
| # RUN ME, I am the worker! | |
| # $ pip install fabric celery-with-redis | |
| # $ celery -A tasks worker -E --loglevel=debug | |
| from celery import Celery | |
| from time import sleep | |
| from fabric.api import env, run, execute | |
| import sys | |
| celery = Celery('tasks', broker='redis://', backend='redis://') |
| http://www.infoq.com/presentations/Simple-Made-Easy | |
| http://www.infoq.com/presentations/integration-tests-scam | |
| http://blog.thecodewhisperer.com/2010/09/14/when-is-it-safe-to-introduce-test-doubles | |
| http://youtu.be/yTkzNHF6rMs | |
| http://pyvideo.org/video/1670/boundaries | |
| http://skillsmatter.com/podcast/ajax-ria/enumerators | |
| http://alistair.cockburn.us/Hexagonal+architecture | |
| http://c2.com/cgi/wiki?PortsAndAdaptersArchitecture | |
| http://www.confreaks.com/videos/977-goruco2012-hexagonal-rails | |
| http://www.confreaks.com/videos/1255-rockymtnruby2012-to-mock-or-not-to-mock |
#How to install node.js and CouchDB on a Google Compute Engine instance
Make sure you have a Google Compute engine account, have a project created and the gcutil command line tool installed.
Since want to ssh without the gcutil tool, you need to a your ssh key to the instance in addition to the already existing google_compute_engine key (used for gcutil).
| #!/usr/bin/env ruby | |
| # This Rules file is an attempt at a near zero configuration for the common | |
| # use cases when creating a simple site with nanoc. It's meant to have | |
| # better defaults so new users don't have to configure it much if at all. | |
| # For the most part, it copies all files from the content folder to the | |
| # output folder with the same name. It has the following features: | |
| # | |
| # * Certain predefined page extensions such as html, haml, md, markdown and | |
| # textile are routed to "clean" URI's (see below regarding Item identifiers). |
| """ | |
| Utility functions for hex grids. | |
| """ | |
| from math import sqrt | |
| from heapq import heappush, heappop | |
| import numpy | |
| import numpy.random | |
| neighbours = numpy.array(((2, 0), (1, 1), (-1, 1), (-2, 0), (-1, -1), (1, -1))) |
| /** @jsx React.DOM */ | |
| var SVGComponent = React.createClass({ | |
| render: function() { | |
| return this.transferPropsTo( | |
| <svg>{this.props.children}</svg> | |
| ); | |
| } | |
| }); |