Skip to content

Instantly share code, notes, and snippets.

View seansummers's full-sized avatar
:octocat:
South Bend, IN

Sean Summers seansummers

:octocat:
South Bend, IN
View GitHub Profile
@seansummers
seansummers / gh-pages.sh
Created April 7, 2016 19:24 — forked from skratchdot/gh-pages.sh
Initialize gh-pages branch
# create gh-pages branch
git checkout --orphan gh-pages
git rm -rf .
touch README.md
git add README.md
git commit -m 'initial gh-pages commit'
git push origin gh-pages
# add gh-pages as submodule
git checkout master
@seansummers
seansummers / assume-role.sh
Last active April 18, 2016 17:32
AWS cli utility scripts
#! /bin/bash
# 1) rename or link the name of the role you want to assume to this file
# : ln -s <this script> account-superAdmin
# 2) make sure you have a matching profile in ~/.aws/config
# : [profile account-superAdmin]
# : source_profile = account
# : role_arn = arn:aws:iam::<account number>:role/superAdmin
# : mfa_serial = arn:aws:iam::<account number>:mfa/<iam user>
# 3) run this script with . (aka source) to export the variables
@seansummers
seansummers / dns_dict.py
Created June 28, 2016 23:18
DNS dict. __getitem__ any host, and it returns a randomized ipaddress from system DNS, honoring TTL
import random
import time
# if python2, install these batteries first
# ipaddress
import ipaddress
# dnspython
import dns.resolver
@seansummers
seansummers / dabblet.html
Created September 24, 2016 19:47
Untitled
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/>
<link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.pink-blue.min.css" />
Hello World
<hr />
<!-- Colored FAB button -->
<button class="mdl-button mdl-js-button mdl-button--fab mdl-button--colored">
<i class="material-icons">add</i>
</button>
<script defer src="https://code.getmdl.io/1.2.1/material.min.js"></script>
@seansummers
seansummers / totp.py
Last active April 6, 2017 21:14
Software TOTP
'''
RFC4226 and RFC6238
otpauth://totp/$LABEL?secret=$SECRET
'''
import base64
import hashlib
import hmac
import time
@seansummers
seansummers / instance_verifier.py
Last active May 23, 2017 12:27
EC2 instance verifier
"""
ssh_key=$(cut -f2 -d\ /etc/ssh/ssh_host_ed25519_key.pub)
document=$(curl -s http://169.254.169.254:/latest/dynamic/instance-identity/document |base64 -w 0)
signature=$(curl -s http://169.254.169.254:/latest/dynamic/instance-identity/signature |tr -d '\n')
curl -s http://169.254.169.254/latest/dynamic/instance-identity/signature |base64 -d |openssl rsautl -verify -inkey AWS.rsa -certin
"""
import json
from os import environ
@seansummers
seansummers / newbase60.py
Last active December 4, 2017 21:11
Python implementation of Tantek's NewBase60
''' newbase60.py - Python implementation of Tantek's NewBase60
http://ttk.me/w/NewBase60
by Sean Summers <seansummers@gmail.com>
License: https://creativecommons.org/licenses/by/4.0/
'''
import functools
import itertools
import string
AMBIGUOUS_CHARACTERS = {
@seansummers
seansummers / codebuild.py
Created December 8, 2017 05:33
AWS Python
#! /usr/bin/env python
""" local codebuild implementation
Parses buildspec.yml files, and executes them locally, as per:
http://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-example
"""
from __future__ import print_function
import argparse
import contextlib
import functools
@seansummers
seansummers / json2yaml.py
Created December 18, 2017 19:09
YAML, JSON, etc...
#! /usr/bin/env python
from __future__ import print_function
import argparse
import contextlib
import functools
import json
import os
import sys
@seansummers
seansummers / codebuild.py
Created March 29, 2018 17:39 — forked from ssummer3/codebuild.py
Local CodeBuild
#! /usr/bin/env python
""" local codebuild implementation
Parses buildspec.yml files, and executes them locally, as per:
http://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-example
"""
from __future__ import print_function
import functools
import glob
import os