Skip to content

Instantly share code, notes, and snippets.

View YiannisDermitzakis's full-sized avatar

Yiannis Dermitzakis YiannisDermitzakis

View GitHub Profile
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active March 6, 2024 18:14
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@abayer
abayer / jenkins-git-backup.sh
Last active January 8, 2023 09:19
Example of a script for backing up Jenkins config in git.
#!/bin/bash
#
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
#
set -ex
if [ $# -ne 2 ]; then
echo usage: $0 root_dir jenkins_master
@Alcar32
Alcar32 / example-pom.xml
Created July 30, 2013 13:27
[HowTo] | [Java Service Wrapper],[Maven] How to configure a maven project as a (system) service, by using the java service wrapper maven plugin.
<build>
<resources>
<resource>
<!-- define a folder 'etc' where the resource files a stored -->
<targetPath>../daemon/appassembler/jsw/parameterdb-daemon/etc</targetPath>
<directory>${project.basedir}/src/main/resources/</directory>
<includes>
<include>**/*.xls</include>
<include>**/*.xml</include>
<include>**/*.properties</include>
@darkliquid
darkliquid / beautified.js
Last active August 22, 2019 02:28
Bookmarklet to estimate reading time of a page
javascript:(function () {
function getTextNodesIn(element) {
var wordcount = 0,
whitespace = /^\s*$/;
function getTextNode(node) {
// type 3 is a textnode
if (node.nodeType == 3) {
// We skip text nodes that are only whitespace
if (!whitespace.test(node.nodeValue)) {