Skip to content

Instantly share code, notes, and snippets.

View josh-padnick's full-sized avatar

Josh Padnick josh-padnick

View GitHub Profile
josh-padnick / render.js
Created May 7, 2021 18:24
Render images served from localhost in gmail
// Run this in your Chrome WebDev Tools console
// Based on
(function(){ while(img = document.evaluate('//img[contains(@src, \'\')][contains(@src, \'#\')]', document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue){ var src = img.attributes.src.value; src = src.substr(src.indexOf('#')+1); img.attributes.src.value = src; } })();
// NOTE: I have NOT validated this gist as pasted above, though I have validated it manually (or some variant of it before)
josh-padnick / gist:a0ae497d19508c9512018d8b2c9e17d8
Last active November 21, 2018 06:42
module-server log output
=== RUN TestOsHardeningXFS
TestOsHardeningXFS 2018-11-21T06:02:13Z region.go:72: Looking up all AWS regions available in this account
TestOsHardeningXFS 2018-11-21T06:02:15Z region.go:57: Using region ap-northeast-2
TestOsHardeningXFS 2018-11-21T06:02:15Z key_pair.go:31: Generating new public/private key of size 2048
TestOsHardeningXFS 2018-11-21T06:02:20Z keypair.go:49: Creating new Key Pair in EC2 region ap-northeast-2 named AAsSgo
TestOsHardeningXFS 2018-11-21T06:03:08Z command.go:52: Running command ./ with args [-var ami_module_security_version_type="branch" -var vpc_id="vpc-32e3025b" -var should_create_keypair="0" -var aws_region="ap-northeast-2" -var ami_builder_source_ami="ami-0076ae0908f382581" -var ami_builder_source_ami_ssh_username="ec2-user" -var ami_ebs_volume_size="25" -var ami_github_oauth_token="<REDACTED>" -var ami_partition_fs_type="xfs" -var ami_module_security_version="master" -var ami_builder_keypair_private_key="-----BEGIN RSA PRIVATE KEY-----\nREDACTED\n-----END RSA PR
josh-padnick / example
Last active November 12, 2018 22:29
Terraform here doc syntax example
user_data = <<-EOF
echo "hello world" > index.html
nohup busybox httpd -f -p "8080" &
josh-padnick /
Created June 3, 2018 21:09
Terraform Module depends_on, Part Deux
# This file should be at /confluent/
variable "kafka_cluster_deployment_done" {}
module "confluent_tools" {
source = "../server-group/"
rolling_deployment_done = "${var.kafka_cluster_deployment_done}"
josh-padnick /
Last active December 15, 2021 17:55
Hack for Terraform Module depends_on
# This file would need to be in its own folder like /tf-bar/
variable "bar" {
default = "foo"
resource "null_resource" "bar" {
triggers {
bar = "${}"
josh@pad-mac ~/g/s/g/g/p/t/tf-modules (kafka-status-check)> terraform apply
2018/05/31 13:24:29 [INFO] Terraform version: 0.11.7 41e50bd32a8825a84535e353c3674af8ce799161
2018/05/31 13:24:29 [INFO] Go runtime version: go1.10.1
2018/05/31 13:24:29 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2018/05/31 13:24:29 [DEBUG] Attempting to open CLI config file: /Users/josh/.terraformrc
2018/05/31 13:24:29 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/05/31 13:24:29 [INFO] CLI command args: []string{"apply"}
2018/05/31 13:24:29 [TRACE] module source: "../tf-foo"
2018/05/31 13:24:29 [TRACE] module source: "../tf-bar"
2018/05/31 13:24:29 [INFO] command: empty terraform config, returning nil
josh-padnick / gist:4b2dc841475a482ce2d601df461e1c92
Created March 30, 2018 18:46
Yet Another Terraform Failure
kafka-standalone-ubuntu 2018/03/30 11:35:29 Error: Error applying plan:
kafka-standalone-ubuntu 2018/03/30 11:35:29
kafka-standalone-ubuntu 2018/03/30 11:35:29 2 error(s) occurred:
kafka-standalone-ubuntu 2018/03/30 11:35:29
kafka-standalone-ubuntu 2018/03/30 11:35:29 * module.zookeeper.module.zookeeper_servers.aws_launch_configuration.server_group: aws_launch_configuration.server_group: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.
kafka-standalone-ubuntu 2018/03/30 11:35:29
kafka-standalone-ubuntu 2018/03/30 11:35:29 Please include the following information in your report:
kafka-standalone-ubuntu 2018/03/30 11:35:29
kafka-standalone-ubuntu 2018/03/30 11:35:29 Terraform Version: 0.11.5
kafka-standalone-ubuntu 2018/03/30 11:35:29 Resource ID: aws_launch_configuration.server_group
josh-padnick / Schema Registry Log Output
Created February 4, 2018 23:38
Schema Registry Log Output
[2018-02-04 23:26:47,636] DEBUG Selector loop woken up from select, 1/3 selected (
[2018-02-04 23:26:47,637] DEBUG Queued change$ManagedSelector$Accept@3b32c022 (
[2018-02-04 23:26:47,637] DEBUG Running change$ManagedSelector$Accept@3b32c022 (
[2018-02-04 23:26:47,637] DEBUG onOpen NetworkTrafficSelectChannelEndPoint@3711c20b{/<->8081,Open,in,out,-,-,0/30000,null}{io=0,kio=0,kro=0} (
[2018-02-04 23:26:47,637] DEBUG NetworkTrafficSelectChannelEndPoint@3711c20b{/<->8081,Open,in,out,-,-,0/30000,null}{io=0,kio=0,kro=0} idle timeout check, elapsed: 0 ms, remaining: 30000 ms (
[2018-02-04 23:26:47,638] DEBUG new HttpChannelOverHttp@61c8edba{r=0,c=false,a=IDLE,uri=} -> NetworkTrafficSelectChannelEndPoint@3711c20b{/12
josh-padnick /
Last active August 31, 2017 19:33
Compute the number of hours used by a customer for a given date range in Zendesk
# 1. Make sure obtain an API Token
# 2. This has only been validated to work with ZenDesk agents, not end users
# 3. Look up the customer's org ID by querying
# 4. Look up the ZenDesk custom Field ID that stores the number of hours used by querying a complete ticket and inspecting the JSON output
# 5. This script all automatically sum the total of all numbers in the given month and ignore empty numbers.
josh-padnick /
Last active March 16, 2024 15:19
Manually Edit AWS Console "Switch Role" Configuration in Bash

Manually Edit AWS Console "Switch Role" Configuration in Bash


At Gruntwork, we work with multiple software teams. That means we have to modify the "Switch Role" history multiple times. But the only way to do that today is to delete your cookie and clear all AWS Console saved settings. That got old after a while, so these instructions enable you to modify the "Switch Roles" configuration directly.

The Big Picture