Skip to content

Instantly share code, notes, and snippets.

View J00MZ's full-sized avatar
🍋
Snicket

Joe Tavin J00MZ

🍋
Snicket
View GitHub Profile
@J00MZ
J00MZ / dynamo_global_variable.md
Last active May 4, 2019 22:05
Use DynamoDB item to manage Global Flag variable

Objective

Use DynamoDB to have a centralized location flag variable that can be accessed from multiple EC2 instances

Steps

  1. Create DynamoDB table, call it GlobalVariable.
  2. Primary key: name = id, type = number
  3. Sort key field: name = flag, type = String
  4. Add item to table using your value with key id # - example below uses 42.
@J00MZ
J00MZ / jenkinsfile
Created January 29, 2019 16:32
Jenkinsfile wait example
stage ('Copy jar to cluster') {
steps {
script {
node ('AWS_AGENT') {
the_env = "${env.Environment}".toLowerCase()
attempt = 0
if (the_env == 'prd'){
// set wait before copy for maximum 20 minutes
max_attempts = 20
}
@J00MZ
J00MZ / jenkins_run.sh
Created February 3, 2019 18:40
Jenkins as Docker image
# Variables
HOST_PATH="/data/jenkins_master"
CONTAINER_PATH="/var/jenkins_home"
JENKINS_DOCKER_IMAGE="jenkins/jenkins"
HTTP_PORT="-1" # disables http
JNLP_PORT="50000"
SSL_PORT="443"
CONT_HTTPS_PORT="8443"
SSH_SERVER_PORT="43387"
KEY_STORE="/var/jenkins_home/.keystore/cacerts.jks"
provider "spotinst" {
token = "${var.spotinst_token}"
account = "${var.spotinst_account}"
}
resource "spotinst_elastigroup_azure" "qa_mlb_runtime" {
name = "qa_mlb_runtime"
resource_group_name = "DevQA-RG"
region = "northeurope"
product = "Linux"
@J00MZ
J00MZ / crash.log
Created March 12, 2019 17:00
packer crash.log
2019/03/12 16:31:41 [INFO] Packer version: 1.3.5
2019/03/12 16:31:41 Packer Target OS/Arch: linux amd64
2019/03/12 16:31:41 Built with Go Version: go1.12
2019/03/12 16:31:41 Detected home directory from env var: /home/ubuntu
2019/03/12 16:31:41 Using internal plugin for cloudstack
2019/03/12 16:31:41 Using internal plugin for hyperv-vmcx
2019/03/12 16:31:41 Using internal plugin for parallels-pvm
2019/03/12 16:31:41 Using internal plugin for profitbricks
2019/03/12 16:31:41 Using internal plugin for amazon-instance
2019/03/12 16:31:41 Using internal plugin for azure-arm
@J00MZ
J00MZ / packer.json
Created March 12, 2019 17:08
packer.json crash
{
"variables": {
"azure_client_secret": "{{env `AZURE_CLIENT_SECRET`}}",
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
"datadog_api_key": "{{env `DATADOG_API_KEY`}}"
},
"builders": [
{
@J00MZ
J00MZ / azure.json
Created March 12, 2019 17:15
azure.json crash
{
"resource_group_name": "MY-RG",
"subscription_id": "00000000-0000-0000-0000-000000000000",
"client_id": "00000000-0000-0000-0000-000000000000",
"tenant_id": "00000000-0000-0000-0000-000000000000",
"object_id": "00000000-0000-0000-0000-000000000000"
}
@J00MZ
J00MZ / main.tf
Last active May 12, 2019 16:17
Resolve terraform list items by key
resource "aws_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
}
resource "aws_vpn_gateway" "vpn_gateway" {
vpc_id = "${aws_vpc.vpc.id}"
}
resource "aws_customer_gateway" "customer_gateway" {
count = "${length(var.vpn_resources)}"
@J00MZ
J00MZ / crash.log
Created May 28, 2019 15:06
terraform 0.12 crash
This file has been truncated, but you can view the full file.
2019/05/28 17:51:31 [INFO] Terraform version: 0.12.0
2019/05/28 17:51:31 [INFO] Go runtime version: go1.12.4
2019/05/28 17:51:31 [INFO] CLI args: []string{"/usr/local/bin/terraform_0.12.0", "apply"}
2019/05/28 17:51:31 [DEBUG] Attempting to open CLI config file: /home/yoseft/.terraformrc
2019/05/28 17:51:31 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/05/28 17:51:31 [INFO] CLI command args: []string{"apply"}
2019/05/28 17:51:31 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/05/28 17:51:31 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/05/28 17:51:31 [DEBUG] New state was assigned lineage "026c4276-0849-2c08-7a6d-42dfb0db8351"
2019/05/28 17:51:31 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
@J00MZ
J00MZ / profs.json
Last active July 24, 2019 10:04
terminal_profiles
"profiles" :
[
{
"acrylicOpacity" : 0.5,
"background" : "#012456",
"closeOnExit" : true,
"colorScheme" : "Campbell",
"commandline" : "powershell.exe",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",