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
@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:3053561
Created July 5, 2012 13:05
Continuous Deployment with Jenkins and Puppet

Puppet with Jenkins

Setup Jenkins

With Puppet:

puppet module install rtyler-jenkins

puppet apply -v -e "include jenkins"

@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/"
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<com.cloudbees.jenkins.plugins.securecopy.ExportsJobProperty>
<exports/>
</com.cloudbees.jenkins.plugins.securecopy.ExportsJobProperty>
<hudson.model.ParametersDefinitionProperty>
@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) {
<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 / JSONStringMap.java
Last active November 20, 2020 14:18
Very basic Java methods to encode/decode Map<String,String> as JSON
public static String write(Map<String, String> map) {
StringBuilder b = new StringBuilder();
b.append('{');
boolean first = true;
for (Map.Entry<String, String> e : map.entrySet()) {
if (first) {
first = false;
} else {
b.append(',');
}