Skip to content

Instantly share code, notes, and snippets.

View JJediny's full-sized avatar

John Jediny JJediny

View GitHub Profile
@tmcw
tmcw / xyz_vs_tms.md
Last active March 3, 2025 22:38
The difference between XYZ and TMS tiles and how to convert between them

The difference between XYZ and TMS tiles and how to convert between them

Lots of tile-based maps use either the XYZ or TMS scheme. These are the maps that have tiles ending in /0/0/0.png or something. Sometimes if it's a script, it'll look like &z=0&y=0&x=0 instead. Anyway, these are usually maps in Spherical Mercator.

Good examples are OpenStreetMap, Google Maps, MapBox, MapQuest, etc. Lots of maps.

Most of those are in XYZ. The best documentation for that is slippy map tilenames on the OSM Wiki, and Klokan's Tiles a la Google.

@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.
@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
@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'
@kytulendu
kytulendu / install-opencl-amd.sh
Last active January 4, 2025 23:31
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.
@lizthegrey
lizthegrey / attributes.rb
Last active March 27, 2025 02:16
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'
## 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
@lukeplausin
lukeplausin / auto_configure_aws_cli_sso_roles.sh
Last active February 3, 2025 09:28
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.
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