Skip to content

Instantly share code, notes, and snippets.

Gene Wood gene1wood

Block or report user

Report or block gene1wood

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gene1wood /
Last active Jun 2, 2020
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

gene1wood / gist:aa1c7fe0ce68b529bd3196018e7f600b
Created Sep 23, 2019
Greasemonkey userscript to prevent Jira from capturing the Alt+1 Alt+2 Alt+3 keyboard shortcuts
View gist:aa1c7fe0ce68b529bd3196018e7f600b
// ==UserScript==
// @name JIRA: Prevent Alt+[123] hijacking
// @namespace
// @include *RapidBoard.jsp*
// @version 1
// @grant none
// ==/UserScript==
gene1wood /
Last active Dec 18, 2019
Example of the directory structure,, tox.ini and pytest tests for a new python project

Directory structure

projectname/                 [1]
├── projectname              [2]
│   ├──
├── tests
│   └──
gene1wood /
Last active Aug 28, 2019
Statistics on python distribution package names and the names of the modules within those packages
  • All package names are considered lowercase as package names must be case insensitive
  • Packages with names containing no dashes or underscores (which are equivalent)
    • %78.5 (157 / 200)
  • Packages containing a module with the same name as the package
    • %68.5 (137 / 200)
  • Packages with the same package and module name, except dash converted to underscore
    • %9.0 (18 / 200)
gene1wood /
Created Aug 27, 2019
Add support for OrderedDict to PyYAML to avoid the "RepresenterError: cannot represent an object: OrderedDict" error
from collections import OrderedDict
import sys
import yaml
test1 = {
'beta': 1,
'alpha': 2,
'charlie': 3}
print(yaml.safe_dump(test1, default_flow_style=False))
gene1wood /
Created Aug 16, 2019
Diff between in security_monkey 0.3.6 and moz_security_monkey
--- 2019-08-16 07:47:49.289601195 -0700
+++ 2019-08-16 07:48:41.593548348 -0700
@@ -1,138 +1,143 @@
-.. module: security_monkey.scheduler
+.. module: moz_security_monkey.scheduler
:platform: Unix
:synopsis: Runs watchers, auditors, or reports on demand or on a schedule
.. version:: $$VERSION$$
gene1wood /
Created Jul 24, 2019
Function to return all AWS IAM policy documents (inline and managed) for a given IAM role
import boto3
def get_paginated_results(product, action, key, credentials=None, args=None):
args = {} if args is None else args
credentials = {} if credentials is None else credentials
return [y for sublist in [x[key] for x in boto3.client(
product, **credentials).get_paginator(action).paginate(**args)]
for y in sublist]
gene1wood /
Created Jul 16, 2019
Instructions on how to test MozDef after making code changes

Run tests

make test

Run MozDef and send events through to trigger an alert

sudo pip install mozdef_client mozdef_util
sudo service apache2 stop
gene1wood / string-to-qrcode.bash
Created Jun 23, 2019
Convert a string to a QR code.
View string-to-qrcode.bash
# Make sure qrencode and imagemagick are installed
read -p "Enter string to be displayed as a QR code : " value
echo -n "${value}" | qrencode --level=H --output=- --size=12 | display -
gene1wood / SEP315.pdf
Last active Jun 13, 2019
SEP315 Slide Deck
View SEP315.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.