Skip to content

Instantly share code, notes, and snippets.

Avatar

Russ Sayers russau

View GitHub Profile
View polling.py
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 = {
View docker q3 setup
sudo yum install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
wget https://raw.githubusercontent.com/nrempel/q3-server/master/baseq3/pak0.pk3 -O pak0.pk3
wget https://github.com/InAnimaTe/docker-quake3/raw/master/server.cfg.example -O server.cfg
docker run -d \
@russau
russau / Function.cs
Created Mar 14, 2021
.NET debugging lambda
View Function.cs
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.
View docker-compose.yml
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:6.0.0-1-ubi8
restart: always
container_name: zookeeper
ports:
- 2181:2181
environment:
View global-key.sh
#!/bin/bash
keyname="uncle-russ"
echo "Creating private $keyname.pem"
openssl genrsa -out $keyname.pem 2048
echo "Creating public $keyname.pub"
openssl rsa -in $keyname.pem -pubout > $keyname.pub
regions=($(aws ec2 describe-regions --query 'Regions[*].RegionName' --output text))
for region in "${regions[@]}"
do
@russau
russau / check_certs.sh
Last active Nov 29, 2020
Cert checker
View check_certs.sh
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 | openssl x509 -startdate -noout | grep notBefore
done
@russau
russau / infrastructure.yml
Last active Nov 28, 2020
Scheduled Lamba function posts your AWS spend to a slack webhook
View infrastructure.yml
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 / lights-api.yaml
Last active Jul 16, 2020
An API for blinking lights
View lights-api.yaml
openapi: "3.0.0"
info:
title: Lights
version: "1.0"
servers:
- url: http://localhost:9090/v1.0
paths:
/random:
View docker_challenge.py
# 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: