Skip to content

Instantly share code, notes, and snippets.

@seansummers
seansummers / convert.json
Created March 29, 2018 17:39 — forked from ssummer3/convert.json
Contentful Stuffs
{
"universityarchives": "5561",
"reservesmicrotextandmediadesk": "5557",
"medievalinstitutelibrary": "5558",
"circulationservicedesk": "1483",
"engineeringlibrary": "5566",
"architecturelibrary": "5563",
"kelloggkroclibrary": "5567",
"mahaffeybusinesslibrary": "5564",
"chemistryphysicslibrary": "5565",
@seansummers
seansummers / newbase60.py
Last active May 15, 2025 12:33
Python implementation of Tantek's NewBase60
# /// script
# requires-python = ">=3.4"
# dependencies = []
# ///
"""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/
@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 / 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 / Python Utilities.md
Last active May 14, 2025 18:35
Possibly useful Python functions

Python Utilities

Possibly useful Python functions

  • dns_dict.py : DNS[host] returns randomized ipaddress from system DNS, honoring TTL
  • totp.py : A zero dependency TOTP token generator
  • snake_camel.py : convert between snake_case, camelCase, and PascalCase
@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 / 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
from pyparsing import Literal, nums, Word, Optional, Combine, delimitedList, Suppress
def parse_integer(s, l, t):
return int(t[0])
def parse_integer_range(s, l, t):
x, y = t[0], t[-1]
x, y = min(x, y), max(x, y) + 1
@seansummers
seansummers / redirect_java_stdout.py
Last active March 23, 2016 11:14
Jython contextmanager to provide redirect_stdout
'''Wouldn't it be nice if sys.stdout knew how to redirect the JVM's stdout? Shooting star.
Author: Sean Summers <seansummers@gmail.com> 2015-09-28 v0.1
Permalink: https://gist.githubusercontent.com/seansummers/bbfe021e83935b3db01d/raw/redirect_java_stdout.py
'''
from java import io, lang
from contextlib import contextmanager
@contextmanager
@seansummers
seansummers / internet_checksum.gawk
Last active September 15, 2015 18:42
RFC1071 Internet Checksum -- gawk
#! /usr/bin/gawk
# RFC1071 Computing the Internet Checksum (in gawk)
# written by Sean Summers <seansummers@gmail.com> 2015-09-15 v0.1
#
# use '@include "internet_checksum.gawk"' to include in a script
function _ord_init(low, high, i, t) {
# creates _ord_ array for ascii lookup
low = 0; high = 127;
for (i = low; i <= high; i++) {