Skip to content

Instantly share code, notes, and snippets.

View stephenc's full-sized avatar
🍵
Enjoying a nice cup of tea

Stephen Connolly stephenc

🍵
Enjoying a nice cup of tea
View GitHub Profile
<server>
<id>junit.github.io</id>
<username>git</username>
</server>

Keybase proof

I hereby claim:

  • I am stephenc on github.
  • I am stephenconnolly (https://keybase.io/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:

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" ]
then
sel=jdk$sel
fi
local base=/Library/Java/JavaVirtualMachines
if [ -x "/System/Library/Java/JavaVirtualMachines/$sel/Contents/Home/bin/java" ]
then
@stephenc
stephenc / gist:913704
Created April 11, 2011 15:30
Minimal ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>apache.snapshots.https</id>
<username><!-- your apache ldap username --></username>
<password><!-- your apache ldap password --></password>
</server>
<server>
<id>apache.releases.https</id>
<username><!-- your apache ldap username --></username>
@stephenc
stephenc / euler.sh
Created June 6, 2012 11:26 — forked from anonymous/euler.sh
Solution for Euler numbers
#!/bin/bash
################################################################################
# Copyright (c) 2012, by Michael Neale. All rights reserved.
#
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MICHAEL NEALE
#
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
################################################################################
@stephenc
stephenc / gist:4574201
Created January 19, 2013 18:36
diff build-maven-deploy.xml.orig build-maven-deploy.xml
44a45,47
> <!-- uploads done using webdav, need to register -->
> <artifact:install-provider artifactId="wagon-webdav" version="1.0-beta-1" />
>
47c50
< url="https://nexus.codehaus.org/service/local/staging/deploy/maven2/"
---
> url="dav:https://dav.codehaus.org/repository/jackson"
55c58
< url="https://nexus.codehaus.org/content/repositories/snapshots/"
@stephenc
stephenc / loatStatistics.groovy
Last active December 25, 2015 21:18
Estimates the number of executors in use for a Jenkins instance
def int x0 = 0;
def double x1 = 0.0;
def double x2 = 0.0;
println("Total executors")
println("===============")
println("")
println("Sampling every hour")
println("-------------------")
println("")
for (x in Jenkins.instance.overallLoad.totalExecutors.hour.history) {
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
stephenc / gist:09b771c57126165d64495d6a0d43d237
Created March 23, 2017 17:06
Help rescue Jenkins in memory data to disk
for (def u in User.byName.values()) { u.save() }
for (def item in Jenkins.instance.allItems) { item.save() }
for (def c in Jenkins.instance.computers) { if (!(c instanceof hudson.model.Hudson$MasterComputer)) c.getNode().save() }
@stephenc
stephenc / jenkins-43507.groovy
Created June 19, 2017 13:14
JENKINS-43507: Script to capture pre- and post- upgrade state of Multibranch projects and organization folders
println("Organization folder last scan");
println("=============================");
println();
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}");
}
}
println();