Skip to content

Instantly share code, notes, and snippets.

@timja
timja / jenkins-dump-credentials.groovy
Last active May 16, 2024 16:46
Dump jenkins credentials - use in script console
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import org.jenkinsci.plugins.plaincredentials.impl.*
// def item = Jenkins.instance.getItem("your-folder")
@nqbao
nqbao / ssm_parameter_store.py
Last active March 21, 2024 00:15
Python class to provide a dictionary-like interface to access AWS SSM Parameter Store easily
# Copyright (c) 2018 Bao Nguyen <b@nqbao.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
@odavid
odavid / Jenkins-delete-lockable-resources
Created September 14, 2017 15:55
A short script to delete free locks from the lockable resources plugin
def manager = org.jenkins.plugins.lockableresources.LockableResourcesManager.get()
def resources = manager.getResources().findAll{
!it.locked
}
resources.each{
manager.getResources().remove(it)
}
manager.save()
@anderssonjohan
anderssonjohan / setup-volume.ps1
Created September 13, 2017 18:13
user data script to initialize, partition and format ebs volume /dev/xvd[drive letter]
function setup-volume {
param(
[parameter(mandatory=$true,helpmessage="drive letter")]
[string] $driveletter,
[parameter(mandatory=$false,helpmessage="file system label")]
[string] $label = ""
)
$driveletter = $driveletter.ToLower()
@troyfontaine
troyfontaine / 1-setup.md
Last active May 12, 2024 15:17
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@dfevre
dfevre / aws_env
Last active March 4, 2019 21:32 — forked from mjul/aws_env
Get environment variables from AWS profile (for use with docker-machine)
# The following is a ~/.zshrc function that exports an aws cli profile from ~/.aws/credentials to environment variables.
aws_env() {
export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id --profile "$1");
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key --profile "$1");
export AWS_SESSION_TOKEN=$(aws configure get aws_session_token --profile "$1");
export AWS_SECURITY_TOKEN=$(aws configure get aws_security_token --profile "$1");
export AWS_DEFAULT_REGION=$(aws configure get region --profile "$1");
echo "$1 environment variables exported";
}
@visitbethel
visitbethel / Jenkins Pipeline Input Dropdown
Created February 2, 2017 17:58
Jenkins Pipeline Input Dropdown
// Change `url` value to your own
def inputParams=new URL('http://maven.com/sefs/sefs-scm.txt').text
// Change `message` value to the message you want to display
// Change `description` value to the description you want
def selectedProperty = input( id: 'userInput', message: 'Choose properties file',
parameters: [ [
$class: 'ChoiceParameterDefinition',
choices: inputParams,
description: 'Properties',
@mpneuried
mpneuried / Makefile
Last active May 4, 2024 13:46
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@james-huston
james-huston / aws-assume-role.sh
Last active April 28, 2017 14:25
Assume role using the AWS cli and add creds to a profile for use in other commands.
#!/bin/bash
ROLE_ARN="$1"
AWS_PROFILE="$2"
ROLE_JSON="$(aws sts assume-role --role-arn ${ROLE_ARN} --role-session-name ${AWS_PROFILE}-deploy)"
SECRETKEYREGEX='"SecretAccessKey": "([^"]*)"'
ACCESSKEYREGEX='"AccessKeyId": "([^"]*)"'
TOKENREGEX='"SessionToken": "([^"]*)"'
@bmhatfield
bmhatfield / .profile
Last active May 6, 2024 22:27
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else