Skip to content

Instantly share code, notes, and snippets.

View PartTimeLegend's full-sized avatar

Antony Bailey PartTimeLegend

View GitHub Profile
🌞 Morning 158 commits ██████▊░░░░░░░░░░░░░░ 32.7%
🌆 Daytime 227 commits █████████▊░░░░░░░░░░░ 47.0%
🌃 Evening 98 commits ████▎░░░░░░░░░░░░░░░░ 20.3%
🌙 Night 0 commits ░░░░░░░░░░░░░░░░░░░░░ 0.0%
YAML +11/ -11 █████████████████████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
import json, botocore
from boto3.session import Session
def serialize_sets(obj):
if isinstance(obj, set):
return list(obj)
return obj
s = Session()
regions = s.get_available_regions('lambda')
$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++
}
}