Skip to content

Instantly share code, notes, and snippets.

View gene1wood's full-sized avatar
🎩

Gene Wood gene1wood

🎩
View GitHub Profile
@gene1wood
gene1wood / example-aws-api-gateway-lambda-proxy-mode-event.json
Created July 30, 2020 20:46
Example Lambda event from API Gateway in Proxy mode
{
"resource": "/{proxy+}",
"path": "/post",
"httpMethod": "POST",
"headers": {
"accept": "*/*",
"Authorization": "Bearer REDACTED",
"content-type": "application/x-www-form-urlencoded",
"Host": "myapi.example.com",
"User-Agent": "curl/7.58.0",
@gene1wood
gene1wood / How-to-pass-all-headers-in-CloudFront-using-CloudFormation.md
Last active February 8, 2023 20:24
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

Resources:
  CloudFrontDistribution:
    Type: AWS::CloudFront::Distribution
    Properties:
      DistributionConfig:
@gene1wood
gene1wood / 01-explanation-of-python-logging-and-the-root-logger.md
Last active February 8, 2023 16:09
Explanation of the relationship between python logging root logger and other loggers

Explanation of the relationship between python logging root logger and other loggers

@gene1wood
gene1wood / first_and_third_thursday.ics
Created January 30, 2023 19:16
iCalendar ICS file with an event on the first and third Thursday of each month
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:Temp
X-WR-TIMEZONE:America/Los_Angeles
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
@gene1wood
gene1wood / github-third-party-integration-oauth-scope-risk-impacts.md
Last active January 29, 2023 18:33
Analysis of the GitHub OAuth scopes granted to third party integrations and the areas of impact that they affect in the Mozilla Risk Management Model
Scope Description User repo:read User repo:write User repo:admin
(no scope) Access public information (read-only)
user Update all user data
user:email Access user email addresses (read-only)
user:follow Follow and unfollow users
public_repo Access public repositories I I
repo Full control of private repositories C CI CI
repo_deployment Access deployment status
@gene1wood
gene1wood / new-python-project-with-tox-and-pytest.md
Last active January 17, 2023 05:07
Example of the directory structure, setup.py, tox.ini and pytest tests for a new python project

Directory structure

projectname/                 [1]
├── projectname              [2]
│   ├── __init__.py
├── README.md
├── setup.py
├── tests
│   └── test_projectname.py
@gene1wood
gene1wood / ca-sos-bizfileonline-edit-account-bug.md
Last active January 4, 2023 23:48
A description of a bug in the CA Secretary of State bizfileonline system preventing users from editing their accounts.

There's a bug in the California Secretary of State bizfileonline site that prevents users from editing their account.

Steps to reproduce

  1. Browse to https://bizfileonline.sos.ca.gov/ and click Login
  2. Login with as a valid user account
  3. Click your user's name/email address in the upper right to show the Logout / My Account drop down
  4. Click My Account which brings up the modal dialog titled "My Account"
  5. Click the Edit my account button
@gene1wood
gene1wood / example_aws_lambda_cloudformation_context.md
Last active January 4, 2023 06:41
Details on the AWS Lambda Python LambdaContext context object when instantiated from a CloudFormation stack

LambdaContext

Here is the raw output from examining the Python LambdaContext context object in a AWS Lambda function when called from a CloudFormation stack. More information on the context object can be found here : http://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html

LambdaContext object : print(context)

<__main__.LambdaContext object at 0x7fd706780710>

LambdaContext vars : vars(context)

openpgp4fpr:17C0E798512E2ED181E24FF4F0A9E7DCD39E452E

@gene1wood
gene1wood / change-github-collaborators-permissions.md
Last active December 2, 2022 11:08
How to edit or modify a GitHub user's permissions on a repository through the API

The GitHub API is inconsistent for this endpoint. Normally to edit or modify a resource, the REST API uses the PATCH verb.

For the https://developer.github.com/v3/repos/collaborators/ endpoint however, to edit or modify a user's permissions, there is no PATCH verb. Instead you must make a PUT call defining the new permissions.

The documentation confusingly describes this as "Add user as a collaborator" when the user you're modifying already is a collaborator, you just want to change their permissions.

Here is an example call to change a user with push permissions to pull permissions