Skip to content

Instantly share code, notes, and snippets.

View dbt4u's full-sized avatar

Detlef Burkhardt dbt4u

View GitHub Profile
@dbt4u
dbt4u / Check Cluster Health
Last active November 29, 2018 10:50
ELK Snippets
GET _cluster/health?pretty=true
@dbt4u
dbt4u / printinit.groovy
Created April 4, 2018 12:53
List the content of init.groovy.d in Jenkins
println "ls -la var/jenkins_home/init.groovy.d".execute().text
@dbt4u
dbt4u / execute.groovy
Created April 4, 2018 11:42
Jenkins: Execute a shell command
println "ls -a".execute().text
@dbt4u
dbt4u / printenv.groovy
Created April 4, 2018 11:40
Jenkins Groovy to print all env-variables
def env = System.getenv()
env.each{
println it
}
@dbt4u
dbt4u / getToolsOnAllSlaves.groovy
Created April 4, 2018 11:23
Jenkins Script to get all tools on all slaves
import hudson.model.*
import hudson.node_monitors.*
import hudson.slaves.*
import java.util.concurrent.*
import hudson.tools.ToolDescriptor;
import hudson.tools.ToolInstallation;
jenkins = Hudson.instance
TaskListener log;
@dbt4u
dbt4u / slurpjson.groovy
Created March 27, 2018 22:39
Basic JSON Slurper
import groovy.json.*
import groovy.text.*
def restResponse = new File("attributes.json") //later via Rest-Call .parse(URI)
def js = """${restResponse.text}"""
def data = new JsonSlurper().parseText(js)
def totalCount = data.size
data.each {
@dbt4u
dbt4u / formatnmbr.go
Created March 22, 2018 21:33
Simple formater and converter Int64 into String with 1000er Separator
func format(n int64) string {
in := strconv.FormatInt(n, 10)
out := make([]byte, len(in)+(len(in)-2+int(in[0]/'0'))/3)
if in[0] == '-' {
in, out[0] = in[1:], '-'
}
for i, j, k := len(in)-1, len(out)-1, 0; ; i, j = i-1, j-1 {
out[j] = in[i]
if i == 0 {
@dbt4u
dbt4u / list-all-yamls.groovy
Created March 14, 2018 19:02
Simply list all yamls recursive inside one directory
new File("d:\\svn").eachDirRecurse() { dir ->
dir.eachFileMatch(~/.*.yml/) { file ->
println file.getPath()
}
}
@dbt4u
dbt4u / emojis.json
Created January 5, 2018 23:35 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘§", "name": "family_mothers_two_girls", "shortname": "", "unicode": "", "html": "👩‍👩‍👧‍👧", "category": "p", "order": ""},
{"emoji": "πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦", "name": "family_mothers_children", "shortname": "", "unicode": "", "html": "👩‍👩‍👧‍👦", "category": "p", "order": ""},
{"emoji": "πŸ‘©β€πŸ‘©β€πŸ‘¦β€πŸ‘¦", "name": "family_mothers_two_boys", "shortname": "", "unicode": "", "html": "👩‍👩‍👦‍👦", "category": "p", "order": ""},
{"emoji": "πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘§", "name": "family_two_girls", "shortname": "", "unicode": "", "html": "👨‍👩‍👧‍👧", "category": "p", "order": ""},
{"emoji": "πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦", "name": "family_children", "shortname": "", "unicode": "", "html": "👨‍👩‍👧‍👦", "category": "p", "order": ""},
{"emoji": "πŸ‘¨β€πŸ‘©β€πŸ‘¦β€πŸ‘¦", "name": "family_two_boys", "shortname": "", "unicode": "", "html": "👨&zw