Skip to content

Instantly share code, notes, and snippets.

View sneal's full-sized avatar

Shawn Neal sneal

View GitHub Profile
@sneal
sneal / Autounattend.xml
Created October 15, 2014 14:56
Windows Server 2012 R2 Autounattend.xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<InputLocale>en-US</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
@sneal
sneal / main.go
Created January 11, 2024 19:58
CF apps running each diego cell
package main
import (
"context"
"fmt"
"github.com/cloudfoundry-community/go-cfclient/v3/client"
"github.com/cloudfoundry-community/go-cfclient/v3/config"
"github.com/cloudfoundry-community/go-cfclient/v3/resource"
"os"
)
@sneal
sneal / config.go
Last active December 6, 2023 18:39
go-cfclient config.New
func (c *Config) OAuth2HTTPClient(ctx context.Context) (*http.Client, error) {
// if explicitly configured with an oauth2 transport then use as-is
if _, ok := c.httpClient.Transport.(*oauth2.Transport); ok {
return c.httpClient, nil
}
// use our http.Client instance for token acquisition
oauthCtx := context.WithValue(ctx, oauth2.HTTPClient, c.httpClient)
var tokenSource oauth2.TokenSource
@sneal
sneal / install-vmware-tools.ps1
Created October 15, 2014 15:40
Install VMWare tools PowerShell script
$version = '9.6.1'
# from /Applications/VMware Fusion.app/Contents/Library/isoimages/windows.iso
$iso_name = 'vmware_fusion_tools_windows_6.0.3.iso'
$download_url = "http://host.example.com/$iso_name"
(New-Object System.Net.WebClient).DownloadFile($download_url, "c:\windows\temp\$iso_name")
&c:\7-zip\7z.exe x "c:\windows\temp\$iso_name" -oc:\windows\temp\vmware -aoa | Out-Host
&c:\windows\temp\vmware\setup.exe /S /v`"/qn REBOOT=R`" | Out-Host
@sneal
sneal / README.md
Last active September 8, 2023 18:51
TAS External MySQL MIgration -> Internal TAS MySQL

Migration to TAS Internal MySQL

Migrating from an externally hosted MySQL DB server such as RDS or Oracle MySQL to the internally managed TAS HA cluster MySQL requires some extra steps to avoid application downtime. To avoid unnecessary downtime and churn we want to avoid having TAS system components ever see an empty MySQL database.

At a high level the overall procedure is:

  1. create single internal mysql instance
  2. bosh stop cloud_controller
This topic describes how to migrate your VMware Tanzu Operations Manager (Ops Manager) installation to a new vSphere datastore.
Prerequisites
Both the new and existing vSphere datastores must reside in the same data center.
To avoid service disruption, VMware recommends that you configure your overall Ops Manager deployment for high availability (HA). In addition, check for configurations necessary to achieve HA in each of your installed product tiles.
If your environment has any single points of failure, service might be disrupted as a result of the migration.
Before You Begin

This PowerCLI snippet can be used to find all the BOSH VMs connected to a specific datastore and then disconnect the CD-ROM to avoid vMotion or SDRS errors.

  1. Open a PowerCLI session and login to the appropriate vCenter using the Connect-VIServer command.
  2. Copy the below eject-iso.ps1 snippet locally
  3. Change the datastore name, from dsname to whatever your datastore name is.
  4. Execute the script

The final output table will contain all the VMs processed and list out the updated ISOPaths which should be empty at this point.

NOTE The script only modifies BOSH VMs, i.e. those with mounted env.iso files, however the output will display all VMs on the specified datastore and any other non-BOSH ISOs mounted.

@sneal
sneal / README.md
Created July 12, 2023 20:31
BOSH datastore cluster - datastore evacuation

This topic describes how to change your VMware Tanzu Operations Manager (Ops Manager) installation's underlying vSphere datastore clusters.

Before You Begin

The following sections describe the steps you can do prior to the migration.

Step 1: Back Up Your Environment

Ensure that your Ops Manager environment is fully backed up.

For more information about how to back up Ops Manager, see Backing Up Deployments.

@sneal
sneal / orderfiles.py
Created June 5, 2023 04:42
Script to rename all GoPro generated media in a directory to an ordinal number series (i.e. human understandable)
import sys, os
from pathlib import Path
from operator import itemgetter
p = ''.join(sys.argv[1:])
if len(p) == 0:
print('you must give a fully qualified directory path to process')
exit()
files = list(Path(p).glob('*.MP4'))
@sneal
sneal / gist:6085244
Created July 26, 2013 01:11
Load vagrant-vmware-fusion plugin for vagrant plugin development
source "https://rubygems.org"
source "http://gems.hashicorp.com"
gemspec
group :development do
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => 'v1.2.2'
gem "vagrant-vmware-fusion", ">= 0.8.2"
end