Skip to content

Instantly share code, notes, and snippets.

Avatar

Steven Hollingsworth shollingsworth

  • Barracuda Networks
  • United States
  • Twitter @_stevo
View GitHub Profile
@shollingsworth
shollingsworth / git-modified-files.py
Created Oct 27, 2022
List git modified files for use in something like vim.
View git-modified-files.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""List git modified files for use in something like vim."""
import subprocess
def main():
"""Run main function."""
edit_keys = {
"A",
@shollingsworth
shollingsworth / convert_jq_key_value_to_aws_tags_array.sh
Last active Sep 14, 2022
AWS tags - convert a json key value {"foo": "bar", "baz": "qux"} to [{ "Key": "foo", "Value": "bar"}, {"Key": "baz", "qux"}]
View convert_jq_key_value_to_aws_tags_array.sh
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
TAGS_JSON=$(
cat <<EOF
{
"foo": "bar",
"baz": "qux"
}
@shollingsworth
shollingsworth / rewrite.py
Created Aug 15, 2022
threaded aws s3 bulk object modify and move
View rewrite.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""bulk object modify and move."""
import concurrent.futures as cf
import json
import boto3
from mypy_boto3_s3.service_resource import Bucket, ObjectSummary
BUCKET_NAME = "some-bucket"
@shollingsworth
shollingsworth / .00README.md
Last active Aug 10, 2022
Scaffold for serverless directory with layer, log retention, and http wildcard http api gateway
View .00README.md

Scaffold for serverless directory with layer, log retention, and http wildcard http api gateway

Deploy

  • Run yarn
  • Edit ./config.yaml as needed
  • Edit ./serverless.yml as needed
  • Run make build
  • Run make deploy

Delete

@shollingsworth
shollingsworth / .00_README.md
Last active Aug 6, 2022
Get a Reverse Shell with Only egress tcp/443 (i.e. AWS Training Environments)
View .00_README.md

Prep

  • Download the zip ^ in this gist and unzip into a project directory.
  • On your home internet gateway, port forward 443 to your internal ip port 2222

Instructions


  • Remote
@shollingsworth
shollingsworth / common_strings_multiple_files.py
Created Jul 13, 2022
Find common strings in multiple files
View common_strings_multiple_files.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Find common strings in multiple files."""
import argparse
from io import BytesIO
from pathlib import Path
import tokenize
def _itertokens(file: Path):
View all_git_files_in_history.sh
git log --pretty=format: --name-only --diff-filter=A
@shollingsworth
shollingsworth / box.go
Created Jun 26, 2022
example of using golang box to encrypt / decrypt
View box.go
package crypt
import (
crypto_rand "crypto/rand"
"encoding/hex"
"io"
"golang.org/x/crypto/nacl/box"
)
@shollingsworth
shollingsworth / aws_log_dump.py
Created Jun 17, 2022
Dump AWS logs entries by in timestamp range
View aws_log_dump.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Dump AWS logs entries by in timestamp range"""
import argparse
from datetime import datetime
import logging
import json
import boto3
@shollingsworth
shollingsworth / open_api_typescript_generator.sh
Created Jun 17, 2022
generate typescript openapi library from openapi json file via docker command
View open_api_typescript_generator.sh
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DIR="$(dirname "$(readlink -f "$0")")"
GENERATED_DEST="${DIR}/frontend/src/lib/generatedapi"
OPENAPI_FILE="${DIR}/openapi.json"
test -d "${GENERATED_DEST}" || rm -rfv "${GENERATED_DEST}"
mkdir -p "${GENERATED_DEST}"