Skip to content

Instantly share code, notes, and snippets.

View yetanotherchris's full-sized avatar

Chris S. yetanotherchris

View GitHub Profile
yetanotherchris /
Last active March 25, 2024 23:52
Install Kops and prequisites on Ubuntu
# Install AWS CLI, Kubectl, Kops
sudo apt update
sudo apt install -y awscli
sudo snap install kubectl --classic
curl -LO
chmod +x kops-linux-amd64
mv ./kops-linux-amd64 /usr/local/bin/kops
# Setup the AWS profile
aws config
yetanotherchris /
Created September 5, 2016 09:07
Automating Docker images and containers with Python ()
This script brings up the entire stack of Docker containers, removing the current ones.
Docker compose was tried for this task and it wasn't customisable enough.
Docker cloud was tried (with stack files) and was buggy (failed to launch, no logs returned).
Docker machine was tried, but it can't connect to existing servers only ones it created.
Rancher was too heavy weight for the task, as the containers are lightweight in DigitalOcean.
Kubernetes would've been too heavy weight for DigitalOcean.
It was written in Powershell and worked. But then converting it to Bash was too much effort.
Powershell for Linux is too much effort to install without a debian package (and none standard)
# Get the latest Chromedriver version number
WriteHeader "Determining Chromedriver version"
$url = "";
$xml = [xml](wget $url);
$chromeDriver_version = 2.12;
# XML format: <ListBucketResult><Contents><Key>...</Key></Contents></ListBucketResult>
foreach ($item in $xml.ListBucketResult.Contents)
yetanotherchris / update-dns.ps1
Created September 20, 2016 08:53
Update DNS entries in Powershell
Remove-DnsServerResourceRecord -Name "mysubdomain" -Force -RRType CName -ZoneName "" -ComputerName "" -ErrorAction Ignore
Add-DnsServerResourceRecordCName -Name "mysubdomain" -HostNameAlias "" -ZoneName "" -ComputerName ""
Add-DnsServerResourceRecordA -IPv4Address "" -Name "" -ZoneName "" -ComputerName ""
yetanotherchris / enable-hyperv-in-hyperv.ps1
Created October 15, 2017 09:14
Enable Hyper-V inside Hyper-V for Windows 10 Creators Edition. Run docker inside a Hyper-V VM
# Example: ./enable-hyperv-in-hyperv.ps1 -vmName "Windows 10"
param (
[Parameter(Mandatory = $true)]$vmName
Set-VMProcessor -VMName $vmName -ExposeVirtualizationExtensions $true
Get-VMNetworkAdapter -VMName $vmName | Set-VMNetworkAdapter -MacAddressSpoofing On
Write-Host "VM updated. Make sure your VM has dynamic memory enabled, and has 4gb or more"
yetanotherchris / http-load-test.ps1
Created March 30, 2022 08:34
Powershell HTTP "load testing" (about 3-5 RPS)
while ($true) { $r = wget -uri "" -headers @{"Accept-Tenant"="Nz"}; echo $r.Content }
yetanotherchris / import-snippet.psm1
Created October 27, 2015 00:32
Downloads a snippet from, for use with Visual Studio Package manager
function Import-Snippet($snippetId, $name)
# Save this in one of the locations found from $env:PSModulePath as "Import-Snippet\import-snippet.psm1"
# e.g. "D:\Chris\Documents\WindowsPowerShell\Modules\Import-Snippet\import-snippet.psm1"
# Then in powershell type "import-module import-snippet"
$fullUrl = "$snippetId"
$filePath = "$env:USERPROFILE\Documents\Visual Studio 2015\Code Snippets\Visual C#\My Code Snippets\$name.snippet"
wget -Uri "$fullUrl" -OutFile "$filePath"
Write-Host "Successfully saved $filePath" -ForegroundColor DarkGreen
yetanotherchris / UpdateChromeDriver.ps1
Last active February 4, 2024 14:09
Downloads the latest ChromeDriver, installs it to c:\windows
# Make sure this is run as administrator
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
$isAdmin = (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($isAdmin -eq $false)
Write-Host "Please run this script as an administrator" -ForegroundColor Yellow
$version = "2.15"
yetanotherchris / win-features.ps1
Created February 6, 2017 10:26
installing windows features
Get-WindowsOptionalFeature -Online | Select FeatureName | Sort FeatureName
Enable-WindowsOptionalFeature -FeatureName IIS-WebServer -Online -All
yetanotherchris / large-dummy-text-file.ps1
Created February 27, 2017 18:40
How to create large dummy file in Windows
for ($i = 0;$i -lt 1024;$i++) { echo $("-" * 1024) >> c:\test.txt }