Skip to content

Instantly share code, notes, and snippets.

View jjtroberts's full-sized avatar

Joe Roberts jjtroberts

View GitHub Profile
@jjtroberts
jjtroberts / gcp_compute_instance_tunnel.sh
Created February 25, 2025 19:38
Dynamic GCP IAP SSH Tunnel
#!/bin/bash
## Example: ./get_gcp_compute_instance.sh hostname gcp_project_name
HOSTNAME=$1
PROJECT_ID=$2
INSTANCE_INFO=$(gcloud compute instances list \
--filter="name:$HOSTNAME" \
--format="value(name,zone)" \
function FindProxyForURL(url, host) {
// List of domains for which the proxy should be used
var proxyDomains = [
"windowsupdate.microsoft.com",
"*.windowsupdate.microsoft.com",
"*.update.microsoft.com",
"*.windowsupdate.com",
"download.windowsupdate.com",
"download.microsoft.com",
"*.download.windowsupdate.com",
@jjtroberts
jjtroberts / pug.md
Last active February 11, 2025 17:01
Personal User Guide

Work

Work and Life Setup
I maintain a clear boundary between work and home life, ensuring a balanced and focused approach to both.

Work Location
I work remotely from home but am open to occasional office collaboration to foster team connections or handle specific tasks that benefit from in-person interaction.

@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."[email protected]:".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"