Skip to content

Instantly share code, notes, and snippets.

Gene Wood gene1wood

Block or report user

Report or block gene1wood

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gene1wood / watch-for-new-media.bash
Created May 10, 2020
Script to create inotifywait on directories to trigger Subsonic media scanning
View watch-for-new-media.bash
dirs="/path/to/first/dir /path/to/second/dir /path/to/third/dir"
# act="cat"
/bin/inotifywait --monitor --recursive --quiet --format '%w' --event create,moved_to $dirs | while read f
$act "$f"
gene1wood /
Created May 10, 2020
Script to trigger a Subsonic media rescan with locking
#!/bin/env python
import sys
import requests
import os
import os.path
import time
import logging
import subprocess
import json
gene1wood /
Last active Feb 3, 2020
Script to check what AWS IAM users and roles have rights to perform an action
#!/usr/bin/env python
import sys
import boto3
def get_paginated_results(product, action, key, credentials=None, args=None):
args = {} if args is None else args
return [y for sublist in [x[key] for x in boto3.client(product, **({} if credentials is None else credentials)).get_paginator(action).paginate(**args)] for y in sublist]
gene1wood /
Created Jan 22, 2020
How to deal with a Google Pixel with a broken power button
gene1wood /
Created Dec 31, 2019
The sequence of events triggered for a CloudFormation custom resource backed by an AWS Lambda function

Create a stack

    "event": {
        "StackId": "arn:aws:cloudformation:us-west-2:656532927350:stack/genetest2/c6c0c040-c5ee-11e9-9ec7-0ad236afdc80",
        "ResponseURL": "",
        "ResourceProperties": {
            "ServiceToken": "arn:aws:lambda:us-west-2:656532927350:function:genetest2-ExampleFunction-NQLOVV15EHNT",
            "Param": "alpha"
gene1wood /
Created Dec 20, 2019
Some exploration around what would be needed to simplify (through code) the process of releasing python package versions
  • Make sure has all new functionality you want in the release

    • Summarize changes since last release that are missing from Unreleased
  • Pick new version based on semver rules

  • Run unit tests / tox

  • Run flake8

  • Check to ensure

    • There are contents in unreleased
    • The new version number isn't present
  • Verify version is newer than newest version in

Num Tool Name Executable Name
1 AMS (Amazon Mozilla Services) CLI ams
2 Auth0 for AWS aws-auth0
3 AWS login proxy aws-download-keys
4 AWS Single Sign-On aws_sso
5 AWS SSO CLI aws-sso
6 AWS SSO Login aws_sso_login
7 aws_secure aws_secure
8 aws-fed aws-fed
gene1wood /
Last active Apr 9, 2020
How to configure CloudFront using CloudFormation to pass all headers

How to configure CloudFront using CloudFormation to pass all headers

How can you configure a CloudFront distribution to pass all headers to the origin if the CloudFront distribution is deployed using CloudFormation? If you deploy the distribution in the AWS Web Console, you can select between None, Whitelist and All. In CloudFront it appears that you can only assert a whitelist of allowed headers. This is done in this area of a CloudFormation resource describing a CloudFront distribution

    Type: AWS::CloudFront::Distribution
gene1wood /
Last active May 13, 2020
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`

Python relative imports in AWS Lambda fail with attempted relative import with no known parent package

The Problem

In AWS Lambda if I attempt an explicit relative import like this

You can’t perform that action at this time.