Skip to content

Instantly share code, notes, and snippets.

View cdelashmutt-pivotal's full-sized avatar

Chris DeLashmutt cdelashmutt-pivotal

View GitHub Profile
@cdelashmutt-pivotal
cdelashmutt-pivotal / commands.sh
Last active May 16, 2024 19:50
App Engine Commands to Remember
# Set config up for `tanzu build`
#
# The <your-container-registry-host-and-path> is the registry and sub-path you want to use to store built container images
# for your demos. This registry host needs to be accessible from your demo workstation and from the cluster you are trying
# to deploy to. If you can use one of the public registries (DockerHub, GCR, Azure Container Registry, etc) that are
# already trusted and also set them to allow anyone to pull from them, your life will be easier for demos.
tanzu build config --build-plan-source-type=ucp --containerapp-registry <your-container-registry-host-and-path>/{name}
# Clean up deployed demo app in a space (needed until we have `tanzu app delete`)
KUBECONFIG=$HOME/.config/tanzu/kube/config kapp delete -a applyapp --dangerous-ignore-failing-api-services
@cdelashmutt-pivotal
cdelashmutt-pivotal / k8s-1.25-deprecated.sh
Created March 21, 2024 16:07
Query for APIs Deprecated in Kubernetes 1.25
#!/bin/bash
# You can reference specific API versions from the `kubectl` cli using the following format:
# kubectl get <pluralized-object-name>.<version>.<api-group>
# batch/v1beta1 API version of CronJob
echo "-- CronJobs --"
kubectl get cronjobs.v1beta1.batch -A
# discovery.k8s.io/v1beta1 API version of EndpointSlice
@cdelashmutt-pivotal
cdelashmutt-pivotal / overlay.yaml
Last active June 7, 2023 20:40
Overlay for cloning Bitnami MySQL Service for cloning
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#@ def kind_and_name(kind, name):
#@ return overlay.subset({"kind": kind, "metadata": {"name": name}})
#@ end
#@overlay/match by=overlay.all, expects=3
---
#@overlay/match-child-defaults missing_ok=True
@cdelashmutt-pivotal
cdelashmutt-pivotal / disable-guard-duty.sh
Last active June 8, 2023 21:57
Disable GuardDuty in all regions
#!/bin/bash
# Borrowed heavily from https://gist.github.com/tomofuminijo/ac321d7b6423bab7f175c8795546bd9a
for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output json | jq -r '.[]' | tr '\n' ' '); do
echo Checking for detectors in $region
detector_id=$(aws guardduty list-detectors --region $region --query "DetectorIds[0]" --output text)
# if detector not exist, continue
if [ $detector_id = "None" ]; then
continue
(Captured from https://web.archive.org/web/20150511090759/http://synergy2.sourceforge.net/autostart.html)
Starting synergy automatically
You can configure synergy to start automatically when the computer starts or when you log in. The steps to do that are different on each platform. Note that changing these configurations doesn't actually start or stop synergy. The changes take effect the next time you start your computer or log in.
Windows
Start synergy and click the Configure... button by the text Automatic Startup. The Auto Start dialog will pop up. If an error occurs then correct the problem and click Configure again.
On the Auto Start dialog you'll configure synergy to start or not start automatically when the computer starts or when you log in. You need Administrator access rights to start synergy automatically when the computer starts. The dialog will let you know if you have sufficient permission.
@cdelashmutt-pivotal
cdelashmutt-pivotal / Create MySQL
Last active September 14, 2022 02:08
Workshop
k apply -f- << EOF
apiVersion: with.sql.tanzu.vmware.com/v1
kind: MySQL
metadata:
name: mysql-test
EOF
@cdelashmutt-pivotal
cdelashmutt-pivotal / tanzu-switch
Created July 8, 2022 14:01
This script switches between Tanzu CLI versions (and related CLIs). To prep, extract CLIs to /opt/tanzu-<version>, extract embedded CLIs, and chmod any of those CLIs you need to
#!/bin/bash
usage()
{
echo "Usage: tanzu-switch [ -v VERSION ]"
exit 2
}
print_links()
{
@cdelashmutt-pivotal
cdelashmutt-pivotal / delete-all-apps.sh
Created July 7, 2020 16:15
One liner for deleting all the apps in the current space
cf apps | tail +5 | cut -d ' ' -f1 | xargs -n1 -I{} cf d {} -f -r
@cdelashmutt-pivotal
cdelashmutt-pivotal / Create-OpenSSHPubAndPrivateKeys.ps1
Created June 26, 2020 15:21
Generate OpenSSH compatible public and private key files in Powershell
<#
.SYNOPSIS
Create an OpenSSH compatible Public and Private Key in pure Powershell
.DESCRIPTION
Many scripts rely on the openssh or openssl tools to be available to generate public and private keys compatible with OpenSSH, but this script relies purely on Powershell (and some .NET classes already included) to generate public and private keys.
.EXAMPLE
PS /git/scripts> ./Create-OpenSSHPubAndPrivateKeys.ps1 -PublicKeyPath my-key.pub -PrivateKeyPath my-key
.LINK
mailto:grog@grogscave.net
#>
$(om -t <opsman-host> -u <admin-user> -p <admin-password> curl -s --path /api/v0/deployed/director/manifest | convertfrom-json | select -expand instance_groups | where {$_.name -eq 'bosh'} | select -expand properties | select -expand director | select -expand trusted_certs).Trim() -split '(?<!^)(?=-----BEGIN CERTIFICATE-----)' | where {$_ -ne ''} | foreach {$i=0} { $i++; $certArray = $_.Trim() -split '\n'; $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate; $cert.Import([System.Convert]::FromBase64String(-join $certArray[1..($certArray.Length-2)])); Write-Host "Cert[$i]: $($cert.Subject) - $($cert.GetExpirationDateString())" }