func Elide(value string) string {
	if len(value) > 40 {
		return value[0:37] + "..."
	}
	return value
}
Elide returns the first bit of its input string with a suffix of "..." if it's longer than
a comfortable 40 characters.
package tools
import (
	"crypto/rand"
	"errors"
	mrand "math/rand"
	"os"
	"time"
	"github.com/rackspace/gophercloud"
)
var ErrTimeout = errors.New("Timed out")
func OnlyRS(original gophercloud.AuthOptions) gophercloud.AuthOptions {
	if os.Getenv("RS_AUTH_URL") == "" {
		original.IdentityEndpoint = ""
	}
	if os.Getenv("RS_USERNAME") == "" {
		original.Username = ""
	}
	if os.Getenv("RS_PASSWORD") == "" {
		original.Password = ""
	}
	if os.Getenv("RS_API_KEY") == "" {
		original.APIKey = ""
	}
	return original
}
func WaitFor(predicate func() (bool, error)) error {
	for i := 0; i < 300; i++ {
		time.Sleep(1 * time.Second)
		satisfied, err := predicate()
		if err != nil {
			return err
		}
		if satisfied {
			return nil
		}
	}
	return ErrTimeout
}
func MakeNewPassword(oldPass string) string {
	randomPassword := RandomString("", 16)
	for randomPassword == oldPass {
		randomPassword = RandomString("", 16)
	}
	return randomPassword
}
func RandomString(prefix string, n int) string {
	const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	var bytes = make([]byte, n)
	rand.Read(bytes)
	for i, b := range bytes {
		bytes[i] = alphanum[b%byte(len(alphanum))]
	}
	return prefix + string(bytes)
}
func RandomInt(min, max int) int {
	mrand.Seed(time.Now().Unix())
	return mrand.Intn(max-min) + min
}