Skip to content

Instantly share code, notes, and snippets.

View conorgil's full-sized avatar

Conor Gilsenan conorgil

View GitHub Profile
@conorgil
conorgil / terraform debug output
Created February 19, 2019 02:43
Terraform google provider bug in google_compute_instance_from_template
... SHORTENED FOR BREVITY ...
2019-02-18T21:33:24.431-0500 [DEBUG] plugin.terraform-provider-google_v2.0.0_x4: -----------------------------------------------------
2019-02-18T21:33:24.433-0500 [DEBUG] plugin.terraform-provider-google_v2.0.0_x4: 2019/02/18 21:33:24 [DEBUG] Google API Request Details:
2019-02-18T21:33:24.433-0500 [DEBUG] plugin.terraform-provider-google_v2.0.0_x4: ---[ REQUEST ]---------------------------------------
2019-02-18T21:33:24.433-0500 [DEBUG] plugin.terraform-provider-google_v2.0.0_x4: POST /compute/beta/projects/SOME-PROJECT-ID/global/instanceTemplates?alt=json&prettyPrint=false HTTP/1.1
2019-02-18T21:33:24.433-0500 [DEBUG] plugin.terraform-provider-google_v2.0.0_x4: Host: www.googleapis.com
2019-02-18T21:33:24.433-0500 [DEBUG] plugin.terraform-provider-google_v2.0.0_x4: User-Agent: google-api-go-client/0.5 Terraform/0.11.9 (+https://www.terraform.io) terraform-provider-google/2.0.0
2019-02-18T21:33:24.433-0500 [DEBUG] plugin.terraform-provider-google_v2.0.0_x4: Content-Length: 5
@conorgil
conorgil / reloaded_or_not.js
Created November 1, 2017 17:47
Short demo using window.performance.navigation to determine whether page was reloaded
// https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigation
// https://blog.chromium.org/2017/09/chrome-62-beta-network-quality.html
// https://stackoverflow.com/questions/46226144/window-performance-navigation-type-works-in-ie-and-firefox-but-not-in-chrome
// This demo works as of 2017-11-01
const TYPE_RELOAD = 1;
function isReloadedPage() {
return performance.navigation.type === TYPE_RELOAD;
@conorgil
conorgil / CHANGELOG.md
Last active September 8, 2016 19:30
Template change log following the http://keepachangelog.com/en/0.3.0/ proposed format

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

This file should conform to the format proposed in Keep a CHANGELOG v0.3.0. Here are the highlights:

  • List releases in reverse-chronological order (newest on top).
  • Write all dates in ISO8601 format. (Example: 2012-06-02 for June 2nd, 2012.)
@conorgil
conorgil / main.tf
Last active February 12, 2016 18:46
Example terraform output using a module
# Call the module
module "vpc" {
source = "../modules/foo/bar/baz"
environment_name = "${var.environment_name}"
vpc_cidr = "${var.vpc_cidr}"
vpc_instance_tenancy = "dedicated"
vpc_enable_dns_support = true
vpc_enable_dns_hostnames = true
zones = "${var.zones}"
@conorgil
conorgil / ec2_iam_role_and_instance_profile.tf
Created January 18, 2016 00:24
Main file for a module which creates both an IAM Role and IAM Instance Profile of a given name.
###
# Variables
###
variable "iam_role_name" {
description = "The name of the IAM Role to create. An IAM Instance Profile of the same name will be automatically created for you, similarly to the AWS Console."
}
###
# Create IAM Role
@conorgil
conorgil / module_publish_to_aws_cloudwatch_logs.tf
Created January 13, 2016 21:36
Sharing IAM Role Policies between multiple IAM Roles
# AWS Cloudwatch Logs install documentation:
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/QuickStartEC2Instance.html
# By defining this IAM Role Policy in a module, it can be referenced anywhere it is required
# for an IAM Role. This is preferrable to copy/pasting the IAM Policy statement because changes
# made to this role will automatically apply to all IAM Roles referencing this module.
###
# Variables
###
@conorgil
conorgil / vpc_peering.tf
Created December 16, 2015 18:10
Terraform syntax bug in vpc peering module
###
# Variables
###
variable "vpc_id" {
description = "The id of the VPC"
}
variable "vpc_cidr" {
description = "The CIDR block of the VPC"
@conorgil
conorgil / main.tf
Last active November 25, 2015 02:35
VPC with mixed instance tenancy
provider "aws" {
region = "us-east-1"
}
resource "aws_vpc" "main" {
cidr_block = "10.1.0.0/16"
instance_tenancy = "default"
tags {
Name = "test_please_delete_me"
input {
file {
type => "acm"
# Wildcards work, here :)
path => [ "/path/to/my/files/*.log" ]
}
}
output {
@conorgil
conorgil / Main Java file
Last active December 16, 2015 22:19
Attemp to understand if AsyncHttpClient can make non-blocking calls
import com.ning.http.client.AsyncCompletionHandler;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.AsyncHttpClientConfig.Builder;
import com.ning.http.client.ListenableFuture;
import com.ning.http.client.Response;
public class MyAsyncHttpClientTest {
public static void main(String[] args) throws Exception {