Skip to content

Instantly share code, notes, and snippets.

@joelthompson
joelthompson / ec2_group_repro.yml
Created January 24, 2015 05:48
ec2_group repro
---
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Set AWS access key
set_fact:
aws_access_key: "<redacted>"
- name: Set AWS secret key
@joelthompson
joelthompson / Hello.java
Last active December 23, 2015 08:09
osv java bug repro
public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello, World!");
java.nio.file.Path path = java.nio.file.Paths.get("/");
System.out.println("Path is " + path);
}
}
diff --git a/cloud/amazon/ec2_vpc_dhcp_options.py b/cloud/amazon/ec2_vpc_dhcp_options.py
index 7068b05..00f56ff 100644
--- a/cloud/amazon/ec2_vpc_dhcp_options.py
+++ b/cloud/amazon/ec2_vpc_dhcp_options.py
@@ -233,7 +233,7 @@ def fetch_dhcp_options_for_vpc(vpc_conn, vpc_id):
connection variable.
"""
vpcs = vpc_conn.get_all_vpcs(vpc_ids=[vpc_id])
- if len(vpcs) != 1:
+ if len(vpcs) != 1 or vpcs[0].dhcp_options_id == "default":
@joelthompson
joelthompson / auth_qrcode_generator.py
Created December 6, 2016 04:14
Recovery script to generate QR codes for Google Auth Accounts
#!/usr/bin/env python
#
# Note: First, pull the Google Auth database locally, which requires root access
# Then, run this, which assumes you have a databases file in the current directory
# It also assumes you have the qrencode package installed locally
import subprocess
import urllib
import sqlite3
@joelthompson
joelthompson / README.md
Last active May 21, 2024 17:19
Vault Auth
@joelthompson
joelthompson / plan-debug.log
Created July 26, 2017 02:06
Terraform Error
2017/07/25 21:57:38 [INFO] Terraform version: 0.9.11 efca455c35d0d218a9bfee835a8ec3ef8d4d1c8c
2017/07/25 21:57:38 [INFO] Go runtime version: go1.8
2017/07/25 21:57:38 [INFO] CLI args: []string{"/mnt/home-root/home/joelthompson/Downloads/terraform", "plan"}
2017/07/25 21:57:38 [DEBUG] Detected home directory from env var: /home/joelthompson
2017/07/25 21:57:38 [DEBUG] Detected home directory from env var: /home/joelthompson
2017/07/25 21:57:38 [DEBUG] Attempting to open CLI config file: /home/joelthompson/.terraformrc
2017/07/25 21:57:38 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/07/25 21:57:38 [INFO] CLI command args: []string{"plan"}
2017/07/25 21:57:38 [DEBUG] Detected home directory from env var: /home/joelthompson
2017/07/25 21:57:38 [DEBUG] command: loading backend config file: /mnt/home-root/home/joelthompson/temp/temp
#!/usr/bin/env python
from botocore.credentials import CredentialProvider, RefreshableCredentials
import requests
from datetime import datetime, timedelta
class VaultCredentialProvider(CredentialProvider):
METHOD = 'vault'
CANONICAL_NAME = 'VaultRole'
#!/bin/bash
MFA_ARN=$(aws sts get-caller-identity --query "Arn" --output text | sed -e "s#:user/#:mfa/#")
read -p "Enter MFA Code: " MFA_CODE
read -a CREDS <<< $(aws sts get-session-token --serial-number $MFA_ARN --token-code $MFA_CODE --output text)
export AWS_ACCESS_KEY_ID="${CREDS[1]}"
export AWS_SECRET_ACCESS_KEY="${CREDS[3]}"
export AWS_SECURITY_TOKEN="${CREDS[4]}"
export AWS_SESSION_TOKEN="${CREDS[4]}"