Skip to content

Instantly share code, notes, and snippets.

View imoutsatsos's full-sized avatar

Ioannis K. Moutsatsos imoutsatsos

  • Novartis (ioannis.moutsatsos@novartis.com)
  • Arlington, MA
  • X @ioannismou
View GitHub Profile
@imoutsatsos
imoutsatsos / JenkinsGetGlobalEnvVars.groovy
Last active August 31, 2021 18:38
Jenkins: Access Global variables
//tested with Jenkins v 2.222.1
import hudson.model.*
def hudson = hudson.model.Hudson.instance
def globalProps = hudson.globalNodeProperties
def props = globalProps.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class)
for (nodeproperty in props)
{
//println(nodeproperty.getEnvVars());
globalEnvVars=nodeproperty.getEnvVars()
}
@imoutsatsos
imoutsatsos / wip_renameJobParameter.groovy
Created April 7, 2020 00:03
WIP trying to rename Jenkins job parameters before copying to a target project
/*** BEGIN META {
"name" : "wip_renameJobParameter",
"comment" : "Assembles new job parameters from other jobs",
"parameters" : [ 'newJobNameString','appendModeBoolean','sourceDataJson'],
"core": "2.121",
"authors" : [
{ name : "Ioannis K. Moutsatsos" }
]
} END META**/
@imoutsatsos
imoutsatsos / MergeMapEntries_byKeyMatching.groovy
Created February 20, 2020 19:15
Merge map entries by key matching
/*
An example Groovy script on how to merge json/map entries
that match by one or more key-value criteria
The resulting merged entry has identical key-values for the matched criteria
and generates a list of comma separated values for the remaining criteria
*/
PLAN_ENTRIES="""
{
"planActions": [
{
@imoutsatsos
imoutsatsos / plateHeatMap_brushing.html
Created July 26, 2019 21:11
Expeiments with D3 brushing using an assay plate heat map
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<style>
rect.bordered {
stroke: #E6E6E6;
stroke-width:2px;
}
@imoutsatsos
imoutsatsos / tensorboard.pipeline
Created April 5, 2019 11:21
Example Jenkins pipeline for launching Tensorboard
pipeline
{
agent
{
node
{
label params.NodeLabel
// this whole construction is meant to select the node using its label 7g ry04 ry03
}
}
@imoutsatsos
imoutsatsos / JenkinsUpdateGlobalEnvVars.groovy
Created January 10, 2019 16:41
Add or Remove Global Variables to a Jenkins Instance
/*
we remove by key .remove(key)
The example below removes adds a new 'MY_TEST2' and remove 'MY_TEST'
*/
def hudson = hudson.model.Hudson.instance
def globalProps = hudson.globalNodeProperties
def props = globalProps.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class)
// println hudson.model.Hudson.instance.globalNodeProperties
@imoutsatsos
imoutsatsos / getImageFromIIIFserver.py
Last active October 19, 2018 13:39
Python code to retrieve an image from a iiif endpoint
from PIL import Image
import urllib2
#your proxy may be http ot https, try both
proxy = urllib2.ProxyHandler({'https': 'proxyserver:port'})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
iiifURI='http://yourServer:8182/iiif/2/%2F%2Fimage%2Fidentifier.tif/full/full/0/default.jpg'
imageFile = urllib2.urlopen(iiifURI)
img= Image.open(imageFile)
img
@imoutsatsos
imoutsatsos / copyServerStaticArtifact.groovy
Created October 10, 2018 14:55
Jenkins Scriptlet: Copies an artifact to a folder in the executing job's WORKSPACE
/*** BEGIN META {
"name" : "copyServerStaticArtifact",
"comment" : "Copies an artifact from a folder (typically in JENKINS_HOME) to a folder in the executing job's WORKSPACE",
"parameters" : [ 'artifactFilter','contentFolder','targetFolder'],
"core": "2.100",
"authors" : [
{ name : "Ioannis K. Moutsatsos" }
]
} END META**/
@imoutsatsos
imoutsatsos / imageGalleryFromTemplate.groovy
Created October 10, 2018 14:45
Jenkins scriptlet: Generates parametrized HTML from a image grid OpenSeadragon template
/*** BEGIN META {
"name" : "imageGalleryFromtemplate",
"comment" : "Generate parametrized HTML from a image grid Openseadragon template",
"parameters" : [ 'vTemplateURLPath','vOutfolder','vIMAGELIST_URL','vIMAGE_OBJECTS','vTEST_IMAGES','vIMAGE_GALLERY','vPRIMARY_IMAGE_LIST','vJOB_PATH','vIMAGE_ADJUSTMENTS','vBUILD_LABEL'],
"core": "1.596",
"authors" : [
{ name : "Ioannis K. Moutsatsos" }
]
} END META**/
@imoutsatsos
imoutsatsos / imageGallery.jst
Created October 10, 2018 14:24
A template for generating JavaScript in a Jenkins Active Choices Reactive Reference
/*
Template text made into javascript after Groovy Processing
functions supporting loading, layout, Colorization and
adjustments/filtering of image sets into Openseadragon iiif viewer
Supports channel overlay with opacity controls
@author: Ioannis K. Moutsatsos
@lastUpdate: FEB-27-2018
*/