Skip to content

Instantly share code, notes, and snippets.

View JJediny's full-sized avatar

John Jediny JJediny

View GitHub Profile
@sebsto
sebsto / assume_root_credentials.sh
Last active July 9, 2025 19:58
Assume Root on AWS member accounts
#!/bin/bash
AWS_ACCOUNT_ID=012345678901
# Check if jq is installed
if ! command -v jq &> /dev/null; then
echo "Error: jq is not installed. Please install jq to parse JSON."
exit 1
fi
require 'open-uri'
require 'json'
require 'csv'
api_key = "YOUR-API-DATA-GOV-API-KEY-THAT-IS-ALSO-ENTERED-IN-TOUCHPOINTS-GOES-HERE"
url = "https://api.gsa.gov/analytics/touchpoints/v1/websites.json?API_KEY=#{api_key}"
# Make the API request
response = URI.open(url).read
@lukeplausin
lukeplausin / auto_configure_aws_cli_sso_roles.sh
Last active July 15, 2025 07:43
Automatically configure AWS SSO configuration file for all available accounts and roles
#!/bin/bash -e
# How to use this script:
# 1. Follow these instructions to configure a single AWS account to do initial login with SSO
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html
# 2. Export AWS_PROFILE=... and then run "aws sso login" to get an SSO token
# 3. Once signed in with AWS SSO, run this script to automatically list out all the other accounts and roles and add them to your config file
# If you want to filter roles / accounts in the process, or validate config before committing it, you can customise the script to do this.
@Julian88Tex
Julian88Tex / RequestLibrarySuccessExample.robot
Last active August 29, 2025 20:18
A Robot Framework API test example using RequestLibrary
# Run Command: cci task run robot -o suites robot/NPSP/tests/api/success.robot -o vars BROWSER:headlesschrome
[Documentation] Success POST test.
*** Settings ***
Resource cumulusci/robotframework/Salesforce.robot
Resource robot/Cumulus/resources/NPSP.robot
Library DateTime
Library robot/NPSP/resources/RequestsLibrary/
## Will successfully install amdgpu drivers and rocm,
## but pointless as there is no gpu device attached to WSL2 (only CUDA and DirectML is supported, not /dev/kfd or amd gpus)
## ROCM/HIP
sudo apt update
sudo apt dist-upgrade
sudo apt install libnuma-dev
wget -q -O - http://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
echo 'deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main' | sudo tee /etc/apt/sources.list.d/rocm.list
@lizthegrey
lizthegrey / attributes.rb
Last active August 29, 2025 15:40
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@kytulendu
kytulendu / install-opencl-amd.sh
Last active August 12, 2025 01:32
A shell script to install AMDGPU-PRO OpenCL driver.
#!/bin/bash
# This script will install AMDGPU-PRO OpenCL and Vulkan support.
#
# For Ubuntu and it's flavor, just install the package using this command
# in extracted driver directory instread.
#
# ./amdgpu-pro-install --opencl=legacy,pal --headless --no-dkms
#
# For Arch Linux or Manjaro, use the opencl-amd or rocm-opencl-runtime on AUR instread.
@afeld
afeld / README.md
Created July 9, 2018 06:39
redact IP addresses in output

When running a command with output that will be publicly available, you may not want to show IP addresses. This might come up with output from a freemium continuous integration (CI) service like TravisCI or CircleCI, for example. Pipe output into the following command to redact the first three segments:

sed -E 's/[0-9]+\.[0-9]+\.[0-9]+\.([0-9]+)/███.███.███.\1/g'

The squares are the Unicode "full block" character. Example use:

$ ansible-playbook -i digital_ocean.py --list-hosts playbooks/test.yml | sed -E 's/[0-9]+\.[0-9]+\.[0-9]+\.([0-9]+)/███.███.███.\1/g'
@JJediny
JJediny / NISTFramework-ImprovingCriticalInfrastructureCybersecurity_v11.yml
Last active August 6, 2020 19:27
Updated to Draft v1.1 on 1/13/2017. YAML representation of the NIST Framework for Improving Critical Infrastructure Cybersecurity https://www.nist.gov/cyberframework
# Source: NIST Framework for Improving Critical Infrastructure Cybersecurity https://www.nist.gov/cyberframework
# Updated: 1/13/2017 - Updated with Draft v1.1 https://www.nist.gov/cyberframework/draft-version-11
---
# NIST CSF has three levels: Function -> Category -> Subcategory
################
# Function #
################
-
Title: Identify
@rclark
rclark / Issues.md
Last active July 9, 2024 20:16
Leaflet WMS + GetFeatureInfo

There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:

  1. You have to rely on an AJAX request, this example uses jQuery
  2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
  3. Output formats. The info_format parameter in the request. We don't know a priori which will be supported by a WMS that we might make a request to. See Geoserver's docs for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
  4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.