Skip to content

Instantly share code, notes, and snippets.

View grv87's full-sized avatar
🏠
Working from home

Basil Peace grv87

🏠
Working from home
View GitHub Profile
@docwhat
docwhat / Jenkinsfile
Last active December 16, 2023 13:53
Example pipeline usage of the Jenkins Mask Passwords plugin
// Requires https://plugins.jenkins.io/mask-passwords to run
/**
* Runs code with secret environment variables and hides the values.
*
* @param varAndPasswordList - A list of Maps with a 'var' and 'password' key. Example: `[[var: 'TOKEN', password: 'sekret']]`
* @param Closure - The code to run in
* @return {void}
*/
def withSecretEnv(List<Map> varAndPasswordList, Closure closure) {
1. Setup a project
2. Add groovy SDK support:
https://www.bonusbits.com/wiki/HowTo:Add_Groovy_SDK_to_IntelliJ_IDEA
3. Download http://(yourjenkinsurl)/job/(yourpipelinejob)/pipeline-syntax/gdsl
- this will give you the .gdsl file - download this to the src folder of your project.
4. Finally follow this step - right click on the src folder -> Mark directory as -> Sources Root
@jglick
jglick / JENKINS-41745-proposal.md
Last active August 22, 2017 18:22
Proposal for JENKINS-41745: Remoting-free CLI

Summary

JENKINS-41745: Deprecate the Remoting-based protocol for the Jenkins CLI feature. Enhance the client and server to conveniently perform most existing CLI tasks with simpler and safer protocols.

Goals

@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"
@dialt0ne
dialt0ne / get_aws_dns_ip.sh
Created December 17, 2015 22:44
Get AmazonProvidedDNS IP address from the EC2 meta-data
MAC_ADDR=`curl -s http://169.254.169.254/latest/meta-data/mac`
CIDR_FULL=`curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDR}/vpc-ipv4-cidr-block`
CIDR_BASE=`echo ${CIDR_FULL} | cut -d/ -f1 | cut -d\. -f1-3`
LAST_OCTET=`echo ${CIDR_FULL} | cut -d/ -f1 | cut -d\. -f4`
DNS_OCTET=`expr ${LAST_OCTET} + 2`
DNS_IP="${CIDR_BASE}.${DNS_OCTET}"
echo $DNS_IP
// a gulp task to clean up vendor folder files for production machine.
var gulp = require('gulp');
var zip = require('gulp-zip');
gulp.task('zip-vendor', function () {
return gulp.src(
[
'vendor/**/*',
@max-mapper
max-mapper / 0.md
Last active February 25, 2024 12:24
JS hoisting by example

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)

@asabaylus
asabaylus / gist:3071099
Created July 8, 2012 14:12
Github Markdown Heading Anchors

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

@epicserve
epicserve / svn_to_git.rst
Created September 15, 2011 17:17
Convert SVN Repositories to Git Repositories

Convert SVN Repositories to Git Repositories

This guide on how to convert an SVN repository to a git repository was mostly taken from John Albin Wilkins post on Converting a Subversion repository to Git.

1. Retrieve a list of all Subversion committers

: