Skip to content

Instantly share code, notes, and snippets.

View kmcquade's full-sized avatar

Kinnaird McQuade kmcquade

View GitHub Profile
@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 / packer-ami-id
Created June 19, 2019 21:31 — forked from danrigsby/packer-ami-id
Get AMI ID from a packer build
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
#!/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 / parse_arn.py
Created August 3, 2019 20:05 — forked from gene1wood/parse_arn.py
Parse an AWS ARN (Amazon Resource Name) into it's constituent elements
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:
@kmcquade
kmcquade / systemd_service_hardening.md
Created April 29, 2019 17:37 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

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
#!/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 / ldbdump.py
Created November 6, 2022 20:23 — forked from mkorthof/ldbdump.py
ldbdump - dumps LevelDB keys/values
#!/usr/bin/python3
# ldbdump - dumps LevelDB keys/values
#
# a LevelDB is a dir with files such a these:
# 000050.ldb 000100.log CURRENT LOCK LOG MANIFEST-000099
#
# sources: https://github.com/tos-kamiya/levelobjdb dump()
import os