Skip to content

Instantly share code, notes, and snippets.

Avatar

Gene Wood gene1wood

View GitHub Profile
@gene1wood
gene1wood / person_api.sh
Created May 11, 2021
Tool I source to get some query functions for CIS Person API
View person_api.sh
export person_api_client_id=xxx
export person_api_client_secret=xxx
export audience=api.sso.mozilla.com
export api_domain=person.api.sso.mozilla.com
if [ -z "$person_api_bearer_token" ]; then
echo "Fetching bearer token"
export person_api_bearer_token=$(curl \
--silent \
--request POST \
@gene1wood
gene1wood / delete_all_s3_bucket_files
Created Apr 29, 2021
Command to delete all objects from S3 bucket using lifecycle configuration
View delete_all_s3_bucket_files
for bucket in `cat list-of-s3-buckets.txt`; do
aws s3api put-bucket-lifecycle \
--bucket $bucket \
--lifecycle-configuration '{"Rules":[{"ID":"cleanup","Status":"Enabled","Prefix":"","Expiration":{"Days":1}}]}';
done
@gene1wood
gene1wood / peertube-cannot-retrieve-oauth-client-credentials-undefined-clien-invalid-fix.md
Created Feb 26, 2021
Fix for the peertube error "Cannot retrieve OAuth Client credentials: undefined" and "client invalid"
View peertube-cannot-retrieve-oauth-client-credentials-undefined-clien-invalid-fix.md

I deployed Peertube via Docker but did not use the included nginx docker container and instead put Peertube behind an Apache httpd reverse proxy.

I was getting the error : Cannot retrieve OAuth Client credentials: undefined when loading the peertube page and the error client invalid when attempting to log in.

The cause was that I wasn't passing the host header through Apache because I was missing the ProxyPreserveHost On directive.

I added this and resolved the issue

@gene1wood
gene1wood / bugzillarc-for-use-at-Mozilla
Created Feb 24, 2021
The ~/.config/python-bugzilla/bugzillarc file to use for bugzilla.mozilla.org
View bugzillarc-for-use-at-Mozilla
[DEFAULT]
url = https://bugzilla.mozilla.org/xmlrpc.cgi
[bugzilla.mozilla.org]
api_key = xxxxxxxxxxxxxxx
@gene1wood
gene1wood / postfix-debconf-get-selections.txt
Last active Apr 15, 2021
postfix debconf-get-selections using myhost.example.com 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 myhost.example.com
# Add a 'mydomain' entry in main.cf for upgrade?
postfix postfix/mydomain_warning boolean
# Correct tlsmgr entry in master.cf for upgrade?
postfix postfix/tlsmgr_upgrade_warning boolean
# Root and postmaster mail recipient:
View set-whitebalance
#!/bin/bash -x
if [ -n "$2" ]; then
percent="$2"
else
percent=0
fi
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 ))
View thick-graph-paper.md
@gene1wood
gene1wood / ngrok-flask-redirect-https.md
Created Sep 8, 2020
How to configre ngrok and flask to redirect to https
View ngrok-flask-redirect-https.md
@gene1wood
gene1wood / example-aws-api-gateway-lambda-proxy-mode-event.json
Created Jul 30, 2020
Example Lambda event from API Gateway in Proxy mode
View example-aws-api-gateway-lambda-proxy-mode-event.json
{
"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 / apply_mozilla_ciphersuites_to_elb.py
Last active Jul 30, 2020
A 2015 script to apply the old cipersuite settings to AWS ELBs
View apply_mozilla_ciphersuites_to_elb.py
#!/usr/bin/env python
# Apply recommendation from https://wiki.mozilla.org/Security/Server_Side_TLS
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Contributors:
# Gene Wood [:gene]