Skip to content

Instantly share code, notes, and snippets.

View ollytheninja's full-sized avatar

Olly E ollytheninja

View GitHub Profile
@ollytheninja
ollytheninja / anchore.sh
Last active September 25, 2020 03:27
How to get Anchore Engine up and running with Helm 3 and Kubernetes quick and easy
# Requires kubernetes and Helm v3 installed
# Install using Helm chart
helm repo add anchore https://charts.anchore.io
helm install anchore-1 anchore/anchore-engine
# Connect to cli
kubectl exec service/anchore-1-anchore-engine-api -it /bin/bash
@ollytheninja
ollytheninja / invalidate_aws_key.py
Created April 20, 2021 03:14
Invalidate AWS access keys
import boto3
from botocore.exceptions import ClientError
def invalidate_key(id, secret):
iam = boto3.client('iam', aws_access_key_id=id, aws_secret_access_key=secret)
try:
iam.update_access_key(
AccessKeyId=id,
import boto3
import botocore
def validate_key(id, secret):
sts = boto3.client('sts', aws_access_key_id=id, aws_secret_access_key=secret)
try:
identity = sts.get_caller_identity()
print('Identity ARN: ' + identity['Arn'])
except botocore.exceptions.ClientError as e:
@ollytheninja
ollytheninja / remove_tag.sh
Created February 3, 2022 20:12
Remove specific lines from a bunch of files
# When you need to remove a tag from a bunch of Terraform
find . -type f -name "*.tf" -exec sed -i -e '/^.*git_commit.*$/d' {} \;
# Probably want to delete the "-e" files that were created for all files that didn't have the tag in them
find . -type f -name "*.tf-e" -delete
@ollytheninja
ollytheninja / find_duplicate_tags.py
Created February 22, 2022 22:39
Find duplicate yor_trace tags
from pathlib import Path
globs = Path(".").glob("*/*.tf")
traces = []
duplicates = []
for glob in globs:
with glob.open() as f:
for line in f:
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up --advertise-tags=tag:server --ssh --accept-routes
sudo tailscale up --advertise-routes=10.1.0.0/24 --advertise-exit-node --advertise-tags=tag:server,tag:demo --ssh --accept-routes
@ollytheninja
ollytheninja / ssh_config
Last active April 5, 2022 04:19
Handy defaults to add to your ~/.ssh/config file
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
Host pi
HostName raspberrypi.local
User pi
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
#!/bin/bash
# First copy your ssh key over
ssh-copy-id pi
# then ssh to the pi
ssh pi
# change the default password
sudo passwd pi
#!/bin/bash
# Install relevant dependencies for NFS / Longhorn
sudo apt install nfs-common open-iscsi
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="---options---" sh -
Options:
--disable traefik
--disable servicelb
@ollytheninja
ollytheninja / helm-repos.sh
Created May 9, 2022 05:07
Helm repos that might be useful!
#!/bin/bash
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add k8s-at-home https://k8s-at-home.com/charts/
helm repo add mojo2600 https://mojo2600.github.io/pihole-kubernetes/
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add stable https://charts.helm.sh/stable
helm repo add devtron https://helm.devtron.ai
helm repo add fluxcd https://charts.fluxcd.io