Popular recipes by Andrea Corbellini http://code.activestate.com/recipes/users/4186880/2015-01-29T17:12:10-08:00ActiveState Code RecipesRSA: a simple and easy-to-read implementation (Python)
2014-03-01T18:56:19-08:00Andrea Corbellinihttp://code.activestate.com/recipes/users/4186880/http://code.activestate.com/recipes/578838-rsa-a-simple-and-easy-to-read-implementation/
<p style="color: grey">
Python
recipe 578838
by <a href="/recipes/users/4186880/">Andrea Corbellini</a>
(<a href="/recipes/tags/encryption/">encryption</a>, <a href="/recipes/tags/learning/">learning</a>, <a href="/recipes/tags/rsa/">rsa</a>, <a href="/recipes/tags/security/">security</a>).
</p>
<p>This is a really simple RSA implementation. It does not want to be neither fast nor safe; it's aim is to provide a working and easy to read codebase for people interested in discovering the RSA algorithm.</p>
Urllib handler for Amazon S3 buckets (Python)
2014-11-06T18:31:44-08:00Andrea Corbellinihttp://code.activestate.com/recipes/users/4186880/http://code.activestate.com/recipes/578957-urllib-handler-for-amazon-s3-buckets/
<p style="color: grey">
Python
recipe 578957
by <a href="/recipes/users/4186880/">Andrea Corbellini</a>
(<a href="/recipes/tags/aws/">aws</a>, <a href="/recipes/tags/s3/">s3</a>, <a href="/recipes/tags/urllib/">urllib</a>).
</p>
<p>This is a handler for the standard <a href="https://docs.python.org/dev/library/urllib.request.html">urllib.request</a> module capable of opening buckets stored on <a href="http://aws.amazon.com/s3/">Amazon S3</a>.</p>
<p>Here is an usage example:</p>
<pre class="prettyprint"><code>>>> from urllib.request import build_opener
>>> opener = build_opener(S3Handler)
>>> response = opener.open('s3://bucket-name/key-name')
>>> response.read()
b'contents'
</code></pre>
Amazon SNS handler for the logging module (Python)
2014-11-06T17:32:26-08:00Andrea Corbellinihttp://code.activestate.com/recipes/users/4186880/http://code.activestate.com/recipes/578956-amazon-sns-handler-for-the-logging-module/
<p style="color: grey">
Python
recipe 578956
by <a href="/recipes/users/4186880/">Andrea Corbellini</a>
(<a href="/recipes/tags/aws/">aws</a>, <a href="/recipes/tags/logging/">logging</a>, <a href="/recipes/tags/sns/">sns</a>).
Revision 2.
</p>
<p>This is a handler for the standard <a href="https://docs.python.org/library/logging.html">logging</a> module that sends notifications to the <a href="http://aws.amazon.com/sns/">Amazon Simple Notification Service</a>.</p>
<p>You can use it like so:</p>
<pre class="prettyprint"><code>logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d '
'%(thread)d %(message)s',
},
'simple': {
'format': '%(levelname)s %(message)s',
},
},
'handlers': {
'sns': {
'level': 'INFO',
'class': 'SNSHandler',
'formatter': 'verbose',
'topic_arn': 'YOUR SNS TOPIC ARN',
},
},
'loggers': {
'YOUR MODULE': {
'handlers': ['sns'],
'level': 'INFO',
'propagate': True,
},
},
}
</code></pre>
Forward iterator (Python)
2015-01-29T17:12:10-08:00Andrea Corbellinihttp://code.activestate.com/recipes/users/4186880/http://code.activestate.com/recipes/578560-forward-iterator/
<p style="color: grey">
Python
recipe 578560
by <a href="/recipes/users/4186880/">Andrea Corbellini</a>
(<a href="/recipes/tags/iterator/">iterator</a>, <a href="/recipes/tags/wrapper/">wrapper</a>).
Revision 2.
</p>
<p>A proxy for iterators that lets you <em>read ahead</em> items without consuming the iterator.</p>