Skip to content

Instantly share code, notes, and snippets.

@dolph
dolph / requires.py
Last active August 29, 2015 13:59
Optional import required at runtime
oauthlib = None
try:
import oauthlib
except ImportError:
pass
class requires(object):
def __init__(self, f, *requirements):
@dolph
dolph / clean_po.py
Last active August 29, 2015 13:57
De-duplicate transifex *.po files.
"""
Adapted from https://bugs.launchpad.net/ironic/+bug/1298645/comments/2
"""
import argparse
import os
import shutil
import tempfile
def patch_po_files(input_dir_name):
@dolph
dolph / client_lessons.md
Created March 6, 2014 00:05
Lessons learned from building OpenStack clients.

Every time the client tries to guess something, it gets it wrong.

  • guessing whether the user passed in an ID or a name (not all IDs are UUIDs, as in the case of LDAP and legacy deployments)
  • guessing intended scope in auth request (domain_id + project_id + trust_id)
def _get_user(self, external_id):
domain_id, internal_id = self.id_mapping_api.get_mapping(external_id)
return self.identity_api[domain_id].get_user(internal_id)
@dolph
dolph / keystone-fundamentals.md
Last active August 29, 2015 13:56
Long term fundamentals
  • federation
  • hierchical multitenancy
  • attribute based access controls
  • decentralized attribute based access controls
  • delegation
  • token revocation events
@dolph
dolph / top-movies.md
Last active January 4, 2016 12:59
Top movies from 2009 through 2013
  1. Monsters, Inc.
  2. Up
  3. Marvel's The Avengers
  4. The Dark Knight Rises
  5. Star Trek
  6. District 9
  7. Avatar
  8. Harry Potter and the Half-Blood Prince
  9. Toy Story 3
  10. Inglourious Basterds
@dolph
dolph / beer-chemistry.md
Last active October 13, 2022 13:23
OU CHEM 4970: Chemistry of Beer

CHEM 4970: Chemistry of Beer

Overview of Brewing

  • Critical ingredients for alcohol include sugar and wild yeast
  • Beer is carbonated, unlike other alcoholic beverages

History

schema = {
"type": "object",
"properties": {
"rules": {
"type": "array",
"minItems": 1,
"items": {
"type": "object"
"properties": {
"local": {
@dolph
dolph / gist:8446375
Last active January 3, 2016 09:59 — forked from dstanek/gist:8446190
{
"rules": [
{
"local": [
{
"user": {
"name": "$0 $1",
"email": "$2"
}
}

Havana's ExternalDefault handler was renamed to Default and then to DefaultDomain Icehouse. Havana's ExternalDomain handler was renamed to Domain and then to LegacyDomain in Icehouse and deprecated completely due its unintentionally broken behavior. LegacyDomain is superceded by Domain in Icehouse, which implements a different behavior, but serves the same use case as Havana's ExternalDomain.