Skip to content

Instantly share code, notes, and snippets.

@AnyMaster
AnyMaster / tornado_on_twisted.py
Created November 29, 2015 10:14 — forked from FZambia/tornado_on_twisted.py
Tornado simple application running on Twisted. Some simple handlers to test using Twisted Deferred, InlineCallbaks, deferToThread, callLater functionality.
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@AnyMaster
AnyMaster / rsabd.py
Last active November 6, 2023 17:42 — forked from aexaey/rsabd.py
#!/usr/bin/env python
"""
sudo apt-get install python-gmpy python-m2crypto python-crypto python-dev
sudo pip install pycurve25519
./rsabd.py >poc.key
openssl req -new -key poc.key -out poc.csr
openssl x509 -req -days 365 -in poc.csr -signkey poc.key -out poc.crt
./rsabd.py '' poc.crt
"""
@AnyMaster
AnyMaster / rsabd.py
Last active August 29, 2015 14:21 — forked from ryancdotorg/rsabd.py
#!/usr/bin/env python
import sys
import gmpy
import curve25519
from struct import pack
from hashlib import sha256
from binascii import hexlify, unhexlify

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: