Skip to content

Instantly share code, notes, and snippets.

View scottschreckengaust's full-sized avatar
🏄‍♂️
I may be slow to respond

Scott Schreckengaust scottschreckengaust

🏄‍♂️
I may be slow to respond
View GitHub Profile
@scottschreckengaust
scottschreckengaust / foundation_models.tf
Last active February 25, 2025 19:46
Terraform Bedrock Snippets
# https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html
data "aws_bedrock_foundation_models" "models" {}
output "model_ids" {
description = "The Bedrock Foundation Models"
value = data.aws_bedrock_foundation_models.models.model_summaries[*].model_id
}
variable "default_foundation_model" {
type = string
description = "The default foundation model to use"
nullable = false
@scottschreckengaust
scottschreckengaust / log.json
Created December 10, 2024 11:32
sscce awscc_s3_bucket us-west-2 issue
This file has been truncated, but you can view the full file.
{"@level":"info","@message":"Terraform version: 1.9.8","@timestamp":"2024-12-10T03:27:29.374458-08:00"}
{"@level":"debug","@message":"using github.com/hashicorp/go-tfe v1.58.0","@timestamp":"2024-12-10T03:27:29.374615-08:00"}
{"@level":"debug","@message":"using github.com/hashicorp/hcl/v2 v2.20.0","@timestamp":"2024-12-10T03:27:29.374625-08:00"}
{"@level":"debug","@message":"using github.com/hashicorp/terraform-svchost v0.1.1","@timestamp":"2024-12-10T03:27:29.374631-08:00"}
{"@level":"debug","@message":"using github.com/zclconf/go-cty v1.14.4","@timestamp":"2024-12-10T03:27:29.374636-08:00"}
{"@level":"info","@message":"Go runtime version: go1.22.7","@timestamp":"2024-12-10T03:27:29.374640-08:00"}
{"@level":"info","@message":"CLI args: []string{\"/opt/homebrew/Cellar/tfenv/3.0.0/versions/1.9.8/terraform\", \"apply\", \"-var=region=us-west-2\", \"-auto-approve\"}","@timestamp":"2024-12-10T03:27:29.374648-08:00"}
{"@level":"trace","@message":"Stdout is a terminal of width 158","@timestamp":"2024-12-10T03:27:29
@scottschreckengaust
scottschreckengaust / healthcheck.sh
Created November 26, 2024 23:30
This gets the full command from PID 1 and checks for the process running
#!/bin/sh
set -e
# Get the process
FULL_COMMAND="$(sed -n l "/proc/1/cmdline" | sed -e 's/\\$//g' | tr -d '\n' | sed -e 's/\$$//g' | sed -e 's/\\000/ /g' | sed -e 's/ *$//g' | head -1)"
# Look for the process
pgrep --full "$FULL_COMMAND" 2> /dev/null > /dev/null;
exit ${?};
@scottschreckengaust
scottschreckengaust / setup-node.sh
Created August 22, 2024 23:58
Install latest maintained node in a virtual environment using pipenv and nodeenv
#!/bin/sh
# Installation looks like this:
# nodeenv --node=20.16.0 --python-virtual;
# Install nodeenv if not present
which nodeenv || pipenv install --dev nodeenv;
# If asking for a specific version just try to install it...
# Otherwise, get the latest and install it unless it is already installed
@scottschreckengaust
scottschreckengaust / delete-non-empty-bucket.py
Last active June 28, 2024 15:59
Deletes non-empty AWS S3 buckets
#!/usr/bin/env python
"""\
Deletes non-empty AWS S3 Buckets
WARNING: VERY DESTRUCTIVE
Usage: myscript.py your_bucket_name
"""
import sys
import boto3
@scottschreckengaust
scottschreckengaust / minimum.template
Created January 25, 2024 17:37
Minimal CloudFormation template
---
AWSTemplateFormatVersion: "2010-09-09"
Resources:
Topic:
Type: "AWS::SNS::Topic"
Metadata:
cfn_nag:
rules_to_suppress:
- id: "W47"
@scottschreckengaust
scottschreckengaust / websocketlistener.user.js
Created January 5, 2024 05:34
Creating a WebSocket Listener
// ==UserScript==
// @name A Test
// @namespace com.github
// @version 0.0.0
// @description A Test
// @author Scott Schreckengaust <[email protected]>
// @match http://*/*
// @match https://*/*
// @grant none
// @antifeature
@scottschreckengaust
scottschreckengaust / git.txt
Last active November 2, 2022 19:05
Schreck's Useful Snippets - seldom used, way useful, but hard to remember
################################################################################
# This will minimize a repository to only the current commit:
################################################################################
export ORIGIN_URL=$(git remote get-url origin); \
export COMMIT=$(git rev-parse HEAD); \
rm -rf .git; \
git init .; \
git remote add origin ${ORIGIN_URL}; \
git fetch origin ${COMMIT} --depth 1; \
git reset --mixed ${COMMIT}; \

Keybase proof

I hereby claim:

  • I am scottschreckengaust on github.
  • I am scottschrecken (https://keybase.io/scottschrecken) on keybase.
  • I have a public key ASDfxF4fbhLl-vj8q_u7pWXQEmDAiS3Ffb23xKcOwLDc1Qo

To claim this, I am signing this object:

// Convert Excel dates into JS date objects
//
// @param excelDate {Number}
// @return {Date}
function getJsDateFromExcel(excelDate) {
// JavaScript dates can be constructed by passing milliseconds
// since the Unix epoch (January 1, 1970) example: new Date(12312512312);