Skip to content

Instantly share code, notes, and snippets.

View mattbostock's full-sized avatar

Matt Bostock mattbostock

View GitHub Profile
@mattbostock
mattbostock / git-prune-rebase.sh
Last active December 17, 2018 15:08
Prune Git branches that were merged by rebasing in GitHub
#!/usr/bin/env bash
set -eo pipefail
# Not thoroughly tested, please use with caution! Try with 'echo {}' first to confirm it works for you.
#
# exec git for-each-ref refs/heads/ "--format=%(refname:short)" | grep -v master | xargs -P 4 -I {} bash -c "( ! git cherry master {} | grep -q '^[^-]' ) && git branch -D {}"
@mattbostock
mattbostock / prometheus.yml
Last active November 9, 2016 18:54
Prometheus example config
global:
scrape_interval: 5s
evaluation_interval: 5s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
@mattbostock
mattbostock / add_users_to_drone.go
Created April 6, 2016 12:45
Noddy script to create all users from GitHub Enterprise and GitHub.com organisations in Drone: https://github.com/drone/drone
package main
import (
"fmt"
"net/url"
"os"
"code.google.com/p/goauth2/oauth"
drone "github.com/drone/drone/client"
[
{ "userName": "alphagov", "repo": "blinken" },
{ "userName": "alphagov", "repo": "boxes" },
{ "userName": "alphagov", "repo": "cdn-acceptance-tests" },
{ "userName": "alphagov", "repo": "ci-puppet" },
{ "userName": "alphagov", "repo": "cloudflare-configure" },
{ "userName": "alphagov", "repo": "fabric-scripts" },
{ "userName": "alphagov", "repo": "ghtools" },
{ "userName": "alphagov", "repo": "govuk_crawler_worker" },
{ "userName": "alphagov", "repo": "govuk_mirror-puppet" },
@mattbostock
mattbostock / avoid_wanted_commits
Last active August 29, 2015 13:56
Avoid unwanted commits in Git PR
git pull --rebase upstream master
git push --force origin mypr-branch