Skip to content

Instantly share code, notes, and snippets.

View AndrewFarley's full-sized avatar

Farley Farley (yes, really) AndrewFarley

  • New Plymouth, New Zealand
View GitHub Profile
@AndrewFarley
AndrewFarley / gitlab-ci.yml
Created January 4, 2023 22:11
Gitlab CI Template example
# Include our pre-engineered Gitlab-CI Templates
include:
# This is our global base and templates, always should be included together
- project: 'devops/gitlab-ci-templates'
ref: master
file: '/base.yml'
- project: 'devops/gitlab-ci-templates'
ref: master
file: '/global-templates.yml'
- project: 'devops/gitlab-ci-templates'
@AndrewFarley
AndrewFarley / gist:a17f9fdf9a22a93a67faa638532c72d6
Last active December 19, 2022 19:38
Setup AWS on Linux, Amazon Linux, Docker, FSX bash script helper. A scratch pad, I always keep randomly looking this stuff up
#!/bin/bash
# If not AWS Amazon Linux, install awscli...
# https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
# Make sure to install curl groff less, eg:
apt-get install curl groff less
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
@AndrewFarley
AndrewFarley / generate-random-1gb-csv.py
Last active April 24, 2024 16:42
This simple Python file generates a random massive CSV file efficiently taking almost no RAM while doing so streaming data into your CSV file. I've pre-done the calculation of the rows/columns to the file-size, so you can easily add or remove zeroes from "rows" variable to increase or decrease the size of the file generated
import csv
import random
# 1000000 and 52 == roughly 1GB (WARNING TAKES a while, 30s+)
rows = 1000000
columns = 52
print_after_rows = 100000
def generate_random_row(col):
a = []
@AndrewFarley
AndrewFarley / annotation-to-add-into-helm-chart.sh
Created May 5, 2022 22:46
create annotations to import resource into helm chart installation
export KIND=PriorityClass
export NAME=workflow-controller
export RELEASE=argo-workflows
export NAMESPACE=argo
kubectl annotate $KIND $NAME meta.helm.sh/release-name=$RELEASE
kubectl label $KIND $NAME app.kubernetes.io/managed-by=Helm
kubectl annotate --overwrite $KIND $NAME meta.helm.sh/release-namespace=$NAMESPACE
@AndrewFarley
AndrewFarley / gist:3cdb7bb2f604f50827bff45910fcd345
Created April 8, 2022 00:38
Sample EKSCTL with YAML Aliases
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: master
region: us-east-1
version: "1.21"
iam:
withOIDC: true
@AndrewFarley
AndrewFarley / usb_hid_keys.h
Created January 13, 2022 10:25 — forked from MightyPork/usb_hid_keys.h
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@AndrewFarley
AndrewFarley / AWS-MFA-Complete.json
Created July 9, 2021 15:29
AWS-MFA-Complete.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowListUsersAllIfMFA",
"Effect": "Allow",
"Action": [
"iam:ListUsers",
"iam:ListPolicies",
"iam:ListGroups",
@AndrewFarley
AndrewFarley / delete-github-actions-old-workflows.py
Created June 26, 2021 17:58
Github Actions API Python script to delete workflows of a specific type
#!/usr/bin/env python3
from ghapi.all import GhApi
import time
import json
api = GhApi()
# If you have rate limit issues, you might need this to check it...
#data = api.rate_limit.get()
#print(data)
#exit(0)
@AndrewFarley
AndrewFarley / multiregional-aws-terraform-providers.tf
Last active June 15, 2021 13:20
A file useful for CloudTrail or Guardduty to be able to iterate on all the AWS Regions easily
# List of all (public) AWS regions as of Jun 15, 2021
locals {
aws_regions_list = [
"ap-northeast-1",
"ap-northeast-2",
"ap-northeast-3",
"ap-south-1",
"ap-southeast-1",
"ap-southeast-2",
"ca-central-1",