Skip to content

Instantly share code, notes, and snippets.

@sykesm
Last active October 26, 2015 12:35
Show Gist options
  • Save sykesm/d4d48d41ca3c390a1772 to your computer and use it in GitHub Desktop.
Save sykesm/d4d48d41ca3c390a1772 to your computer and use it in GitHub Desktop.
bosh-lite-scripts
#!/bin/sh
# CF_TRACE=true cf curl -X POST -H "Content-Type: application/json" -d '{"name":"beta","non_basic_services_allowed":true,"total_services":15,"total_routes":300,"memory_limit":4096,"trial_db_allowed":true}' /v2/quota_definitions
CF=/usr/local/bin/cf
$CF api --skip-ssl-validation api.10.244.0.34.xip.io || exit 1
$CF auth admin admin || exit 1
$CF create-org playground || exit 1
$CF target -o playground || exit 1
$CF create-space -o playground test || exit 1
$CF target -o playground -s test || exit 1
#!/bin/sh
uaac target uaa.10.244.0.34.xip.io
uaac token client get admin -s admin-secret
uaac client update admin --authorities "password.write clients.write clients.read scim.read uaa.admin clients.secret scim.write"
uaac token delete
uaac token client get admin -s admin-secret
cf auth admin admin
cf create-user $1 $2
#!/bin/bash
export PGPASSWORD=admin
psql -h 10.244.0.30 -U ccadmin -w -p 5524 ccdb
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require "nats/client"
def command_available?(cmd)
`command -v #{cmd} >/dev/null 2>&1`
$?.success?
end
messages = []
NATS.start(:uri => 'nats://nats:[email protected]:4222', :autostart => true) do
inbox = NATS.create_inbox
sub_id = NATS.subscribe(inbox) do |message, _, sub|
messages << Yajl::Parser.parse(message)
end
NATS.timeout(sub_id, 1, :expected => 1024) { NATS.stop }
NATS.publish('vcap.component.discover', '', inbox)
end
messages.each do |msg|
if command_available?("underscore") && $stdout.tty?
puts `echo '#{msg.to_json}' | underscore pretty`
else
puts JSON.pretty_generate(msg)
end
end
#!/bin/bash
if [ -z $1 ]; then
TOPIC='>'
else
TOPIC=$1
fi
nats-sub $TOPIC -s nats://nats:[email protected]:4222
#!/bin/sh
PRETTY_PRINT="cat"
if [ -t 1 -a $(tput colors) -ge "0" ]; then
if [ -n "$(type -t underscore)" ]; then
PRETTY_PRINT="underscore pretty"
elif [ -n "$(type -t json_pp)" ]; then
PRETTY_PRINT="json_pp"
fi
elif [ -n "$(type -t underscore)" ]; then
PRETTY_PRINT="underscore print"
fi
curl -s $1 | $PRETTY_PRINT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment