Skip to content

Instantly share code, notes, and snippets.

View shollingsworth's full-sized avatar

Steven Hollingsworth shollingsworth

View GitHub Profile
git log --all -G 'tmp:'
@shollingsworth
shollingsworth / test_aws_api_gateway_auth_cors.sh
Created February 20, 2022 22:00
curl / test cors for a aws api gateway
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
## Should get OK as a response
endpoint='https://xxxxxx.execute-api.us-east-2.amazonaws.com/tag/default'
myorigin='https://xxxxxx.com'
curl "${endpoint}" \
-X 'OPTIONS' \
@shollingsworth
shollingsworth / gisty.py
Last active June 16, 2022 20:25
wrapper for github gist cli using FZF to quickly modify / add new gists and have them readily searchable Demo: https://media.giphy.com/media/CXVjpox5Iq0lYSPaRw/giphy.gif
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Wrapper for GH Gist CLI.
Demo:
Start Daemon (listen for changes):
~/.bashrc:
test -f ~/.cache/gist_refresh.pid || gisty.py daemon &
@shollingsworth
shollingsworth / stash_get_all_users.py
Created February 19, 2022 00:34
Iterate through all users in stash server to get list of users sorted on active status and last logged in time
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Iterate over all users in a Stash repository."""
import json
import sys
from datetime import datetime
import requests
token = "XXXXXXXXX"
@shollingsworth
shollingsworth / gh_actions_environment_variables.txt
Last active February 18, 2022 23:28
list of github actions environment variables as of 2022-02-11
ACCEPT_EULA=Y
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
ANDROID_HOME=/usr/local/lib/android/sdk
ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk-bundle
ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/23.1.7779620
ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk-bundle
ANDROID_SDK_ROOT=/usr/local/lib/android/sdk
ANT_HOME=/usr/share/ant
AZURE_EXTENSION_DIR=/opt/az/azcliextensions
BOOTSTRAP_HASKELL_NONINTERACTIVE=1
@shollingsworth
shollingsworth / dump_org_structure.py
Last active February 11, 2022 01:14
Dump AWS org structure and policies with boto3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Dump AWS Org structure and policies."""
import argparse
import json
import os
from collections import deque
from dataclasses import dataclass
from typing import Any, Optional
@shollingsworth
shollingsworth / github.ts
Last active April 5, 2023 17:55
cdk v2 github provider and role template for github actions cloudformation
import * as iam from "@aws-cdk/aws-iam";
import * as cdk from "@aws-cdk/core";
import * as aws_ssm from "@aws-cdk/aws-ssm";
import { Config } from "../config";
function chunk(arr: Array<any>, chunkSize: number) {
if (chunkSize <= 0) throw "Invalid chunk size";
var R = [];
for (var i = 0, len = arr.length; i < len; i += chunkSize)
R.push(arr.slice(i, i + chunkSize));
@shollingsworth
shollingsworth / dot-git-config.cfg
Last active February 10, 2022 07:37
git config allowing to push to multiple repos simultaneously
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "stash"]
url = ssh://[email protected]:7999/org/reponame.git
[remote "github"]
@shollingsworth
shollingsworth / list_codecs.py
Created February 10, 2022 03:21
python list all codecs
""" List all available codec modules.
(c) Copyright 2005, Marc-Andre Lemburg ([email protected]).
Licensed to PSF under a Contributor Agreement.
"""
import codecs
import encodings
import os
@shollingsworth
shollingsworth / graph_plot_multiple_axis.py
Created February 10, 2022 03:20
plotly graph plot multiple axis
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
from datetime import datetime
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# data sample