Skip to content

Instantly share code, notes, and snippets.

View russau's full-sized avatar

Russ Sayers russau

View GitHub Profile
@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
@russau
russau / lights-api.yaml
Last active July 16, 2020 08:13
An API for blinking lights
openapi: "3.0.0"
info:
title: Lights
version: "1.0"
servers:
- url: http://localhost:9090/v1.0
paths:
/random:
# when you type the id of a docker container into a command like `docker exec` you can
# type just the "prefix" characters needed to uniquely identify the container name
# Challenge: write a function that takes a list of container ids and outputs the prefixes that
# would uniquely identify the an id in the list.
import sys
if not sys.stdin.isatty():
# grab the list of containers from stdin
# so you can use it from the command line like this:
@russau
russau / Dockerfile
Created July 12, 2020 03:12
Minimal docker container with a multi-stage build
FROM golang:1.14
WORKDIR /go/src/app
COPY . .
RUN go build hello-world.go
FROM scratch
COPY --from=0 /go/src/app/hello-world .
CMD ["./hello-world"]
@russau
russau / certificate
Last active January 13, 2022 10:39
Verify EC2 PKCS7 Signature in Python
-----BEGIN CERTIFICATE-----
MIIC7TCCAq0CCQCWukjZ5V4aZzAJBgcqhkjOOAQDMFwxCzAJBgNVBAYTAlVTMRkw
FwYDVQQIExBXYXNoaW5ndG9uIFN0YXRlMRAwDgYDVQQHEwdTZWF0dGxlMSAwHgYD
VQQKExdBbWF6b24gV2ViIFNlcnZpY2VzIExMQzAeFw0xMjAxMDUxMjU2MTJaFw0z
ODAxMDUxMjU2MTJaMFwxCzAJBgNVBAYTAlVTMRkwFwYDVQQIExBXYXNoaW5ndG9u
IFN0YXRlMRAwDgYDVQQHEwdTZWF0dGxlMSAwHgYDVQQKExdBbWF6b24gV2ViIFNl
cnZpY2VzIExMQzCCAbcwggEsBgcqhkjOOAQBMIIBHwKBgQCjkvcS2bb1VQ4yt/5e
ih5OO6kK/n1Lzllr7D8ZwtQP8fOEpp5E2ng+D6Ud1Z1gYipr58Kj3nssSNpI6bX3
VyIQzK7wLclnd/YozqNNmgIyZecN7EglK9ITHJLP+x8FtUpt3QbyYXJdmVMegN6P
hviYt5JH/nYl4hh3Pa1HJdskgQIVALVJ3ER11+Ko4tP6nwvHwh6+ERYRAoGBAI1j
  • 52.41.18.116 -> 10.0.1.100
  • 54.68.20.222 -> 10.0.1.200
echo 'export KAFKA_HEAP_OPTS="-Xmx1000M"' >> ~/.bashrc
wget --content-disposition https://downloads.apache.org/kafka/2.5.0/kafka_2.12-2.5.0.tgz
tar -xzf kafka_2.12-2.5.0.tgz
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.