Skip to content

Instantly share code, notes, and snippets.


Sean Flanigan seanf

View GitHub Profile
seanf / JenkinsSlaveWorkspaceCleanup.groovy
Last active Aug 29, 2015
Jenkins Slave Workspace Cleanup by Bertrand Renuart:
View JenkinsSlaveWorkspaceCleanup.groovy
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 / settings.xml
Created Jul 26, 2011
Sample of ~/.m2/settings.xml for deployment to Zanata Cloudbees repo
View settings.xml
<settings xmlns=""
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
echo -e "Fetching merged branches...\n"
git remote update --prune
remote_branches=$(git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$")
View 81-thinkpad-dock.rules
# save as /etc/udev/rules.d/81-thinkpad-dock.rules
KERNEL=="dock.0", ACTION=="change", RUN+="/usr/local/sbin/"
seanf / git-pr
Last active Dec 19, 2015
Push current branch to github, enable tracking and open the pull request page
View git-pr
this_branch=$(git rev-parse --abbrev-ref HEAD)
read -p "Push branch \"$this_branch\" to github, enable tracking, and open pull request page (y/n)? " -n 1 -r choice
if [[ $choice =~ ^[Yy]$ ]]; then
git push -u origin $this_branch
xdg-open ${github_project}/compare/${base_branch}...${this_branch}
seanf / grapeConfig.xml
Created Aug 28, 2013
~/.groovy/grapeConfig.xml for Zanata development
View grapeConfig.xml
<?xml version="1.0"?>
<settings defaultResolver="downloadGrapes"/>
<chain name="downloadGrapes">
<!-- todo add 'endorsed groovy extensions' resolver here -->
<ibiblio name="local" root="file:${user.home}/.m2/repository/" m2compatible="true"/>
<filesystem name="cachedGrapes">
<ivy pattern="${user.home}/.groovy/grapes/[organisation]/[module]/ivy-[revision].xml"/>
<artifact pattern="${user.home}/.groovy/grapes/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
seanf / testargs4j.groovy
Last active Dec 21, 2015
args4j test in Groovy
View testargs4j.groovy
@Grab(group='args4j', module='args4j', version='2.0.25')
import org.kohsuke.args4j.*
import org.kohsuke.args4j.spi.*
import static org.kohsuke.args4j.ExampleMode.ALL
public class Sample {
private boolean recursive
// @Option(name="-r", usage="Recursive", handler=BooleanOptionHandler.class)
seanf / fixspace
Created Oct 1, 2013
Remove whitespace errors
View fixspace
# Remove trailing whitespace per line
sed -i 's/[ \t]*$//' "$@"
# Delete all trailing blank lines at end of file (only).
sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' "$@"
seanf / remove-zanata-host-specifics.sql
Created Nov 11, 2013
Scrubs host-specific server settings from a Zanata database
View remove-zanata-host-specifics.sql
DELETE FROM HApplicationConfiguration WHERE config_key LIKE 'host.url';
DELETE FROM HApplicationConfiguration WHERE config_key LIKE 'piwik%';
DELETE FROM HApplicationConfiguration WHERE config_key LIKE '';
DELETE FROM HApplicationConfiguration WHERE config_key LIKE '';
seanf / settings.xml
Created Jan 17, 2014
~/.m2/settings.xml with Checkstyle/FindBugs exclusions for Zanata - this allows you to edit exclusions on your local machine
View settings.xml
<settings xmlns=""
You can’t perform that action at this time.