Skip to content

Instantly share code, notes, and snippets.

View kmcquade's full-sized avatar

Kinnaird McQuade kmcquade

View GitHub Profile
@kmcquade
kmcquade / .gitignore
Created January 29, 2019 16:35
.gitignore for my Infrastructure as Code repos
##### Working directories #####
tmp
_notes
##### Technologies #####
#### Terraform
# Local .terraform directories
**/.terraform/*
*.plan
@kmcquade
kmcquade / copy-ssm-parameters
Created February 28, 2019 23:46 — forked from mvanholsteijn/copy-ssm-parameters
script to copy all SSM parameter store parameters to disk
#!/usr/bin/env python
#
# copy all SSM parameter store parameters to disk
#
import os, sys, argparse, boto3
parser = argparse.ArgumentParser(description='copy all parameter values to local')
parser.add_argument("--path", dest="path", required=True,
help="to copy the keys from", metavar="STRING")
parser.add_argument("--directory", dest="directory", required=True,
@kmcquade
kmcquade / Makefile
Created March 9, 2019 01:02 — forked from mpneuried/Makefile
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)
@kmcquade
kmcquade / gist:6e3fdb7bfe43a56b9868fa96566ad6c3
Last active March 17, 2019 18:08 — forked from Ray33/gist:ba189a729d81babc99d7cef0fb6fbcd8
Amazon Elastic Network Adapter (ENA) on CentOS 7
sudo su
yum --enablerepo=extras install epel-release
yum -y install patch dkms kernel-devel perl
yum update
reboot
sudo su
@kmcquade
kmcquade / jenkins-decrypt.md
Last active March 20, 2019 19:20 — forked from tuxfight3r/jenkins-decrypt.groovy
Decrypting Jenkins Password

To Decrypt Jenkins Passwords

  1. Go to the "Configure System" screen.
  2. Right click on a password field, Inspect element, then change to "text" instead of "password".
  3. Copy that field and then go to the Script Console. Paste the below into the field, replace with your encrypted password, and then hit "run".
encrypted_pw = '{your_encrypted_password_with_brackets_around_it}'
passwd = hudson.util.Secret.decrypt(encrypted_pw)
println(passwd)
@kmcquade
kmcquade / 0.12.tf
Created May 27, 2019 19:25 — forked from tuannvm/0.12.tf
#terraform #hashicorp #cheatsheet #0.12
# first class expresssion
variable "ami" {}
resource "aws_instance" "example" {
ami = var.ami
}
###
# list & map
resource "aws_instance" "example" {
@kmcquade
kmcquade / keep-jenkins-plugins-uptodate.groovy
Created May 27, 2019 22:44 — forked from alecharp/keep-jenkins-plugins-uptodate.groovy
Simple groovy script to upgrade active plugins when new versions are available
jenkins.model.Jenkins.getInstance().getUpdateCenter().getSites().each { site ->
site.updateDirectlyNow(hudson.model.DownloadService.signatureCheck)
}
hudson.model.DownloadService.Downloadable.all().each { downloadable ->
downloadable.updateNow();
}
def plugins = jenkins.model.Jenkins.instance.pluginManager.activePlugins.findAll {
it -> it.hasUpdate()
@kmcquade
kmcquade / jenkins-list-pending-script-approvals.groovy
Created May 29, 2019 17:15
List pending script approvals in Jenkins
import org.jenkinsci.plugins.scriptsecurity.scripts.*
ScriptApproval sa = ScriptApproval.get();
//list pending approvals
for (ScriptApproval.PendingScript pending : sa.getPendingScripts()) {
println "Pending Approved : " + pending.script
}
//list pending signatures
for (ScriptApproval.PendingSignature pending : sa.getPendingSignatures()) {
println "Pending Signature : " + pending.signature
@kmcquade
kmcquade / remove_plugins.sh
Last active May 29, 2019 17:39
Remove plugins from pre-baked Jenkins docker image
#!/usr/bin/env bash
set -x
#JENKINS_PLUGINS_PATH="${JENKINS_PLUGINS_PATH:-/usr/share/jenkins/ref/plugins}"
JENKINS_PLUGINS_PATH="${JENKINS_PLUGINS_PATH:-/usr/share/jenkins/ref/plugins}"
REMOVE_PLUGINS_LIST_PATH="${REMOVE_PLUGINS_LIST_PATH:-/usr/share/jenkins/ref/remove_plugins_list.txt}"
echo $JENKINS_PLUGINS_PATH
echo $REMOVE_PLUGINS_LIST_PATH
for line in `cat ${REMOVE_PLUGINS_LIST_PATH}`
@kmcquade
kmcquade / remove-useless-log-messages.sh
Last active May 29, 2019 17:44
Filter out useless messages using rsyslog
#!/usr/bin/env bash
set -x
cat <<EOF > /etc/rsyslog.d/01_filters.conf
if \$programname == 'systemd' and \$msg contains "Started Session" then stop
if \$programname == 'systemd' and \$msg contains "Starting Session" then stop
if \$programname == 'systemd' and \$msg contains "Created slice" then stop
if \$programname == 'systemd' and \$msg contains "Starting user-" then stop
if \$programname == 'systemd' and \$msg contains "Stopping user-" then stop