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
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
#!/bin/bash
dirs="/path/to/first/dir /path/to/second/dir /path/to/third/dir"
act="/usr/local/bin/act-on-new-media.bash"
# act="cat"
/bin/inotifywait --monitor --recursive --quiet --format '%w' --event create,moved_to $dirs | while read f
do
$act "$f"
done
@gene1wood
gene1wood / rescan_subsonic_media.py
Created May 10, 2020
Script to trigger a Subsonic media rescan with locking
View rescan_subsonic_media.py
#!/bin/env python
import sys
import requests
import os
import os.path
import time
import logging
import subprocess
import json
@gene1wood
gene1wood / who_has_access.py
Last active Feb 3, 2020
Script to check what AWS IAM users and roles have rights to perform an action
View who_has_access.py
#!/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
gene1wood / How-to-deal-with-a-Google-Pixel-with-a-broken-power-button.md
Created Jan 22, 2020
How to deal with a Google Pixel with a broken power button
View How-to-deal-with-a-Google-Pixel-with-a-broken-power-button.md
@gene1wood
gene1wood / cloudformation-custom-resource-event-sequence.md
Created Dec 31, 2019
The sequence of events triggered for a CloudFormation custom resource backed by an AWS Lambda function
View cloudformation-custom-resource-event-sequence.md

Create a stack

{
    "event": {
        "StackId": "arn:aws:cloudformation:us-west-2:656532927350:stack/genetest2/c6c0c040-c5ee-11e9-9ec7-0ad236afdc80",
        "ResponseURL": "https://cloudformation-custom-resource-response-uswest2.s3-us-west-2.amazonaws.com/arn%3Aaws%3Acloudformation%3Aus-west-2%3A656532927350%3Astack/genetest2/c6c0c040-c5ee-11e9-9ec7-0ad236afdc80%7CExample%7Cef8641a2-cac0-4eaf-aed6-df08cd9aae26?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20190823T214203Z&X-Amz-SignedHeaders=host&X-Amz-Expires=7199&X-Amz-Credential=AKIA54RCMT6SG7Y5BKPL%2F20190823%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=a5f9d0ac53360f385b20e9f71a36746d691b2d161bf45ab867a76a858de3e1e0",
        "ResourceProperties": {
            "ServiceToken": "arn:aws:lambda:us-west-2:656532927350:function:genetest2-ExampleFunction-NQLOVV15EHNT",
            "Param": "alpha"
@gene1wood
gene1wood / explore-automating-releasing-python-packages.md
Created Dec 20, 2019
Some exploration around what would be needed to simplify (through code) the process of releasing python package versions
View explore-automating-releasing-python-packages.md
  • Make sure CHANGELOG.md 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 CHANGELOG.md to ensure

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

View trying-to-build-qbittorrent-on-CentOS-7.md
View name-options.md
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
gene1wood / How-to-pass-all-headers-in-CloudFront-using-CloudFormation.md
Last active Apr 9, 2020
How to configure CloudFront using CloudFormation to pass all headers
View How-to-pass-all-headers-in-CloudFront-using-CloudFormation.md

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

Resources:
  CloudFrontDistribution:
    Type: AWS::CloudFront::Distribution
    Properties:
      DistributionConfig:
@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active May 13, 2020
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`
View aws-lambda-relative-import-no-known-parent-package.md

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

.
├── lambda_file.py
└── example.py
You can’t perform that action at this time.