Skip to content

Instantly share code, notes, and snippets.

Avatar

Gene Wood gene1wood

View GitHub Profile
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]
@gene1wood
gene1wood / .person_api.sh
Created Jul 20, 2020
Small script to get users from CIS
View .person_api.sh
export person_api_client_id=xxx
export person_api_client_secret=xxx
if [ -z "$person_api_bearer_token" ]; then
echo "Fetching bearer token"
export person_api_bearer_token=$(curl --silent --request POST --url https://auth.mozilla.auth0.com/oauth/token --header "Content-Type: application/json" --data "{\"client_id\":\"${person_api_client_id}\",\"client_secret\":\"${person_api_client_secret}\",\"audience\":\"api.sso.mozilla.com\",\"grant_type\":\"client_credentials\"}" | jq -r '.access_token')
fi
function url_quote {
echo $1 | python3 -c "import urllib.parse; print(urllib.parse.quote(input()))"
}
function get_auth0_user {
@gene1wood
gene1wood / disable-native-login.php
Last active Jul 4, 2020
Disable Wordpress native username password login when using Google Apps Login
View disable-native-login.php
<?php
/**
* Plugin Name: Disable Native Login
* Plugin URI: https://cs.cementhorizon.com/
* Description: Disable the native username password login in wordpress
* Version: 1.0.0
* Author: Gene Wood
* Author URI: https://cs.cementhorizon.com/
* License: GPL2
@gene1wood
gene1wood / syslog.txt
Created Jun 26, 2020
Syslog on Ubuntu 18.04 when activating Soundcore Life P2 headset
View syslog.txt
Jun 26 11:34:54 judy /usr/lib/gdm3/gdm-x-session[32177]: (--) modeset(G0): HDMI max TMDS frequency 300000KHz
Jun 26 11:34:55 judy dbus-daemon[32393]: [session uid=1000 pid=32393] Activating via systemd: service name='org.bluez.obex' unit='dbus-org.bluez.obex.service' requested by ':1.79' (uid=1000 pid=1277 comm="gnome-control-center bluetooth " label="unconfined")
Jun 26 11:34:55 judy systemd[32111]: Starting Bluetooth OBEX service...
Jun 26 11:34:55 judy obexd[1289]: OBEX daemon 5.48
Jun 26 11:34:55 judy dbus-daemon[32393]: [session uid=1000 pid=32393] Successfully activated service 'org.bluez.obex'
Jun 26 11:34:55 judy systemd[32111]: Started Bluetooth OBEX service.
Jun 26 11:35:03 judy bluetoothd[1462]: a2dp-source profile connect failed for E8:07:BF:A6:3D:26: Device or resource busy
Jun 26 11:35:04 judy kernel: [62680.010423] input: E8:07:BF:A6:3D:26 as /devices/virtual/input/input91
Jun 26 11:35:04 judy /usr/lib/gdm3/gdm-x-session[32177]: (II) config/udev: Adding input device E8:07:BF:A6:3D:26 (/dev/inpu
@gene1wood
gene1wood / 0001-6305_Vista_Win7_PG537.zip
Last active Jun 2, 2020
Realteak AC'97 Audio Codecs Software Vista/Win7 (32/64 bits) Driver only (ZIP file)
@gene1wood
gene1wood / watch-for-new-media.bash
Created May 10, 2020
Script to create inotifywait on directories to trigger Subsonic media scanning
View watch-for-new-media.bash
#!/bin/bash
dirs="/path/to/first/dir /path/to/second/dir /path/to/third/dir"
act="/usr/local/bin/act-on-new-media.bash"
# act="cat"
/bin/inotifywait --monitor --recursive --quiet --format '%w' --event create,moved_to $dirs | while read f
do
$act "$f"
done
@gene1wood
gene1wood / rescan_subsonic_media.py
Created May 10, 2020
Script to trigger a Subsonic media rescan with locking
View rescan_subsonic_media.py
#!/bin/env python
import sys
import requests
import os
import os.path
import time
import logging
import subprocess
import json
You can’t perform that action at this time.