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
| { | |
| "universityarchives": "5561", | |
| "reservesmicrotextandmediadesk": "5557", | |
| "medievalinstitutelibrary": "5558", | |
| "circulationservicedesk": "1483", | |
| "engineeringlibrary": "5566", | |
| "architecturelibrary": "5563", | |
| "kelloggkroclibrary": "5567", | |
| "mahaffeybusinesslibrary": "5564", | |
| "chemistryphysicslibrary": "5565", |
| # /// 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/ |
| """ | |
| 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 |
| <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> |
| #! /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 |
| # 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 |
| '''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 |
| #! /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++) { |