Skip to content

Instantly share code, notes, and snippets.

View clintcolding's full-sized avatar

Clint Colding clintcolding

View GitHub Profile
@clintcolding
clintcolding / rpisshkeys
Created July 9, 2019 17:25
Configure Raspberry Pi SSH Keys
#---- Create key on client ----#
ssh-keygen -b 2048 -t rsa
#---- Validate creation ----#
ls ~/.ssh
#---- SSH to Pi and create the SSH directory and file ----#
mkdir .ssh
cd .ssh
touch authorized_keys
@clintcolding
clintcolding / bluecatscripts.ps1
Created July 24, 2018 15:42
Bluecat/Proteus API PowerShell Scripts
# API Documentation can be at http://timlossev.com/attachments/Proteus_API_Guide_3.7.1.pdf
# Connecting the the API
$credential = Get-Credential
$uri = "http://bluecatserver/Services/API?wsdl"
$bc = New-WebServiceProxy -Uri $uri
$bc.CookieContainer = New-Object System.Net.CookieContainer
$bc.login($Credential.UserName, ($Credential.GetNetworkCredential()).Password)
# Find IP based on assigned name in Bluecat
@clintcolding
clintcolding / GCPCredentials.md
Created December 6, 2022 14:47
Creating GOOGLE_CREDENTIAL for Terraform Cloud

Create GOOGLE_CREDENTIALS

  1. Create a service account within the GCP project (terraform-svc).
  2. Create a new JSON key for the service account and save the file.
  3. Run the following command on the JSON file to format it correctly for TFC. cat key.json | tr -s '\n' ' '
  4. Copy the output of step 3 into the GOOGLE_CREDENTIALS variable in the TFC workspace.
  5. Make sure to mark the variable as sensitive!
@clintcolding
clintcolding / whoami-compose.yml
Created November 6, 2019 19:36
Traefik example
version: '3'
services:
whoami:
image: stefanscherer/whoami
labels:
# Create a router called whoami listening on the websecure entrypoint
- "traefik.http.routers.whoami.entrypoints=websecure"
# Force TLS
- "traefik.http.routers.whoami.tls=true"
@clintcolding
clintcolding / certs-traefik.yml
Last active February 3, 2021 21:22
Traefik example
tls:
certificates:
- certFile: /etc/certs/examplecert.crt
keyFile: /etc/certs/examplecert.key
@clintcolding
clintcolding / traefik-compose.yml
Created November 6, 2019 19:36
Traefik example
version: '3'
services:
reverse-proxy:
# The official v2.0 Traefik docker image
image: traefik:v2.0
command:
- --api.insecure=true
- --providers.docker
- --providers.file.directory=/etc/traefik/dynamic
@clintcolding
clintcolding / AppPoolTasks.ps1
Created November 20, 2019 18:40
Perform various IIS App Pool tasks via PowerShell
#---- Recycles all application pools on the given computer ----#
function RecyclePool {
[CmdletBinding()]
param (
[string[]]$ComputerName,
[pscredential]$Credential
)
process {
foreach ($server in $ComputerName) {
@clintcolding
clintcolding / GetIISandNonPagedMem.ps1
Created February 18, 2019 15:49
Gets Windows server resource usage
Invoke-Command -ComputerName $server -Credential $cred {
$npmem = Get-Counter -Counter "\Memory\Pool Nonpaged Bytes" -MaxSamples 1 -SampleInterval 1
[PSCustomObject]@{
Hostname = $env:COMPUTERNAME
"w3wp(MB)" = [math]::Round((Get-Process w3wp | Measure-Object WorkingSet -Sum).sum / 1MB,2)
"NonPaged(GB)" = [math]::Round($npmem.CounterSamples.cookedvalue / 1gb,2)
}
}
@clintcolding
clintcolding / SyncTimeWithHost.ps1
Created January 30, 2019 20:45
Sync VM time with VMware host.
$vms = Get-VM "DQWBATMAN01SRV" | Get-View
foreach ($vm in $vms) {
if ($vm.Config.Tools.SyncTimeWithHost -eq $false) {
$vmConfig = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfig.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfig.Tools.SyncTimeWithHost = $true
$vm.ReconfigVM($vmConfig)
}
[PSCustomObject]@{
@clintcolding
clintcolding / VMware-StartConnected.ps1
Created January 30, 2019 20:35
Set VMware VM's network adapters to start connected.
$vms = Get-VM
foreach ($vm in $vms) {
if (($adapter = $vm | Get-NetworkAdapter).ConnectionState.StartConnected -ne "True") {
$adapter = $adapter | Set-NetworkAdapter -StartConnected:$true -Confirm:$false
}
[PSCustomObject]@{
Name = $vm.Name
StartConnected = $adapter.ConnectionState.StartConnected
}