Skip to content

Instantly share code, notes, and snippets.

View russau's full-sized avatar

Russ Sayers russau

View GitHub Profile
keys=($(aws sts assume-role --role-arn "arn:aws:iam::012345678912:role/ec2-readonly-role" \
--role-session-name session1 \
--query "[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]" \
--output text))
export AKI=${keys[1]} ; export SAK=${keys[2]} ; export ST=${keys[3]}
curl 'https://ec2.ap-southeast-2.amazonaws.com/?Action=DescribeInstances' \
--aws-sigv4 aws:amz:ap-southeast-2:ec2 \
--user "${AKI}:${SAK}" \
package main
import (
"context"
b64 "encoding/base64"
"fmt"
awsconfig "github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/eks"
"github.com/aws/aws-sdk-go-v2/service/sts"
from pynput import keyboard
from pynput.keyboard import Key
import subprocess
file1 = open('clipboard.txt', 'r')
lines = file1.readlines()
controller = keyboard.Controller()
def copyAndPasta(command):
@russau
russau / README.md
Last active October 26, 2021 02:41
Extract Certificate from Vaccination QR

Getting my head around the QR codes in the International COVID-19 Vaccination Certificate. This will run in a ubuntu:20.04 container.

  • zbarimg decodes the QR
  • sed replaces out the non-json I don't want
  • jq gets the certificate from the json
  • tr convert from base64url to base64
  • openssl to dump the certificate
import boto3
import json
import sys
# Create SQS client
sqs = boto3.client('sqs')
queue_url = 'https://sqs.ap-southeast-2.amazonaws.com/414514743156/pipeline-events'
COLOR = {
@russau
russau / Function.cs
Created March 14, 2021 23:42
.NET debugging lambda
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Amazon.Lambda.Core;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
@russau
russau / docker-compose.yml
Created February 13, 2021 06:30
Single node kafka
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:6.0.0-1-ubi8
restart: always
container_name: zookeeper
ports:
- 2181:2181
environment:
@russau
russau / infrastructure.yml
Last active November 28, 2020 00:59
Scheduled Lamba function posts your AWS spend to a slack webhook
Description: Lambda function to post the spend into a slack webhook
Parameters:
Schedule:
Description: The rule schedule expression, defaults to every 8 hours
Default: "rate(8 hours)"
Type: String
SlackHook:
Description: The entire url of the slack webhook, e.g. https://hooks.slack.com/services/TABCDEFGH/BABCDEFGHIK/abcdefghijklmmopqrstuvwx
@russau
russau / check_certs.sh
Last active January 11, 2024 07:59
Cert checker
for domain in labsportal.net guacz-us-west-2.labsportal.net \
guacz-ap-southeast-2.labsportal.net \
guacz-eu-central-1.labsportal.net \
guacz-ap-south-1.labsportal.net
do
echo "Domain: ${domain}"
echo | openssl s_client -connect sub.${domain}:443 2>&1 | openssl x509 -startdate -enddate -noout 2>&1 | grep -E 'notBefore|notAfter'
echo
done