Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash -e
# can't -u because of stuff within openrc
# Run the rp.yaml file against an already running placement-api.
# In devstack's local.conf 'enable_service placement-api' then:
#
# source PATH_TO_DEVSTACK/openrc admin admin
# ./placement.sh
import inspect
import collections
LATEST = 5.0
METHODS = collections.defaultdict(list)
# From twisted
# https://github.com/twisted/twisted/blob/trunk/twisted/python/deprecate.py
@cdent
cdent / os-cells.yaml
Created May 27, 2016 11:35
gabbi yaml file used for rather sloppily exploring the os-cells api in nova
defaults:
request_headers:
x-auth-token: $ENVIRON['SERVICE_TOKEN']
tests:
- name: check get
GET: /os-cells
response_json_paths:
#!/bin/sh -xe
# A quick and dirty automatic demo of a small subset of gabbi features.
# Put this in /tmp or somewhere like it. Make sure you have git,
# tmux and virtualenv installed.
# !! NOTE: You must _not_ be in an already running tmux session.
# Make your window big or your font size small. Then `sh dogab.sh`.
@cdent
cdent / app.py
Created June 19, 2015 10:40
wsgi closing connections
"""
Start with:
gunicorn app:application
or:
python app.py
Then:
@cdent
cdent / README.md
Last active August 29, 2015 14:22 — forked from FND/README.md

Getting Started

$ pip install falcon
$ python3 app.py

alternatively with Gunicorn (for HTTP/1.1):

$ pip install gunicorn

$ gunicorn app:app

@cdent
cdent / README
Last active December 17, 2015 12:18
Two scripts to experiment with sorting revisions in a collection of tiddlers.
makeit.py just creates some bags, recipes and tiddlers to experiment with
each time it runs it will erase and recreate the store (if the text store
is being used)
listit.py gets all the tiddlers in a named recipe and then orders the
revisions within by modified time, irrespective of tiddler identity.
As written it processes a collection of tiddlers from a recipe but this
@cdent
cdent / wsgirefserver.py
Last active December 17, 2015 06:19
Quick and dirty wsgiref server for use with [tsapp](http://tsapp.tiddlyspace.com) as an example of using a different server than the built in cherrypy server. This one is likely to be quite slow due to its single process/thread nature. To use set `wsgi_server: wsgirefserver` in `.tsapp`.
import sys
from tsapp.proxy import create_app
from wsgiref.simple_server import make_server
def start_server(config):
port = int(config['port'])
local_host = config['local_host']
@cdent
cdent / tiddlers.py
Created May 8, 2013 14:42
A simple python tool to get a group of tiddlers as json and output the text, example usage: ./tiddlers.py 'http://cdent.tiddlyspace.com/bags/cdent_public/tiddlers.json?fat=1;sort=-modified;limit=10'
#!/usr/bin/env python
import sys
import json
from urllib2 import urlopen
def getstuff(from_uri):
print 'getting', from_uri
response = urlopen(from_uri)
#
# Fatal error in ../deps/v8/src/api.h, line 297
# CHECK(allow_empty_handle || that != __null) failed
#
==== Stack trace ============================================
Security context: 0xbcfa3257229 <JS Object>#0#
1: invokeMacro [/Users/cdent/src/twikifier/twikifier.js:2949] (this=0xbcfa3257349 <JS Global Object>#1#,place=0x1c72e8d444f9 <JS Object>#2#,macro=0x1c72e8d4d601 <String[5]: today>,params=0x1c72e8d4d621 <String[0]: >,wikifier=0x1c72e8d451d1 <a Wikifier>#3#,tiddler=0xbcfa3204121 <undefined>)