This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste this JavaScript into the JS console of your Jenkins build page | |
// eg https://jenkins.example.com/jenkins/job/MyJob/main/lastSuccessfulBuild/ | |
// to see the slowest (non-paused) steps in your pipeline. | |
// | |
// Warning: this may not work for large jobs, or parallel steps. | |
// Ref: https://issues.jenkins.io/browse/JENKINS-52394 | |
// | |
// This requires https://plugins.jenkins.io/pipeline-rest-api/ | |
// (for https://github.com/jenkinsci/pipeline-stage-view-plugin/blob/master/rest-api/README.md#pipeline-rest-api-plugin) | |
const NUMBER_OF_CULPRITS = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.script.ScriptEngineManager; | |
def fs = new ScriptEngineManager().getEngineFactories() | |
fs.forEach{ | |
println "Script Engine: " + it.engineName | |
println "Names: " + it.names | |
println() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
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." | |
fi | |
echo -e "Fetching merged branches...\n" | |
git remote update --prune | |
remote_branches=$(git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env groovy | |
/* | |
* zanata-table-fix-case.groovy | |
* | |
* Unix filter script to convert lower case Zanata table names back to their original (title) case in an SQL backup | |
* | |
* Usage: zcat zanata_backup.sql.gz | zanata-tables-fix-case.groovy | gzip -c > zanata_backup.casefixed.sql.gz | |
* | |
* Version 3 | |
* Date: 7 Nov 2013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 **"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install jc jq | |
cat ~/.gitconfig | jc --ini | jq -r '."team \"alias\"" | to_entries[] | .value' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String describe(Object obj) { | |
return obj.getClass().getSimpleName() + '@' + System.identityHashCode(obj); | |
} |
NewerOlder