Skip to content

Instantly share code, notes, and snippets.

Josh Padnick josh-padnick

Block or report user

Report or block josh-padnick

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
josh-padnick /
Last active Oct 10, 2019
Download a private binary release file from GitHub in bash
#!/usr/bin/env bash
# This is an adaptation of code I wrote to download a private binary from GitHub. Such...pain.
# Why can't GitHub just offer a standardized URL you can download a release binary from and attach
# your Github Personal Access Token as a header?
# Since this code is an adaptation it hasn't been directly tested, but the code it was adapted from works
# and hopefully you can get the missing piece you're after by looking here.
josh-padnick /
Last active Oct 3, 2019
Run ssh-agent via fish shell
# Convert ssh-agent output to fish shell
eval "$(ssh-agent)" >/dev/null
josh-padnick / crontab file
Last active Mar 25, 2019
Create EC2 AMI from Bash Script; Good for cron jobs
View crontab file
# Put this in your crontab file to run the script every day at 01:30 (1:30am). Note the PATH variable above; required for this script.
# m h dom mon dow command
30 01 * * * /bin/bash /home/ubuntu/scripts/ i-8a915682 >> /home/ubuntu/logs/crontab.log 2>&1
View gist:a0ae497d19508c9512018d8b2c9e17d8
=== 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 Nov 12, 2018
Terraform here doc syntax example
View example
user_data = <<-EOF
echo "hello world" > index.html
nohup busybox httpd -f -p "8080" &
josh-padnick /
Created Mar 28, 2016
Auto-update to latest version of Terraform
LATEST_RELEASE=$(curl | jq --raw-output '.tag_name' | cut -c 2-)
if [[ ! -e ${LATEST_RELEASE} ]]; then
echo "Installing Terraform ${LATEST_RELEASE}..."
rm terraform-*
rm terraform
unzip terraform_${LATEST_RELEASE}
rm terraform_${LATEST_RELEASE}
josh-padnick /
Created Jun 3, 2018
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 May 31, 2018
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 = "${}"
View gist:ef1677c29600abfa1c87ef3060b737d7
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
View gist:4b2dc841475a482ce2d601df461e1c92
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
You can’t perform that action at this time.