Skip to content

Instantly share code, notes, and snippets.

@jbayer
jbayer / gist:8286966
Created January 6, 2014 18:14
uaac version and help
$ uaac -v
UAA client 2.0.0
$ uaac
UAA Command Line Interface
Miscellaneous
version Display version
help [topic|command...] Display summary or details of command or topic
@jbayer
jbayer / SlowServlet.java
Created December 30, 2013 08:24
slow to init servlet to showcase behavior when a app takes awhile to start
package slow;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@jbayer
jbayer / gist:8089913
Created December 23, 2013 00:01
snippet bosh deployment manifest example of dea's being aware of multiple zones
- instances: 1
name: runner_z1
networks:
- name: cf1
static_ips:
- 10.244.0.26
properties:
loggregator_endpoint:
host: 10.244.0.10
networks:
@jbayer
jbayer / gist:6850923
Created October 6, 2013 07:54
A simple multi-buildpack example of using the 1st buildpack to retrieve my app contents from a git repo, using another buildpack to stage my app.
$ ls
jamesbayer:foo jamesbayer$ vi .buildpacks
$ cat .buildpacks
https://github.com/jbayer/null-buildpack.git
https://github.com/cloudfoundry/heroku-buildpack-ruby.git
jamesbayer:foo jamesbayer$ cf push --buildpack https://github.com/ddollar/heroku-buildpack-multi.git
Name> git-test
Instances> 1
@jbayer
jbayer / gist:6845024
Created October 5, 2013 19:18
Cloud Foundry Router - running 4 copies of the sticky-session app
$ cf app sticky-session
Showing health and status for app sticky-session...
OK
health: running
usage: 256M x 4 instances
urls: sticky-session-6115e.cfapps.io, sticky-session.cfapps.io
status since cpu memory disk
#0 running 2013-10-05 11:08:31 AM 0.0% 84.3M of 256M 93.6M of 1G
@jbayer
jbayer / gist:6568018
Created September 15, 2013 04:26
work-around for gcc strangeness building go, use the --cc option
$ brew install go --cross-compile-common
==> Downloading https://go.googlecode.com/files/go1.1.2.src.tar.gz
######################################################################## 100.0%
==> ./make.bash --no-clean
==> ./make.bash --no-clean
==> ./make.bash --no-clean
/private/tmp/go-BvwY/go/src/cmd/5l/../ld/lib.c:661:9: error: no case matching constant switch condition '53' [-Werror]
switch(thechar){
^~~~~~~
1 error generated.
@jbayer
jbayer / gist:6519949
Created September 11, 2013 06:23
create user-provided service gist
$ cf -v
cf 5.3.0
$ cf create-service user-provided -t
>>> OMMITTED
Name?> somedb
What credential parameters should applications use to connect to this service instance?
(e.g. hostname, port, password)> uri
uri> mysql://dbuser:dbpasswd@mysql.vcap.me:3306/dbname
@jbayer
jbayer / gist:6433725
Created September 4, 2013 07:22
josh mckenty's python buildpack with flask test
jamesbayer:hello-flask jamesbayer$ cat hello.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
This file has been truncated, but you can view the full file.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x571676]
goroutine 7 [running]:
github.com/cloudfoundry/yagnats.(*Client).Ping(0x0, 0x4bf7e8)
/var/vcap/packages/gorouter/src/github.com/cloudfoundry/yagnats/client.go:41 +0x36
github.com/cloudfoundry/go_cfmessagebus.(*NatsAdapter).Ping(0xc2000e1480, 0x5)
/var/vcap/packages/gorouter/src/github.com/cloudfoundry/go_cfmessagebus/nats.go:144 +0x28
github.com/cloudfoundry/gorouter.(*Registry).isStateStale(0xc2000e1500, 0x27)
/var/vcap/packages/gorouter/src/github.com/cloudfoundry/gorouter/registry.go:212 +0x2e
@jbayer
jbayer / gist:5915622
Created July 3, 2013 05:18
Example Cloud Foundry v2 ruby script for a short-lived process that should run every 10 min. This keeps the PID alive of this process so CF doesn't think the app instance is dead and try and restart it elsewhere.
#!/usr/bin/env ruby
while true
system "bundle exec rake cron"
sleep ARGV[0] || 600
end