Skip to content

Instantly share code, notes, and snippets.

Avatar

Kinnaird McQuade kmcquade

View GitHub Profile
View install-firing-range.sh
#!/bin/bash
# Clone the Firing Range Repository
git clone https://github.com/google/firing-range.git
# Change to 'firing-range' directory
cd firing-range
# Download the AppEngine SDK
wget https://storage.googleapis.com/appengine-sdks/featured/appengine-java-sdk-1.9.23.zip
@kmcquade
kmcquade / parse_arn.py
Created Aug 3, 2019 — forked from gene1wood/parse_arn.py
Parse an AWS ARN (Amazon Resource Name) into it's constituent elements
View parse_arn.py
def parse_arn(arn):
# http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
elements = arn.split(':')
result = {'arn': elements[0],
'partition': elements[1],
'service': elements[2],
'region': elements[3],
'account': elements[4]
}
if len(elements) == 7:
View virtualenv-auto-activate.sh
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv .venv", so your project folder
# has a .venv folder at the top level, next to your version control directory.
@kmcquade
kmcquade / packer-ami-id
Created Jun 19, 2019 — forked from danrigsby/packer-ami-id
Get AMI ID from a packer build
View packer-ami-id
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@kmcquade
kmcquade / keep-jenkins-plugins-uptodate.groovy
Created May 27, 2019 — forked from alecharp/keep-jenkins-plugins-uptodate.groovy
Simple groovy script to upgrade active plugins when new versions are available
View keep-jenkins-plugins-uptodate.groovy
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 / 0.12.tf
Created May 27, 2019 — forked from tuannvm/0.12.tf
#terraform #hashicorp #cheatsheet #0.12
View 0.12.tf
# first class expresssion
variable "ami" {}
resource "aws_instance" "example" {
ami = var.ami
}
###
# list & map
resource "aws_instance" "example" {
@kmcquade
kmcquade / systemd_service_hardening.md
Created Apr 29, 2019 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units
View systemd_service_hardening.md

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
ProtectHome=read-only
ProtectControlGroups=yes
ProtectKernelModules=yes
@kmcquade
kmcquade / gist:6e3fdb7bfe43a56b9868fa96566ad6c3
Last active Mar 17, 2019 — forked from Ray33/gist:ba189a729d81babc99d7cef0fb6fbcd8
Amazon Elastic Network Adapter (ENA) on CentOS 7
View gist:6e3fdb7bfe43a56b9868fa96566ad6c3
sudo su
yum --enablerepo=extras install epel-release
yum -y install patch dkms kernel-devel perl
yum update
reboot
sudo su
@kmcquade
kmcquade / Makefile
Created Mar 9, 2019 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
View Makefile
# 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 / jenkins-decrypt.md
Last active Mar 20, 2019 — forked from tuxfight3r/jenkins-decrypt.groovy
Decrypting Jenkins Password
View jenkins-decrypt.md

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)