Skip to content

Instantly share code, notes, and snippets.

@oifland
oifland / Jenkinsfile
Last active July 15, 2024 06:36
Loops in Jenkinsfiles
// Related to https://issues.jenkins-ci.org/browse/JENKINS-26481
abcs = ['a', 'b', 'c']
node('master') {
stage('Test 1: loop of echo statements') {
echo_all(abcs)
}
stage('Test 2: loop of sh commands') {
@wheelerlaw
wheelerlaw / elevate.sh
Last active September 29, 2023 16:22
Running elevated commands from a non-elevated git-bash with the ability to pipe/redirect the output of the elevated command.
#!/usr/bin/env bash
elevate() {
powershell -Command "Start-Process cmd -ArgumentList \"/c\",\"$1 2>&1 | clip\" -Verb RunAs"
powershell -sta "add-type -as System.Windows.Forms; [windows.forms.clipboard]::GetText()"
}
@akisys
akisys / azure-bastion-connect.sh
Created May 11, 2023 16:04
Use Azure Bastion with ssh-user-config blocks
#!/usr/bin/env bash
set -fu
destination="${1:-""}"
port="${2:-"8122"}"
timeout="${3:-""}" # this will auto-terminate the azure bastion tunnel after this many seconds
azure_bastion_opts=""