Skip to content

Instantly share code, notes, and snippets.

View renan-alm's full-sized avatar

Renan Alm renan-alm

View GitHub Profile
@renan-alm
renan-alm / ghappp_pem2token.sh
Last active October 24, 2024 07:06
Bash script to create a short lived token from a GitHub App PEM file
#!/bin/bash
# What happens here?
# Build the JWT structure
# Call GH API using the JWT returning the token
# get a temporary jwt token from the key file and app id (hardcoded in the file:)
generated_jwt=$(./github-app-jwt.sh)
github_api_url="https://api.github.com/app"
@renan-alm
renan-alm / get-jenkins-creds.groovy
Last active August 19, 2024 06:20
Gist to get all credentials from a Jenkins instance
// Source: https://stackoverflow.com/questions/34795050/how-do-i-list-all-of-my-jenkins-credentials-in-the-script-console
// To be used at a jenkins_instance_url/script, example https://jenkins.corp.net/script
import java.nio.charset.StandardCharsets;
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.Credentials.class
)
for (c in creds) {
println(c.id)