Skip to content

Instantly share code, notes, and snippets.

View seanf's full-sized avatar

Sean Flanigan seanf

  • Brisbane, Australia
View GitHub Profile
@seanf
seanf / settings.xml
Created January 17, 2014 03:59
~/.m2/settings.xml with Checkstyle/FindBugs exclusions for Zanata - this allows you to edit exclusions on your local machine
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>local-settings</id>
<activation>
<property>
@seanf
seanf / jenkins-ensure-timeout.groovy
Last active September 27, 2022 11:00
Jenkins Groovy script: sets a timeout strategy for any job which doesn't have one
// This script is for Jenkins' Groovy console, and sets a timeout
// strategy for any job which doesn't have one.
// Based on http://janmaterne.wordpress.com/2010/07/11/how-to-check-if-all-hudson-jobs-have-a-timeout/
// Updated and modified by Sean Flanigan.
import hudson.model.*
String describe(strat) {
if (strat instanceof hudson.plugins.build_timeout.impl.ElasticTimeOutStrategy) {
return "Elastic(${strat.timeoutPercentage}, ${strat.numberOfBuilds}, ${strat.timeoutMinutesElasticDefault})"
@seanf
seanf / 81-thinkpad-dock.rules
Last active March 20, 2023 10:42
Example ThinkPad docking script for multi-monitor
# Save this file (after modifying ID_VENDOR and ID_MODEL if necessary) as /etc/udev/rules.d/81-thinkpad-dock.rules
# These values seem to work for "ThinkPad Mini Dock Plus Series 3"
SUBSYSTEM=="usb", ACTION=="add|remove", ENV{ID_VENDOR}=="17ef", ENV{ID_MODEL}=="100a", RUN+="/etc/sbin/thinkpad-dock.sh"
@seanf
seanf / JenkinsSlaveWorkspaceCleanup.groovy
Last active September 27, 2022 10:42
Jenkins Slave Workspace Cleanup by Bertrand Renuart: http://narkive.com/gsOMTV6x#post6
import hudson.FilePath;
// Initialize dryRun parameter to TRUE if not given as script parameter
if( !binding.variables.containsKey("dryRun") ) {
dryRun = true;
}
if( dryRun == true ) {
println "** Execute a dryRun - no files will ever be deleted **";
}
@seanf
seanf / CdiUnitRunnerWithParameters.java
Last active March 4, 2016 08:30
(QUITE BROKEN) Parameterized Runner for CDI-Unit
/*
* Copyright 2016, Red Hat, Inc. and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
@seanf
seanf / scriptengines.groovy
Created July 18, 2016 06:01
Groovy script to list installed script engines
import javax.script.ScriptEngineManager;
def fs = new ScriptEngineManager().getEngineFactories()
fs.forEach{
println "Script Engine: " + it.engineName
println "Names: " + it.names
println()
}
@seanf
seanf / simplelogger.properties
Created August 1, 2016 02:03
Enable Maven timestamps: copy to $MAVEN/conf/logging/
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@seanf
seanf / mergerepos.sh
Last active October 28, 2016 01:39
Merge Zanata repos
#!/bin/zsh -ex
# https://zanata.atlassian.net/browse/ZNTA-1391
# FIXME handle extra branches on client and api
# determine directory containing this script
SCRIPT_DIR=$( dirname "$0:A" )
oldParentVersion=30-SNAPSHOT
@seanf
seanf / jbosscli.kt
Created August 23, 2017 02:06
Idempotent jboss-cli with Kotlin
import org.jboss.`as`.cli.scriptsupport.CLI
import org.slf4j.LoggerFactory
/**
* @author Sean Flanigan <a href="mailto:sflaniga@redhat.com">sflaniga@redhat.com</a>
*/
// Refs:
// https://developer.jboss.org/wiki/AdvancedCLIScriptingWithGroovyRhinoJythonEtc
// https://github.com/wildfly/wildfly-core/pull/1501/files?diff=unified#diff-25ae58578a2f30dd07236a549dc2f8d9R62
// Note that running CLI/embed-server seems to have side effects which cause problems if you later launch wildfly
@seanf
seanf / process.kt
Created August 23, 2017 02:12
Execute process from Kotlin
import java.lang.ProcessBuilder.Redirect
import java.util.concurrent.TimeUnit
fun String.runCommand(workingDir: File? = null) {
val process = ProcessBuilder(*split(" ").toTypedArray())
.directory(workingDir)
.redirectOutput(Redirect.INHERIT)
.redirectError(Redirect.INHERIT)
.start()
if (!process.waitFor(10, TimeUnit.SECONDS)) {