Skip to content

Instantly share code, notes, and snippets.

$ mkdir git-example
$ cd git-example
$ git init
Initialized empty Git repository in /Users/grahambleach/git-example/.git/
$ echo "This is a test repo" > README
$ git add README
$ git commit
[master (root-commit) b8fd413] This is a test
1 file changed, 1 insertion(+)
create mode 100644 README
@bleach
bleach / check-team-admin
Last active January 29, 2019 10:55
Check if LAA tech archs have access to all "laa repos"
#!/usr/bin/env python
import os
import requests
from github import Github
g = Github(os.environ['GITHUB_ACCESS_TOKEN']) # requires read:org and repo scopes
org = g.get_organization('ministryofjustice')

Git workflow

Note for Apply team members: This is replaced by the working with git guide; that also has details of working practices we agreed in earlier retros and can be edited by multiple members of the team (this gist can only be edited by me, so is an unsuitable place for long term team documents).

Get local master up to date

git checkout master && git pull

Branch from master

These are all practical things that we would find really useful. We like cuddly toys and cute clothes, but you tend to get a lot of them and we found that ours, being on the larger side, grew out of the newborn clothes very quickly.

Baby-gros / sleepsuits

The practical babywear.

  • Recommend getting a size up for them to grow into eg. 3-6 months, but ensure that they'll still be appropriate for the season.
  • With feet
  • Done up with poppers going the full length, so you don't have to pull anything over their head
#!/usr/bin/env bash
set -euo pipefail
quota_url=$(cf curl '/v2/quota_definitions?q=name:default' \
| jq '.resources[].metadata.url')
from_date=$(($(date '+%s') - 3600*24*90))
cf curl /v2/organizations \

Pushing a shiny app to CF

We recently enabled custom buildpacks on GOV.UK PaaS after requests by members of the data science community who want to deploy shiny apps.

Although our team is not able to provide official support for R/shiny buildpacks, I was able to get a simple shiny app working, with some help from Adam Robinson, who commented on a previous version of this gist. Thanks Adam!

I'm coping the data science community will be able to try using PaaS to deploy shiny apps and share what they learn and any buildpack improvements they make.

How I did it

Summary 2

Once the original PR was merged we found a couple of problems that prevented this from working. These are fixed in this PR: FIXME

There's also a docs PR, which I am about to rework a bit: alphagov/paas-team-manual#104

Unable to validate google JWT signatures

CF v253 introduced a UAA change that appears to require a new tokenKeyUrl property to be set to allow Google's signatures to be validated. A bug exists for this upstream.

$ make test
cd scripts &&\
BUNDLE_GEMFILE=Gemfile bundle exec rspec
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 42801
...........................................

What

There's no official CLI release with a UI that supports tasks yet, so I thought I'd confirm that they work.

Find out what my app guid is:

$ cf app --guid myapp
fc2d7a58-343f-47d2-bc24-0d611af11aa6

BOSH

The tool used to install Cloud Foundry. Docs

The meaning of the acronym has been described as Basic Outer Shell or BOSH Outer Shell. It's also rumoured to have been derived from Google's BORG (next letter from R & G are S & H).

CVE - Common Vulnerabilities and Exposures ID

A security problem in some software (aka vulnerability or hole). Usually requiring us to update our installed version.