Skip to content

Instantly share code, notes, and snippets.

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllPermissionsExceptIAMUserOrRole",
"Effect": "Allow",
"NotAction": [
"iam:CreateUser",
"iam:AttachUserPolicy",
"iam:PutUserPolicy",
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllPermissionsExceptIAMUserOrRole",
"Effect": "Allow",
"NotAction": [
"iam:CreateUser",
"iam:AttachUserPolicy",
"iam:PutUserPolicy",
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllPermissionsExceptIAMUserOrRole",
"Effect": "Allow",
"NotAction": [
"iam:CreateUser",
"iam:AttachUserPolicy",
"iam:PutUserPolicy",
@bzcorn
bzcorn / ultra_to_r53.py
Created February 1, 2019 20:32
Simple script to extract data from ultradns to route53
import ultra_rest_client
import boto3
from botocore.exceptions import ClientError
def create_record(rname, rtype, ttl, resource_record_list):
record = {
'Action': 'UPSERT',
'ResourceRecordSet': {
'Name': rname,
@bzcorn
bzcorn / set_sts_tokens.py
Last active February 26, 2019 19:47
This script will take the output of an aws sts assume-role and automatically export it into your Env Vars.
import sys
import json
def main(PIPED_IN):
"""
"""
a = json.loads(PIPED_IN)
env_var_values = ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
sts_values = ["AccessKeyId", "SecretAccessKey", "SessionToken"]
@bzcorn
bzcorn / aws_log_splitter.py
Created November 19, 2018 09:52
This is for a lambda to respond to new cloudtrail or config logs hitting an s3 bucket and forwarding to sumologic. Some logs are >65kb in size and need to be broken up and sent to Sumologic. Package this (along with the requisite python libs) and have it listen to ObjectCreate events in your S3 bucket that cloudtrail/config logs are sent to. Thi…
import aiohttp
import asyncio
import async_timeout
import gzip
import os
import json
import boto3
import urllib.parse
import botocore
@bzcorn
bzcorn / mingle_to_trello.py
Last active June 5, 2019 04:05
This takes exported mingle card data and pushes it to trello
'''
MIT License
Copyright (c) 2019 Ben Cornelius
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
"use strict";
const OktaJwtVerifier = require("@okta/jwt-verifier");
console.log("Loading function");
const issuer = "https://dev-XXXXX.oktapreview.com/oauth2/default";
const cid = "";
exports.handler = (event, context, callback) => {
const verifier = new OktaJwtVerifier({
@bzcorn
bzcorn / mac runner
Created May 13, 2017 05:23
Scripts to get up and running on a new mac
brew install wget
brew install cask
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
brew cask install \
google-chrome \
sublime-text \
dropbox \
firefox \
spotify \
@bzcorn
bzcorn / .bash_profile
Last active May 13, 2017 05:13 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management