Skip to content

Instantly share code, notes, and snippets.

View rbdixon's full-sized avatar

Brad Dixon rbdixon

  • Carve Systems
  • Atlanta, GA
View GitHub Profile
@rbdixon
rbdixon / led-badge-write.go
Created August 28, 2020 21:40 — forked from korc/led-badge-write.go
Programmable 44x11 LED badge (USB HID 0416:5020) programmer/driver
package main
import (
"bytes"
"encoding/binary"
"encoding/hex"
"errors"
"flag"
"fmt"
"image"
@rbdixon
rbdixon / benchmark.py
Last active August 3, 2019 14:30
Benchmark config lookup
import timeit
import string
from itertools import combinations
ITERATIONS = 10000
TASK = 'task:'
d = {TASK + letter: True for letter in 'A'}
task_names = [''.join(x) for x in combinations(string.ascii_letters, 2)]
print(f'Number of tasks: {len(task_names)}')
@rbdixon
rbdixon / policy.json
Created May 22, 2019 20:04
Read-only AWS IAM policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"cloudformation:DescribeStacks",
"cloudformation:GetStackPolicy",
"cloudformation:ListStacks",
@rbdixon
rbdixon / dodo.py
Created May 15, 2019 15:06
POC doit modifications to handle non-serializable python-action results
'''
To use:
touch testfile
doit
Serialized .doit.db database (JSON format) will contain:
{
"create_object": {
@rbdixon
rbdixon / example.tex
Created November 2, 2018 13:34
Wrapfigure conflict with verbatim
\documentclass[]{article}
\usepackage{wrapfig}
\newenvironment{infobox}{\wrapfigure{r}{5cm}}{\endwrapfigure}
\begin{document}
\begin{infobox}
BOX
BOX
@rbdixon
rbdixon / test_how_many_runs.py
Last active July 27, 2018 15:28
Attempt to noodle out how to generate mutated dict subsets.
'''
The goal I have is to generate test dictionaries from an example.
The test dictionaries should vary in terms of which keys are present.
The values should be chosen from one of the provided options.
For example the dict:
{
@rbdixon
rbdixon / gron.diff
Created April 26, 2018 18:20
Pandoc: YAML multiline string with embedded table parsing
$ diff -C 2 passes.gron fails.gron
*** passes.gron 2018-04-26 14:18:00.000000000 -0400
--- fails.gron 2018-04-26 14:19:36.000000000 -0400
***************
*** 61,85 ****
json.meta.table.c[0].c[4][1][1][0].c[0].t = "Str";
json.meta.table.c[0].c[4][1][1][0].t = "Plain";
- json.meta.table.c[0].c[4][2] = [];
- json.meta.table.c[0].c[4][2][0] = [];
- json.meta.table.c[0].c[4][2][0][0] = {};
@rbdixon
rbdixon / readme.md
Last active May 11, 2020 12:24
mitmproxy script to translate WBXML

Why did I do this? See post.

#!/usr/bin/env python
"""
Pandoc filter to allow interpolation of metadata fields
into a document. %{fields} will be replaced by the field's
value, assuming it is of the type MetaInlines or MetaString.
"""
import sys
from pandocfilters import toJSONFilter, attributes, Span, Str, Table
@rbdixon
rbdixon / -
Created March 4, 2016 14:26
Diff correct vs. wrong
*** correct.json 2016-03-04 09:02:52.000000000 -0500
--- wrong.json 2016-03-04 09:22:15.000000000 -0500
***************
*** 392,398 ****
]
]
],
! "t": "Table"
}
]