Skip to content

Instantly share code, notes, and snippets.

@jamesdh
jamesdh / JenkinsSlaveCleaner.groovy
Last active Oct 9, 2017
Groovy script for cleaning up ghost workspaces left on slaves after a job has been deleted. Must be run strictly on the master instance.
View JenkinsSlaveCleaner.groovy
import hudson.FilePath;
// Initialize dryRun parameter to TRUE if not given as script parameter
dryRun = false;
if( dryRun == true ) {
println "** Execute a dryRun - no files will ever be deleted **";
}
// shortcut to Jenkins instance
@phette23
phette23 / current-dir-in-iterm-tab-title.sh
Last active Sep 7, 2021
Set the iTerm tab title to the current directory, not full path.
View current-dir-in-iterm-tab-title.sh
# put this in your .bash_profile
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
# Piece-by-Piece Explanation:
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too
# the $PROMPT_COMMAND environment variable is executed every time a command is run
# see: ss64.com/bash/syntax-prompt.html