Moved to my blog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def application(env, start_response): | |
start_response('200 OK', [('Content-Type', 'text/plain')]) | |
return 'Hello world, from Python!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Offline validation of oauth access_keys. | |
""" | |
import base64 | |
import string | |
import unittest | |
import urllib | |
import uuid | |
import zlib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BRANCH=${1:-master} | |
git checkout $BRANCH | |
git pull | |
git checkout $BRANCH~0 | |
find . -name "*.pyc" -delete | |
git log -n 1 | |
git status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keystoneclient | |
# auto-discover the identity endpoint given just a host name (this could use | |
# SRV DNS records to reach the identity service) | |
c = keystoneclient.Client('example.com') | |
# authentication plugins are instantiated seperately from the base client. | |
# password auth is part of the core Identity API, and should be supported | |
# directly by the client. | |
password_auth = keystoneclient.PasswordAuth( |
Create a provider: POST /v3/identity_providers
Create an attribute mapping: POST /v3/mappings
Add an attribute mapping to a provider protocol: PUT /v3/identity_providers/abc123/protocols/saml
{
"protocol": {
"id": "saml",
"mapping_id": "xyz234"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": { | |
"status": "stable", | |
"updated": "2013-03-06T00:00:00Z", | |
"media-types": [ | |
{ | |
"base": "application/json", | |
"type": "application/vnd.openstack.identity-v3+json" | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
import multiprocessing | |
def f(): | |
x = list() | |
for _ in xrange(1000000): | |
x.append(uuid.uuid4()) | |
while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Cached Identity API version discovery demo. | |
Running discover on an endpoint once results in an HTTP call: | |
$ python discover.py http://localhost:35357/ | |
GET http://localhost:35357/ | |
{2.0: u'http://localhost:35357/v2.0/', 3.0: u'http://localhost:35357/v3/'} | |
Running discover on an endpoint a second time hits the cache instead of HTTP: |