Skip to content

Instantly share code, notes, and snippets.

View gene1wood's full-sized avatar
🎩

Gene Wood gene1wood

🎩
View GitHub Profile

Given a subscribed calendar with a url like

https://example.com/example.ics

To force Google Calendar to refresh and reload the contents right now, unsubscribe from the calendar and subscribe to a new calendar with a URL like

https://example.com/example.ics#1

Adding the anchor tag will force Google Calendar to think of it as a new calendar

@gene1wood
gene1wood / assume-role.bash
Last active April 11, 2024 17:09
One liner to assume an AWS IAM role and set environment variables to use the resulting STS credentials
#!/bin/bash -x
# Session duration
# DURATION=43200
DURATION=3600
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
if ! sts=( $(
aws sts assume-role \
@gene1wood
gene1wood / all_aws_managed_policies.json
Last active April 4, 2024 18:11
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
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": [
{
"Action": [
@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active April 3, 2024 20:42
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
@gene1wood
gene1wood / Problem-updating-Dell-PowerEdge-VRTX-firmware.md
Last active April 1, 2024 21:11
Description of a problem updating the firmware of a Dell PowerEdge VRTX Storage Component (PERC8) and solution.

I went to update the Storage Component on my Dell PowerEdge VRTX from 23.13.16.0017 23.14.06.0013_A08. I uploaded the Dell Shared PERC8 firmware for Dell PowerEdge VRTX-Fault Tolerant version 23.14.06.0013_A08 (filename VRTX_SAS-RAID_Firmware_THVJ9_WN64_23.14.06.0013_A08.EXE ). The upload completed successfully. I applied the update. The UI showed that the update was "in-progress" for the next 8 hours. After 8 hours I gave up and powered off the Chassis from the CMC.

I powered the Chassis back on and the storage firmware showed as still being 23.13.16.0017

I uploaded the same file again and again initiated an update and this time it worked in fairly short order.

@gene1wood
gene1wood / bitwarden-amazon-aws-credential-setup.md
Last active March 22, 2024 22:53
How to get BitWarden to differentiate between amazon.com 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

  • 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 / google-drive-symlink.md
Created September 19, 2017 19:36
Google Drive symlink
@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active March 15, 2024 14:13
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

.
├── lambda_file.py
└── example.py
@gene1wood
gene1wood / batch-delete-gmail-emails.js
Last active March 10, 2024 17:53
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
/*
This script, when used with Google Apps Scripts, will delete 400 emails and
can be triggered to run every few minutes without user interaction enabling you
to bulk delete email in Gmail without getting the #793 error from Gmail.
Google returns a maximum of 500 email threads in a single API call.
This script fetches 400 threads in case 500 threads is causing timeouts
Configure the search query in the code below to match the type of emails
you want to delete