Skip to content

Instantly share code, notes, and snippets.

View james-jory's full-sized avatar

James Jory james-jory

  • AWS
View GitHub Profile
@james-jory
james-jory / major_us_city_dma_codes.py
Created October 5, 2021 12:25 — forked from sillypog/major_us_city_dma_codes.py
Major US Cities with Latitude/Longitude and DMA Codes
# Major US Cities with DMA Codes
major_cities = [
{'city': 'Ada', 'dma_code': 657, 'latitude': 34.774531000000003, 'longitude': -96.678344899999999, 'region': 'OK', 'slug': 'ada-ok'},
{'city': 'Akron', 'dma_code': 510, 'latitude': 41.081444699999999, 'longitude': -81.519005300000003, 'region': 'OH', 'slug': 'akron-oh'},
{'city': 'Albany', 'dma_code': 525, 'latitude': 31.578507399999999, 'longitude': -84.155741000000006, 'region': 'GA', 'slug': 'albany-ga'},
{'city': 'Alexandria', 'dma_code': 644, 'latitude': 31.311293599999999, 'longitude': -92.445137099999997, 'region': 'LA', 'slug': 'alexandria-la'},
{'city': 'Alpena', 'dma_code': 583, 'latitude': 45.061679400000003, 'longitude': -83.432752800000003, 'region': 'MI', 'slug': 'alpena-mi'},
{'city': 'Altoona', 'dma_code': 574, 'latitude': 40.5186809, 'longitude': -78.394735900000001, 'region': 'PA', 'slug': 'altoona-pa'},
{'city': 'Amarillo', 'dma_code': 634, 'latitude': 35.221997100000003, 'longitude': -101.8312969, 'region': 'TX', 'slug': 'amarillo-tx'},
@james-jory
james-jory / aws_personalize_delete_dsg.py
Last active March 27, 2024 16:25
Deletes an Amazon Personalize dataset group, including all of its associated resources
#!/usr/bin/env python
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
"""
Deletes one or more Amazon Personalize dataset groups, including all of their associated resources:
- Recommenders
- Campaigns
- Filters
@james-jory
james-jory / aws_personalize_training_cost_calculator.py
Last active July 8, 2020 20:19
Calculates total training hours cost (for all time) for one or more Amazon Personalize solutions
'''
Calculates total training hours cost (for all time) for one or more Amazon Personalize solutions.
Total training hours and costs across AWS regions as well as grand totals will be printed as output.
By default, the script will calculate the costs for all solutions in the default AWS region (as
configured in your local environment). Alternatively, you can pass a filename as an argument to
the script where the filename points to a text file containing one or more Amazon Personalize
solution ARNs (1 per line). The solution ARNs in the file can come from multiple regions.
'''
@james-jory
james-jory / aws_dereg_task_def.sh
Created April 13, 2020 01:55
Deregisters AWS ECS task definitions using an optional filter expression
#!/bin/bash
# Deregisters AWS ECS task definitions based on a filter expression. The optional --dry-run
# argument can be used to test filter expressions before deleting.
TASK_DEF_FILTER=""
DRY_RUN="N"
THIS_SCRIPT=$0
function usage() {
@james-jory
james-jory / aws_delete_log_groups.sh
Last active April 10, 2020 16:49
Delete AWS log groups using an optional filter expression
#!/bin/bash
# Deletes AWS log groups based on a filter expression. The optional --dry-run
# argument can be used to test filter expressions before deleting.
LOG_GROUP_FILTER=""
DRY_RUN="N"
THIS_SCRIPT=$0
function usage() {