Skip to content

Instantly share code, notes, and snippets.

View dmendiza's full-sized avatar
🏠
Working from home

Douglas Mendizábal dmendiza

🏠
Working from home
  • Middletown, CT
View GitHub Profile
@dmendiza
dmendiza / .hgignore
Created May 27, 2011 23:36
Mercurial Ignore
#########################
# Mercurial Ignore File
#########################
# Global syntax patterns
syntax: glob
# directories
bin/
obj/
@dmendiza
dmendiza / gist:1128953
Created August 6, 2011 02:51
Pretty print code
<link rel="stylesheet" type="text/css" href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" />
<script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"></script>
<body onload="prettyPrint()">
@dmendiza
dmendiza / gist:6709874
Created September 26, 2013 04:30
Show the active python version in pyenv before every prompt
# Show the version inline
export PROMPT_COMMAND='echo -n [py:$(pyenv version-name)]'
# Show the version name in light blue on previous line
export PROMPT_COMMAND='echo -e "\033[0;36m[py:$(pyenv version-name)]\033[0m"'
@dmendiza
dmendiza / gist:8607196
Created January 24, 2014 21:42
python-barbicanclient authentication with Rackspace Identity
from barbicanclient.common import auth
from barbicanclient import client
# using username and password
rack_auth = auth.RackspaceAuthV2(auth_url='http://identity.rackspace...',
username='username',
password='password')
# alternatively you can use an api-key instead of a password
rack_auth = auth.RackspaceAuthV2(auth_url='http://identity.rackspace...',
from keystoneclient.v3 import client as keystone_client
from barbicanclient import client
keystone = keystone_client.Client(user_domain_name=DOMAIN_NAME,
username=USER,
password=PASS,
project_domain_name=PROJECT_DOMAIN_NAME,
project_name=PROJECT_NAME,
auth_url=KEYSTONE_URL)
def my_method_with_except():
try:
dangerous_method()
except Exception:
raise
def my_method_without_except():
dangerous_method()

Keybase proof

I hereby claim:

  • I am dmend on github.
  • I am redrobot (https://keybase.io/redrobot) on keybase.
  • I have a public key whose fingerprint is 245C 7B6F 70E9 D8F3 F5D5 0CC9 AD14 1F30 2D58 923C

To claim this, I am signing this object:

@dmendiza
dmendiza / 01_install.sh
Last active March 1, 2021 18:09
Django Unchained - PyTexas 2014
# Install Django
pip install django
docker build -t postgres postgresql/
docker build -t keystone keystone/
docker run -d --name postgres postgres
docker run -d -p 5000:5000 -p 35357:35357 --link postgres:db --name keystone keystone
sed -i "s/OS_SERVICE_ENDPOINT=.*/OS_SERVICE_ENDPOINT=\"http:\/\/localhost:35357\/v2.0\"/" barbican/scripts/keystone_data.sh
./barbican/scripts/keystone_data.sh
@dmendiza
dmendiza / 01.sh
Last active August 29, 2015 14:18
symmetric Use Cases
# Use Case 1:
# Generate and store a random symmetric key for use in AES-256-CBC encryption using POST+PUT
# User Format: A file containing random bytes.
# Transfer Format: None - File does not need to be encoded for transfer.
# Content-Type: application/octet-stream
# Note that the content-type (media-type? [1]) is used in the PUT as "Content-Type: application/octet-stream"
# and again when retrieving the file in the GET as "Accept: application/octet-stream"
# Expected Format from Barbican: Identical file with the same random bytes
# Create an encryption_key file with 256 bits of random data