Skip to content

Instantly share code, notes, and snippets.


Gene Wood gene1wood

View GitHub Profile
gene1wood /
Last active Feb 25, 2021
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7

This gist contains lists of modules available in

in AWS Lambda.

It also contains the code to run in Lambda to generate these lists. In addition there is a less_versbose module in the code that you can call to get a list of the top level modules installed and the version of those modules (if they contain a version

gene1wood / batch-delete-gmail-emails.js
Last active Feb 24, 2021
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
View batch-delete-gmail-emails.js
This script, when used with Google Apps Scripts will delete 500 emails and
can be triggered to run every minute without user interaction enabling you
to bulk delete email in Gmail without getting the #793 error from Gmail.
Configure the search query in the code below to match the type of emails
you want to delete
Browser to
Start a script and paste in the code below.
After you past it in, save it and click the little clock looking button.
gene1wood / bugzillarc-for-use-at-Mozilla
Created Feb 24, 2021
The ~/.config/python-bugzilla/bugzillarc file to use for
View bugzillarc-for-use-at-Mozilla
url =
api_key = xxxxxxxxxxxxxxx
gene1wood /
Last active Feb 24, 2021
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

gene1wood / postfix-debconf-get-selections.txt
Last active Feb 18, 2021
postfix debconf-get-selections using as an example domain name
View postfix-debconf-get-selections.txt
# Internet protocols to use:
# Choices: all, ipv6, ipv4
postfix postfix/protocols select all
# System mail name:
postfix postfix/mailname string
# Add a 'mydomain' entry in for upgrade?
postfix postfix/mydomain_warning boolean
# Correct tlsmgr entry in for upgrade?
postfix postfix/tlsmgr_upgrade_warning boolean
# Root and postmaster mail recipient:
gene1wood /
Last active Feb 8, 2021
How to get BitWarden to differentiate between consumer retail logins, AWS root logins and AWS IAM user logins

Here's how to get BitWarden to treat these three different types of Amazon logins as separate

  • consumer retail business login
  • AWS root user login (AWS logins that use an email address)
  • AWS IAM user login (AWS logins that use a username) consumer retail

  • Set URI 1 to Exact with a value of

View set-whitebalance
#!/bin/bash -x
if [ -n "$2" ]; then
camera="$(v4l2-ctl --list-devices | grep -A1 "$1" | tail -1 | awk '{print $1}')"
$(v4l2-ctl -d "$camera" -l | awk '$1 == "white_balance_temperature" {print "export "$5" "$6}')
(( range = max - min ))
gene1wood /
Last active Feb 2, 2021
Details on the AWS Lambda Python LambdaContext context object when instantiated from a CloudFormation stack


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 :

LambdaContext object : print(context)

<__main__.LambdaContext object at 0x7fd706780710>

LambdaContext vars : vars(context)

gene1wood / all_aws_managed_policies.json
Last active Feb 1, 2021
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
View all_aws_managed_policies.json
This file has been truncated, but you can view the full file.
"APIGatewayServiceRolePolicy": {
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy",
"AttachmentCount": 0,
"CreateDate": "2019-10-22T18:22:01+00:00",
"DefaultVersionId": "v6",
"Document": {
"Statement": [
gene1wood /
Last active Jan 22, 2021
Method to determine your AWS account ID using boto3 for either a user or an ec2 instance or lambda function
import boto3