Skip to content

Instantly share code, notes, and snippets.

@dstanek
dstanek / gist:1773749
Created February 8, 2012 20:56
My git woes
localbox:~% ssh my-linode-account "git init --bare /tmp/myrepo.git"
dstanek@my-linode-account's password:
Initialized empty Git repository in /tmp/myrepo.git/
localbox:Projects/my_awesome_project% git push ssh://my-linode-account/tmp/myrepo.git master
dstanek@my-linode-account's password:
Counting objects: 162, done.
Compressing objects: 100% (161/161), done.
Writing objects: 100% (162/162), 39.62 KiB, done.
Total 162 (delta 78), reused 0 (delta 0)
To ssh://my-linode-account/tmp/myrepo.git
@dstanek
dstanek / test_quick.py
Created September 28, 2012 21:04 — forked from moschlar/test_quick.py
Badass speedup of simple tg site tests
# -*- coding: utf-8 -*-
"""
This test module will run setUp and tearDown only *once* for all test cases in this module.
This is very convenient for users who want to just test multiple urls whether they are reachable and respond with the correct http response code.
"""
import logging
log = logging.getLogger(__name__)
from os import path
@dstanek
dstanek / gist:4381225
Last active December 10, 2015 04:28 — forked from anonymous/gist:4381219
from myapp.forms import MyForm
def my_view(request):
form = MyForm(request.POST or None)
if form.is_valid():
name = form.cleaned_data['name']
email = form.cleaned_data['email']
# do something great with that data
@dstanek
dstanek / gist:6383436
Created August 29, 2013 21:08
A really simple script that I use to bootstrap devstack on a brand new Rackspace cloud server.
#!/bin/bash
host=$1
pub_key=$2
function help {
echo 'usage: ./bootstrap-devstack.sh host public_key'
echo ' example: ./bootstrap-devstack.sh 1.1.1.1 ~/.ssh/id_dsa.pub'
exit 1
}
{
"rules": [
{
"local": {
"user": "name"
},
"remote": [
{
"type": "UserName"
}
{
"rules": [
{
"local": {
"user": {
"name": "@@UserName@@"
}
},
"remote": [
{
@dstanek
dstanek / di_by_hand.py
Last active August 29, 2015 14:04
DI by hand
import abc
class Logger(object):
__metaclass__ abc.ABCMeta
@abstractmethod
def log_it(self, message, *args, **kwargs):
raise NotImplemented
@dstanek
dstanek / di_with_sg.py
Created July 21, 2014 18:39
DI with snake-guice
import abc
class Logger(object):
__metaclass__ abc.ABCMeta
@abstractmethod
def log_it(self, message, *args, **kwargs):
raise NotImplemented

Policy-Endpoint Associations

Create association with endpoint: PUT /OS-ENDPOINT-POLICY/endpoints/{endpoint_id}/policy

Creates an association between the policy and the endpoint. If another association already existed for the specified endpoint, this will replace that association.

Request:

Title

Python Koans - An Introduction To Python

Abstract

Python is a fun, dynamic, flexible language for solving all kinds of problems. It's used everywhere from modest scripts to large systems, powering things like websites, games, film production tools, scientific analysis, and even space programs. Best of all, it's a language that "fits your brain".

This session is a mostly self guided introduction to Python through koans. What’s a koan you ask? It’s a small puzzle or exercise expressed as a test, designed to build your knowledge of the Python syntax and idioms incrementially.