Skip to content

Instantly share code, notes, and snippets.

View nebhale's full-sized avatar

Ben Hale nebhale

View GitHub Profile
private void writeManifest(JarOutputStream out, BundleManifest manifest) throws IOException {
out.putNextEntry(new JarEntry("META-INF/"));
out.write(new byte[0]);
out.flush();
out.closeEntry();
out.putNextEntry(new JarEntry(JarFile.MANIFEST_NAME));
manifest.write(new OutputStreamWriter(out));
out.flush();
out.closeEntry();
@nebhale
nebhale / mkdir.js
Created November 21, 2012 08:31
Node-friendly `mkdir -p` and `rm -r`
/*jshint node:true*/
'use strict';
var fs = require('fs');
var path = require('path');
/**
* Callback function for the `fs.exists()` function. If the directory exists, calls the completion callback
*
* @param {string} directory The directory to make
@nebhale
nebhale / output.txt
Created January 17, 2013 17:30
Test case reproducing problems with gzipResponse
Hello World!
@nebhale
nebhale / repository_index.rb
Created August 13, 2013 09:54
Print downloaded content before YAML parsing
# Creates a new repository index, populating it with values from an index file.
#
# @param [String] repository_root the root of the repository to create the index for
def initialize(repository_root)
@index = {}
JavaBuildpack::Util::DownloadCache.new.get("#{repository_root}#{INDEX_PATH}") do |file| # TODO: Use global cache #50175265
content = file.read
puts content
@index.merge! YAML.load(content)
end
@nebhale
nebhale / .bash_profile
Created September 9, 2013 01:03
A bash function and prompt to get the current git branch status in a prompt.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
# Set titles
PS1='\[\e]2;\w\]\[\a\][\[\e[0;32m\]\h\[\e[0;33m\]$(parse_git_branch)\[\e[0m\]]: '
require 'formula'
class SpringBootCli < Formula
homepage 'https://github.com/SpringSource/spring-boot'
url 'https://repo.springsource.org/milestone/org/springframework/boot/spring-boot-cli/0.5.0.M4/spring-boot-cli-0.5.0.M4.jar'
version '0.5.0.M4'
sha1 '50e79bfe7f3958a2f23cad19e73a65d43999d2fa'
def install
libexec.install 'spring-boot-cli-0.5.0.M4.jar'
@nebhale
nebhale / gcf.rb
Last active December 30, 2015 11:28
A Homebrew formula for the Cloud Foundry command line interface, gcf
require 'formula'
class Gcf < Formula
homepage 'https://github.com/cloudfoundry/cli'
url 'https://github.com/cloudfoundry/cli.git', :tag => 'v6.0.0-beta'
version '6.0.0-beta'
head 'https://github.com/cloudfoundry/cli.git', :branch => 'master'
depends_on 'go' => :build
@nebhale
nebhale / clone.md
Last active August 29, 2015 13:56
Cloud Foundry Buildpack Administration Support Demo Scripts

From Clone

Demonstrate no buildpacks

cf buildpacks

Create and upload custom buildpack (pin to 51)

git clone https://github.com/cloudfoundry/java-buildpack.git
@nebhale
nebhale / gist:9320504
Last active August 29, 2015 13:56
Listing of Java Buildpack System Test artifacts "lost" by Cloud Foundry

Organization: jbp-test

Space: system-test

Application: system-test-TCST-web-servlet-2-636120

bhale-desktop: CF_TRACE=true cf delete -f system-test-TCST-web-servlet-2-636120

VERSION:
6.0.1-homebrew
@nebhale
nebhale / gist:5c7665ff6a458c6614af
Created June 4, 2014 10:26
Java Buildpack Debug Output
Getting files for app web-servlet-2-application in org bhale / space development as bhale@gopivotal.com...
OK
# Logfile created on 2014-06-03 05:11:02 +0000 by logger.rb/31641
2014-06-03T05:11:02.82+0000 [ConfigurationUtils] DEBUG No configuration file /tmp/buildpacks/java-buildpack/config/version.yml found
2014-06-03T05:11:02.85+0000 [BuildpackVersion] DEBUG 1703374 | https://github.com/cloudfoundry/java-buildpack#1703374
2014-06-03T05:11:02.85+0000 [Buildpack] DEBUG Environment Variables: {"FOO"=>"BAR", "JAVA_OPTS"=>"-Dalpha=bravo", "USER"=>"vcap", "VCAP_APPLICATION"=>"{\"limits\":{\"mem\":512,\"disk\":1024,\"fds\":16384},\"application_version\":\"f1663a3f-8bb3-4578-9763-bfd87e8c00e8\",\"application_name\":\"web-servlet-2-application\",\"application_uris\":[\"ben-web-servlet-2-application.cfapps.io\"],\"version\":\"f1663a3f-8bb3-4578-9763-bfd87e8c00e8\",\"name\":\"web-servlet-2-application\",\"space_name\":\"development\",\"space_id\":\"8c84b5d3-d73d-413f-841c