Skip to content

Instantly share code, notes, and snippets.

geerlingguy /
Last active Jun 9, 2021
Ansible Role Test Shim Script
# Ansible role test shim.
# Usage: [OPTIONS] ./tests/
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_dir: the directory where the role exists (default = $PWD)
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
arsdehnel /
Last active May 31, 2021
AWS IAM policies for running Terraform from an EC2 instance.
resource "aws_iam_policy" "terraform_create_policy" {
name = "terraform_create_policy"
path = "/"
policy = "${data.aws_iam_policy_document.terraform_create_policy.json}"
data "aws_iam_policy_document" "terraform_create_policy" {
statement {
sid = "1"
actions = [
blaisep /
Created Oct 20, 2016
Insert git credentials into Jenkins Pipeline Script projects

Suppose you want to inject a credential into a Pipeline script. The cloudbees note does not include Pipeline script examples.

The Jenkins Pipeline Docs' description of the git pushmethod doesn't have an example using injected credentials. (

The Snippet generator is helpful, but not not if you try to follow the instructions at:

mpneuried / Makefile
Last active Jul 22, 2021
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)
wojteklu /
Last active Jul 23, 2021
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

leonardofed /
Last active Jul 24, 2021
A curated list of AWS resources to prepare for the AWS Certifications

A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

noelboss /
Last active Jul 22, 2021
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like or and pull or export it to a production server. Or you use a service like to act upon a Web-Hook that's triggered that service.

ryan0x44 /
Created Nov 19, 2015
Blue-Green AWS Auto Scaling Deployments with Terraform

A quick note on how I'm currently handling Blue/Green or A/B deployments with Terraform and AWS EC2 Auto Scaling.

In my particular use case, I want to be able to inspect an AMI deployment manually before disabling the previous deployment.

Hopefully someone finds this useful, and if you have and feedback please leave a comment or email me.


I build my AMI's using Packer and Ansible.

maxim / gh-dl-release
Last active Jul 23, 2021
Download assets from private Github releases
View gh-dl-release
#!/usr/bin/env bash
# gh-dl-release! It works!
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
sivel /
Last active Jul 13, 2021
Better SSH Authorized Keys Management

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server: