Skip to content

Instantly share code, notes, and snippets.

Enjoying a nice cup of tea

Stephen Connolly stephenc

Enjoying a nice cup of tea
Block or report user

Report or block stephenc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am stephenc on github.
  • I am stephenconnolly ( on keybase.
  • I have a public key whose fingerprint is 6444 C030 9052 58CE 2E42 B511 DA9C 0CA7 B492 4CA3

To claim this, I am signing this object:

stephenc / bootstrap.min.css
Created Dec 13, 2018
centraal static content
View bootstrap.min.css
* Bootstrap v4.0.0 (
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (
*/:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#6c757d;--gray-dark:#343a40;--primary:#007bff;--secondary:#6c757d;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;
stephenc / Makefile
Created Oct 9, 2018
How to have a makefile only rebuild a docker image when needed
View Makefile
.PHONY: build-image
build-image: .build-image
$(eval timestamp=$(shell docker inspect -f '{{ range $$i, $$e := split .Metadata.LastTagTime "T" }}{{if eq $$i 0}}{{range $$j, $$v := split $$e "-"}}{{$$v}}{{end}}{{else}}{{$$f := printf "%.8s" $$e}}{{range $$j, $$g := split $$f ":"}}{{if lt $$j 2}}{{$$g}}{{else}}.{{$$g}}{{end}}{{end}}{{end}}{{end}}' $(DOCKER_TAG) 2>/dev/null ))
@if [ "A$(timestamp)A" = "AA" ] ; then rm -f .build-image ; else touch -t $(timestamp) .build-image ; fi
.build-image: Dockerfile rootfs/*
stephenc /
Last active May 4, 2018
Watch Me Code, Episode 5 pipeline shared libraries

Watch Me Code - Episode 5

The build is defined in the vars/asfMavenTlpStdBuild.groovy file, that relies on the jenkinsEnv singelton.

Ideally you would put vars/jenkinsEnv.groovy in a separate repository (or at least a separate branch) and define two shared libraries:

  1. The shared library that defines jenkinsEnv
  2. The shared library that defines asfMavenTlpStdBuild

This way, to migrate to a different Jenkins master, we just need a different jenkinsEnv singleton that respects the same API contract.

stephenc / jenkins-43507.groovy
Created Jun 19, 2017
JENKINS-43507: Script to capture pre- and post- upgrade state of Multibranch projects and organization folders
View jenkins-43507.groovy
println("Organization folder last scan");
for (def i in Jenkins.instance.allItems) {
if (i instanceof jenkins.branch.OrganizationFolder) {
println("${i.fullName}: ${i.computation.timestamp.format('yyyy-MM-dd HH:mm:ss z')} ${i.computation.result}");
stephenc / gist:09b771c57126165d64495d6a0d43d237
Created Mar 23, 2017
Help rescue Jenkins in memory data to disk
View gist:09b771c57126165d64495d6a0d43d237
for (def u in User.byName.values()) { }
for (def item in Jenkins.instance.allItems) { }
for (def c in Jenkins.instance.computers) { if (!(c instanceof hudson.model.Hudson$MasterComputer)) c.getNode().save() }
View gist:383ecfaa28ff309c0e708464175dc7a1
def listener=ExtensionList.lookup(AsyncPeriodicWork.class).get(org.apache.jenkins.gitpubsub.GitPubSubPoll.class);
println("Listener: ${listener}");
println("Listener.periodSeconds: ${listener.periodSeconds}");
println("Listener.requestRecycleMins: ${listener.requestRecycleMins}");
println("Listener.disableNotifyScm: ${listener.disableNotifyScm}");
println("Listener.lastTS: ${listener.lastTS}");
println("Listener.lastTime: ${listener.lastTime}");
println("Listener.longPollRequest: ${listener.longPollRequest}");
stephenc /
Last active Jul 23, 2016
Very basic Java methods to encode/decode Map<String,String> as JSON
public static String write(Map<String, String> map) {
StringBuilder b = new StringBuilder();
boolean first = true;
for (Map.Entry<String, String> e : map.entrySet()) {
if (first) {
first = false;
} else {
View gist:6d8befb8cdd0edd09b7d
usejava ()
local sel=$1.jdk
if [ -x "/Library/Java/JavaVirtualMachines/jdk$sel/Contents/Home/bin/java" -a ! -x "/Library/Java/JavaVirtualMachines/$1/Contents/Home/bin/java" ]
local base=/Library/Java/JavaVirtualMachines
if [ -x "/System/Library/Java/JavaVirtualMachines/$sel/Contents/Home/bin/java" ]

Keybase proof

I hereby claim:

  • I am stephenc on github.
  • I am stephenconnolly ( on keybase.
  • I have a public key whose fingerprint is 042B 29E9 2899 5B9D B963 C636 C7CA 19B7 B620 D787

To claim this, I am signing this object:

You can’t perform that action at this time.