Skip to content

Instantly share code, notes, and snippets.

View TheTechOddBug's full-sized avatar

thetechoddbug (José María Gutiérrez) TheTechOddBug

View GitHub Profile
@TheTechOddBug
TheTechOddBug / README.md
Created April 10, 2024 17:30 — forked from mllrjb/README.md
Jenkins init.groovy.d role-based authorization strategy

Usage

Set a system environment variable AUTHZ_JSON_URL that points to a JSON file with the following structure:

{
  "admins": [
    "groupA", 
    "userA"
 ],
@TheTechOddBug
TheTechOddBug / groovy-create-user.md
Created April 10, 2024 17:29 — forked from hayderimran7/groovy-create-user.md
Jenkins Groovy enable security and create a user in groovy script

This is a snippet that will create a new user in jenkins and if security has been disabled , it will enable it :)

import jenkins.model.*
import hudson.security.*

def instance = Jenkins.getInstance()

def hudsonRealm = new HudsonPrivateSecurityRealm(false)
hudsonRealm.createAccount("MyUSERNAME","MyPASSWORD")
instance.setSecurityRealm(hudsonRealm)
@TheTechOddBug
TheTechOddBug / gourcevideo.sh
Created November 20, 2023 01:14 — forked from Gnzlt/gourcevideo.sh
Gource video export command
#!/bin/bash
gource \
-s .03 \
-1280x720 \
--auto-skip-seconds .1 \
--multi-sampling \
--stop-at-end \
--key \
--highlight-users \
@TheTechOddBug
TheTechOddBug / Jenkinsfile
Created June 29, 2022 16:00 — forked from flmu/Jenkinsfile
Jenkinsfile that creates dynamically stages from a list
def jobs = ["JobA", "JobB", "JobC"]
def parallelStagesMap = jobs.collectEntries {
["${it}" : generateStage(it)]
}
def generateStage(job) {
return {
stage("stage: ${job}") {
echo "This is ${job}."
@TheTechOddBug
TheTechOddBug / git-branches-by-commit-date.sh
Created June 22, 2022 17:37 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r