Skip to content

Instantly share code, notes, and snippets.

View tristanmorgan's full-sized avatar
⌨️
tappity tap.

Tristan Morgan tristanmorgan

⌨️
tappity tap.
View GitHub Profile
@tristanmorgan
tristanmorgan / gen-aws-keys.sh
Last active April 8, 2024 22:29
Generate fake AWS creds for testing using awskeyring and aws(ruby)cli
#!/bin/sh
TEMP_KEY=$(aws sts generate-fake-key)
AWS_ACCESS_KEY_ID=$(jq -r .access_key.access_key_id <<< $TEMP_KEY)
echo export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
echo export AWS_SECRET_ACCESS_KEY=$(jq -r .access_key.secret_access_key <<< $TEMP_KEY)
echo export AWS_ACCOUNT_ID=$(awskeyring decode $AWS_ACCESS_KEY_ID)
@tristanmorgan
tristanmorgan / aws-key-gen.rb
Created April 28, 2023 04:14
Generate an AWS access key ID and secret that passes the regex in AWSKeyring.
#!/usr/bin/env ruby
require 'securerandom'
puts "AKIA#{Array.new(16){[*"A".."Z", *"2".."7"].sample}.join}"
puts SecureRandom.base64(30)
@tristanmorgan
tristanmorgan / alpine-img.pkr.hcl
Last active August 3, 2023 04:32
Packer file to build an Alpine Linux image for Qemu
packer {
required_plugins {
qemu = {
source = "github.com/hashicorp/qemu"
version = "~> 1"
}
}
}
source "qemu" "alpine" {
@tristanmorgan
tristanmorgan / hashup.sh
Last active October 28, 2022 02:51
Quick script to download latest HashiCorp binaries. (for arm mac)
#!/bin/sh
set -e
export CHECKPOINT_DISABLE=1
download() {
echo checking $1
TF_TAGS_FEED="https://api.releases.hashicorp.com/v1/releases/$1/latest"
RELEASE_JSON=$(curl -s -H "Cache-Control: no-cache" "$TF_TAGS_FEED")
LATEST_VERSION=$(echo ${RELEASE_JSON} | jq -r .version )
@tristanmorgan
tristanmorgan / 10.in-addr.arpa
Created March 6, 2022 23:47
Use Consul DNS for ".consul" and reverse IP lookups on macOS
# /etc/resolver/10.in-addr.arpa
nameserver 127.0.0.1
port 8600
$ TF_LOG=debug terraform apply -auto-approve -no-color
2021-12-22T15:49:42.089+1100 [INFO] Terraform version: 1.1.2
2021-12-22T15:49:42.089+1100 [INFO] Go runtime version: go1.17.2
2021-12-22T15:49:42.089+1100 [INFO] CLI args: []string{"terraform", "apply", "-auto-approve", "-no-color"}
2021-12-22T15:49:42.089+1100 [DEBUG] Attempting to open CLI config file: /Users/tristanmorgan/.terraformrc
2021-12-22T15:49:42.089+1100 [INFO] Loading CLI configuration from /Users/tristanmorgan/.terraformrc
2021-12-22T15:49:42.090+1100 [DEBUG] checking for credentials in "/Users/tristanmorgan/.terraform.d/plugins"
2021-12-22T15:49:42.090+1100 [DEBUG] found credentials "terraform-credentials-keychain_v1.0.0"
2021-12-22T15:49:42.090+1100 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2021-12-22T15:49:42.090+1100 [DEBUG] will search for provider plugins in /Users/tristanmorgan/.terraform.d/plugins

Keybase proof

I hereby claim:

  • I am tristanmorgan on github.
  • I am tristanmorgan (https://keybase.io/tristanmorgan) on keybase.
  • I have a public key ASDtv9LpwPydVjuqv7_D-FGUp14BUQ9rchfq59DpOGSm1go

To claim this, I am signing this object:

@tristanmorgan
tristanmorgan / story.md
Created February 20, 2020 23:05
macOS signed binary "Killed: 9"

macOS signed binary "Killed: 9"

Not so much of a "file" but a story of finding out how to fix when you download something from the 'net and it won't run because of protextions in the system. Specifically I'm talking about macOS Catalina.

I download a file via Safari and I try to run it and I get some sorta error. solution was to:

xattr -d com.apple.quarantine ~/Downloads/some-binary
@tristanmorgan
tristanmorgan / .terraformrc
Last active March 15, 2024 05:42
Terraform Cloud Token Helper (save into macOS keychain)
disable_checkpoint = true
credentials_helper helper {
args = []
}
# save this in home.
@tristanmorgan
tristanmorgan / basic.rb
Created December 19, 2018 22:21
lib/thor/line_editor/basic.rb - print stars for no-echo input
class Thor
module LineEditor
class Basic
attr_reader :prompt, :options
def self.available?
true
end
def initialize(prompt, options)