Skip to content

Instantly share code, notes, and snippets.

View hdonnay's full-sized avatar

Hank Donnay hdonnay

View GitHub Profile
@hdonnay
hdonnay / diagram.d2
Last active July 21, 2023 18:20
Database diagram (https://d2lang.com)
Notes: "" {
grid-rows: 1
grid-columns: 2
grid-gap: 5
near: top-center
Notes: |md
# Goals
- Remove all "presentation-only" data into a table outside of a query path (`advisory_meta`)
- Allow lookups to and from a-k-a names (`advisory_reference`)
- Structure cross-referencing data (`reference`)
FROM docker.io/library/golang:1.18
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod\
go install golang.org/x/tools/cmd/stringer@latest
RUN stringer -h
#!/bin/sh
### onhost is the inverse of intoolbox -- it attempts to run a command on the
### host if invoked from inside a toolbox.
###
### It should be symlinked as the name of the command to call:
### ln -s `which _onhost` podman
### ./podman
set -e
cmd="$(basename "$0")"
if [ "$cmd" = '_onhost' ]; then
diff --git a/english/security/oval/oval/definition/generator.py b/english/security/oval/oval/definition/generator.py
index e7ce5eb4d03..7fceeabb436 100644
--- a/english/security/oval/oval/definition/generator.py
+++ b/english/security/oval/oval/definition/generator.py
@@ -526,4 +526,4 @@ def createOVALDefinitions (ovals):
def printOVALDefinitions (root):
if len(root.find("definitions")):
- print(etree.tostring(root, pretty_print=True, xml_declaration=True).decode('utf-8'))
+ print(etree.tostring(root, pretty_print=True, encoding='UTF-8', xml_declaration=True).decode('utf-8'))
@hdonnay
hdonnay / pre-push.sh
Last active June 2, 2020 20:02
a pre-push git hook that runs smoke tests and memoizes the results in git
#!/bin/sh
set -e
imgs="registry.access.redhat.com/ubi8/ubi:8.0-122 docker.io/library/ubuntu docker.io/mitmproxy/mitmproxy:4.0.1"
pod='claircore-dev'
pause=20
export GIT_NOTES_REF=refs/notes/pre-push
cleanup() {
exe="$1"
out="$2"
set -euo pipefail
: "${name:=projectquay/clair}"
: "${prefix:=git-}"
dir=$(mktemp -d)
trap "rm -rf '${dir}'" EXIT
git log --format "tformat:${prefix}%h" --max-count=50 |
sort|uniq > "${dir}/git"
curl -s "https://quay.io/v2/${name}/tags/list" |
jq -r '."tags"[]' |
@hdonnay
hdonnay / claircore-quay.sh
Last active February 24, 2020 14:53
script to spin up a podman pod with both claircore and podman running
#!/bin/sh
set -e
: ${pod:=quay-all}
: ${GO_VERSION:=1.13.5}
: ${CONFIG_APP_PASSWORD:=test}
dir="$(mktemp -d)"
envfile="${dir}/env"
cat > "${envfile}" <<.
CONNECTION_STRING=host=localhost user=claircore dbname=claircore sslmode=disable
LOG_LEVEL=debug
import "strings"
qstring:: {
value: string
output: "'\(value)'"
}
arg: string | {output:string}
cmd: {
#!/bin/sh
podman create \
--name synapse-db \
--network host \
--expose 5432 \
--env 'PGOPTIONS=-h 127.0.0.1' \
--volume $HOME/synapse/db:/var/lib/postgresql/data \
--volume $HOME/synapse/bootstrap.sql:/docker-entrypoint-initdb.d/bootstrap.sql:z\
--volume $HOME/synapse/00-localhost.sh:/docker-entrypoint-initdb.d/00-localhost.sh:z\
docker.io/postgres:11 -c 'listen_addresses=localhost'
@hdonnay
hdonnay / BUILD.nasm
Last active September 12, 2018 17:10
genrule(
name = "nasm.bin",
srcs = glob(["**/*"]),
outs = ["nasm"],
executable = True,
cmd = """
cd external/nasm
./configure
make nasm
install -vDm 0755 nasm $(@)