Skip to content

Instantly share code, notes, and snippets.

View gene1wood's full-sized avatar
🎩

Gene Wood gene1wood

🎩
View GitHub Profile
@gene1wood
gene1wood / .bash_aliases
Last active April 30, 2024 22:10
My bash aliases
#!/bin/bash
alias sgrep='grep --color=auto -R --exclude-dir=.svn --exclude-dir=.git'
alias rpm-ql='dpkg --listfiles'
alias rpm-qi='dpkg --status'
alias rpm-qa='dpkg --list'
alias rpm-qf='dpkg --search'
alias rpm-qpi='dpkg --info'
alias yum-provides='apt-file search'
alias yum-search='apt-cache search'
@gene1wood
gene1wood / show
Last active April 30, 2024 18:20
Tool to show cert, key or CSR information for a file or site
#!/bin/bash
if [ -z "$1" ];then
echo "Showing certificate from clipboard"
FILENAME=$(mktemp)
trap "{ rm -f $FILENAME; }" EXIT
xclip -o > $FILENAME
elif [ -e "$1" ]; then
echo "Showing certificate file $1"
FILENAME="$1"
@gene1wood
gene1wood / remove-keys.bash
Last active April 29, 2024 03:41
Command to remove all apt gpg keys in /etc/apt/keyrings from /etc/apt/trusted.gpg
for keyfile in /etc/apt/keyrings/*.asc; do echo "$keyfile"; cat "$keyfile" | gpg --with-colons --import-options show-only --import | awk -F: '$1 == "fpr" {print $10}' | xargs --verbose -L 1 apt-key del; done

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 / all_aws_lambda_modules_python.md
Last active April 25, 2024 03:06
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
@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 / 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