Skip to content

Instantly share code, notes, and snippets.

@jmcdice
jmcdice / pez-sample-app-push
Last active November 8, 2016 19:01
Push a sample app to Pez, connect an SQL backend and scale it, blue-green deploy.
## Push a sample application to pez
# Login to PeZ and create an account:
https://pez.pezapp.io/
# Grab a working cf binary for your platform (this assumes osx):
$ curl -L "https://cli.run.pivotal.io/stable?release=macosx64-binary&source=github" | tar -zx
$ mv cf /usr/local/bin/
@jmcdice
jmcdice / bosh-ruby.sh
Last active November 4, 2016 19:27
Install Bosh CLI
# Install ruby and the bosh cli
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
#!/usr/bin/perl
$regexp = '\d\d:\d\d:\d\d';
while(<>){
if(/($reg)/g) {
print"$1\n"
}
while( m/($reg)/g ){
print"$1\n"
@jmcdice
jmcdice / gist:cfdc12510fb978240f84f3da5e10ef1c
Last active February 14, 2017 21:32
Parsing json with jq.
$ cat test.json
[
{
"kind": "workspace",
"id": 672699,
"name": "Iteration 0",
"person_id": 2179801,
"project_ids": [
1968761,
1968571,
@jmcdice
jmcdice / gist:fac460015f8b9efea8939fcdff86d523
Last active August 29, 2017 16:21
Using gpg2 and gpg-agent to manage pipeline secrets
# Install gnupg2 and gnupg-agent
$ sudo apt-get install gnupg2 gnupg-agent rng-tools
# Make sure you have gpg2 2.1.11 (gpg2 --version)
# Create entropy for key generation
$ sudo rngd -r /dev/urandom
cat >cloudinit.sh<<EOF
#cloud-config
users:
- default
- name: stack
lock_passwd: False
sudo: ["ALL=(ALL) NOPASSWD:ALL\nDefaults:stack !requiretty"]
shell: /bin/bash
@jmcdice
jmcdice / gist:fe15cc5ed053d57146d1961a76d833af
Last active July 14, 2017 13:54
Install and start concourse on Ubuntu
#!/usr/bin/env bash
function get_binary() {
wget https://github.com/concourse/bin/releases/download/v2.8.0-rc.125/concourse_linux_amd64 -O /usr/sbin/concourse
chmod 755 /usr/sbin/concourse
}
function create_keys() {
@jmcdice
jmcdice / Training
Last active September 21, 2017 22:05
## Training for PRE
If on AWS or GCP use BBL
Setup Standalone Bosh (Bosh Boot Loader)
- https://github.com/cloudfoundry/bosh-bootloader
If on other, use bosh create-env (init)
https://bosh.io/docs/init.html
Deploy the Vault Bosh Release (secure credential storage)
#!/usr/bin/env bash
#
# Have you ever deleted the default fw rules in your gcp project?
# Of course you have! Here's how to re-create them.
PROJECT=''
function create_default_ruleset() {
# Allow ICMP from Anywhere
#!/usr/bin/env bash
TARGET='concourse'
TASK='deploy-healthwatch/apply-changes'
function wait_for_pipeline_to_complete() {
local JOB=$1
local count=1