Skip to content

Instantly share code, notes, and snippets.

Avatar

Gene Wood gene1wood

View GitHub Profile
@gene1wood
gene1wood / bitwarden-amazon-aws-credential-setup.md
Last active Oct 26, 2020
How to get BitWarden to differentiate between amazon.com consumer retail logins, AWS root logins and AWS IAM user logins
View bitwarden-amazon-aws-credential-setup.md

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

  • amazon.com 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)

amazon.com consumer retail

  • Set URI 1 to Exact with a value of

    https://www.amazon.com/ap/signin?_encoding=UTF8&ignoreAuthState=1&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.com%2F%3Fref_%3Dnav_custrec_signin&switch_account=

@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active Oct 24, 2020
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
View all_aws_lambda_modules_python.md

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
gene1wood / all_aws_managed_policies.json
Last active Oct 19, 2020
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
gene1wood / 01_get_account_id_for_user_ec2instance_role_or_lambda.py
Last active Oct 13, 2020
Method to determine your AWS account ID using boto3 for either a user or an ec2 instance or lambda function
View 01_get_account_id_for_user_ec2instance_role_or_lambda.py
import boto3
print(boto3.client('sts').get_caller_identity()['Account'])
@gene1wood
gene1wood / install-duplicati-on-centos6.sh
Created Jan 8, 2018
How to install Duplicati on CentOS 6
View install-duplicati-on-centos6.sh
# Install mono
rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
yum-config-manager --add-repo http://download.mono-project.com/repo/centos6/
yum install mono-complete
# Install duplicati, ignoring dependencies
wget https://updates.duplicati.com/beta/duplicati-2.0.2.1-2.0.2.1_beta_20170801.noarch.rpm
rpm -ivh --nodeps duplicati-2.0.2.1-2.0.2.1_beta_20170801.noarch.rpm
# Create init script and enable the service
@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active Oct 8, 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
@gene1wood
gene1wood / role_arn_to_session.py
Created Dec 29, 2016
Simple python function to assume an AWS IAM Role from a role ARN and return a boto3 session object
View role_arn_to_session.py
import boto3
def role_arn_to_session(**args):
"""
Usage :
session = role_arn_to_session(
RoleArn='arn:aws:iam::012345678901:role/example-role',
RoleSessionName='ExampleSessionName')
client = session.client('sqs')
"""
@gene1wood
gene1wood / batch-delete-gmail-emails.js
Last active Oct 3, 2020
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 https://script.google.com/.
Start a script and paste in the code below.
After you past it in, save it and click the little clock looking button.
@gene1wood
gene1wood / hide-boing-boing-ads.user.js
Last active Sep 27, 2020
Greasemonkey User Script to hide sponsored posts on boingboing.net
View hide-boing-boing-ads.user.js
// ==UserScript==
// @name Block Boing Boing Ads
// @namespace http://cs.cementhorizon.com
// @description Block Boing Boing Ads
// @include http://boingboing.net/*
// @include https://boingboing.net/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @version 5
// @grant none
// ==/UserScript==
@gene1wood
gene1wood / 01-explanation-of-python-logging-and-the-root-logger.md
Last active Sep 17, 2020
Explanation of the relationship between python logging root logger and other loggers
View 01-explanation-of-python-logging-and-the-root-logger.md

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

You can’t perform that action at this time.