Skip to content

Instantly share code, notes, and snippets.

@jjtroberts
jjtroberts / wsus.ps1
Created December 5, 2023 18:47
Powershell WSUS Test
# Install-WindowsFeature -Name UpdateServices-RSAT
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$WSUSServer = 'WSUS'
# This is your WSUS Server Name
$Port = 8530
# This is 8531 when SSL is enabled
$UseSSL = $False
#This is $True when SSL is enabled
Try
@jjtroberts
jjtroberts / is.zsh
Created November 2, 2023 15:40
All them dang IAP commands
isssh () {
gcloud compute ssh $1 --zone "${2:-us-central1-a}" --project "${3:-stage-digital-is}" --tunnel-through-iap --strict-host-key-checking no
}
issshtun () {
cd /Users/JRoberts/projects/dracarys/taskfiles/is-bastion
task tunnel -- $1
}
issshkill () {
@jjtroberts
jjtroberts / git-instead.sh
Created October 27, 2023 17:15
git config ssh instead of https
# When all your terraform modules use https:// and `terraform init` blocks on username/password prompts.
# Switch to git instead of https
git config --global url."git@github.com:".insteadOf "https://github.com/"
@jjtroberts
jjtroberts / gke-nodepool-upgrade.sh
Last active October 26, 2023 19:18
GKE node pool upgrades
#!/usr/bin/env bash
PROJECT=""
LOCATION="us-east4"
CLUSTER=""
CONTEXT=""
FILTER="version:1.25.10-gke.1400"
NODEPOOLS=$(gcloud container node-pools list --cluster=$CLUSTER --project=$PROJECT --region=$LOCATION --filter="$FILTER" --format=json | jq -r ".[].name")
@jjtroberts
jjtroberts / .zshrc
Created December 7, 2022 16:36
zshrc docker aliases for arm64
docker() {
if [[ `uname -m` == "arm64" ]] && [[ "$1" == "run" || "$1" == "build" || "$1" == "pull" ]]; then
/usr/local/bin/docker "$1" --platform linux/amd64 "${@:2}"
else
/usr/local/bin/docker "$@"
fi
}
@jjtroberts
jjtroberts / autobrew.sh
Created November 18, 2022 16:40
automatic brew updates
brew update
brew upgrade
brew install terminal-notifier
brew tap domt4/autoupdate
brew autoupdate start --upgrade --enable-notification
# These commands will:
# 1. update the brew repository,
# 2. upgrade all the existing apps,
# 3. install the terminal notifier: https://formulae.brew.sh/formula/terminal-notifier
@jjtroberts
jjtroberts / convert_iam_to_smtp.py
Created October 13, 2022 13:50
SES IAM Converter
#!/usr/bin/env python3
import hmac
import hashlib
import base64
import argparse
# Values that are required to calculate the signature. These values should
# never change.
DATE = "11111111"
@jjtroberts
jjtroberts / check_cert.sh
Created October 12, 2022 22:05
Verify SSL certificate expiration dates and sn
#!/usr/bin/env bash
DOMAIN=$1
echo | openssl s_client -servername $1 -connect $1:443 2>/dev/null | openssl x509 -noout -dates
echo | openssl s_client -servername $1 -connect $1:443 | grep $1
#!/bin/bash
if [ -z "$1" ]; then
echo "Email requires parameter 1 to be a string.";
exit 1;
fi
if [ -z "$2" ]; then
echo "Filename requires parameter 2 to be a string.";
exit 1;
@jjtroberts
jjtroberts / drush_s3fs.sh
Created October 12, 2022 22:01
Configure Drupal via drush to use s3fs
# drush vset variable_name value
drush -l [domain.org] en s3fs --y
drush -l [domain.org] vset s3fs_bucket [bucket_name]
drush -l [domain.org] vset s3fs_region [region]
drush -l [domain.org] vset s3fs_use_cname FALSE
drush -l [domain.org] vset s3fs_use_customhost FALSE
drush -l [domain.org] vset s3fs_use_versioning TRUE
drush -l [domain.org] vset s3fs_cache_control_header public, max-age=300
drush -l [domain.org] vset s3fs_encryption aws:kms