Skip to content

Instantly share code, notes, and snippets.

View PartTimeLegend's full-sized avatar

Antony Bailey PartTimeLegend

View GitHub Profile
🌞 Morning 86 commits █████░░░░░░░░░░░░░░░░ 24.0%
🌆 Daytime 166 commits █████████▋░░░░░░░░░░░ 46.2%
🌃 Evening 107 commits ██████▎░░░░░░░░░░░░░░ 29.8%
🌙 Night 0 commits ░░░░░░░░░░░░░░░░░░░░░ 0.0%
Hack +1/ -1 █████████████████████100.0%
@PartTimeLegend
PartTimeLegend / win-temp.yml
Created January 10, 2023 16:47
House Keeping Temp Files
- name: House Keeping Temp Files
hosts: "all"
ignore_errors: yes
ignore_unreachable: yes
vars:
age: 3d
# vars_prompt:
tasks:
- name: Setting Facts for Hostname
@PartTimeLegend
PartTimeLegend / namespace-service-account-secret.yaml
Last active January 9, 2023 16:47
k8s namespace, service account, and secret
# In GKE need to get RBAC permissions first with
# kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin [--user=<user-name>|--group=<group-name>]
kind: Namespace
apiVersion: v1
metadata:
name: example
---
apiVersion: v1
kind: ServiceAccount
@PartTimeLegend
PartTimeLegend / pulumi-ubuntu-jammy-wsl.sh
Created September 23, 2022 15:09
Pulumi fails to install on WSL Ubuntu Jammy
#!/usr/bin/env bash
printf '#!/bin/sh\nexec /lib64/ld-linux-x86-64.so.2 /usr/bin/gzip "$@"' | sudo tee /usr/local/bin/gzip
sudo chmod +x /usr/local/bin/gzip
curl -fsSL https://get.pulumi.com | sh
$orgs = @("whereyouwork")
$users = @("parttimelegend")
$githubToken = $ENV:GitHubToken
$workspace = "C:\workspace"
$timeout = 3600
function Clone-Repos-For-Org()
{
param(
[Parameter(Mandatory=$true)][string]$org
@PartTimeLegend
PartTimeLegend / terraforming.ps1
Created July 22, 2021 09:49
Export Terraform from existing AWS Infrastructure with Terraforming
terraforming alb > alb.tf --use-bundled-cert # ALB
terraforming asg > asg.tf --use-bundled-cert # AutoScaling Group
terraforming cwa > cwa.tf --use-bundled-cert # CloudWatch Alarm
terraforming dbpg > dbpg.tf --use-bundled-cert # Database Parameter Group
terraforming dbsg > dbsg.tf --use-bundled-cert # Database Security Group
terraforming dbsn > dbsn.tf --use-bundled-cert # Database Subnet Group
terraforming ddb > ddb.tf --use-bundled-cert # DynamoDB
terraforming ec2 > ec2.tf --use-bundled-cert # EC2
terraforming ecc > ecc.tf --use-bundled-cert # ElastiCache Cluster
terraforming ecsn > ecsn.tf --use-bundled-cert # ElastiCache Subnet Group
import boto3
ec2Client = boto3.client('ec2')
ec2Resource = boto3.resource('ec2')
for instance in ec2Resource.instances.all():
for tag in instance.tags:
if tag['Key'] == 'Name':
list_of_snapshots = []
check_value = []
check_value.append(tag['Value'] + '*')
snapshotsByTag = ec2Client.describe_snapshots(Filters=[{'Name':'tag:Name', 'Values': [check_value[0]]}])['Snapshots']
@PartTimeLegend
PartTimeLegend / OutOfDateNuget.ps1
Created June 2, 2021 09:56
OutOfDateNuget.ps1
dotnet tool update --global dotnet-outdated-tool
$errorCount = 0
Get-ChildItem -Path .\ -Filter *.csproj -Recurse -File -Name| ForEach-Object {
[System.IO.Path]::GetFileNameWithoutExtension($_)
dotnet outdated $_ -f -inc CB. -u
if ($LASTEXITCODE -ne 0)
{
$errorCount++
}
}
variable "az_region" {
type = string
default = "UK South"
}
variable "az_region_abbr_map" {
type = map(any)
description = "Map is used to obtain 3 letter azure region abreviation for naming resources"
default = {
"Central US" = "cus"
"East US 2" = "eus2"