Skip to content

Instantly share code, notes, and snippets.

Avatar
☢️

John Andersen pdxjohnny

☢️
View GitHub Profile
@pdxjohnny
pdxjohnny / .gitignore
Last active Dec 15, 2020
Setting Up k3s for Serverless (knative) on a $5 DigitalOcean Droplet Using k3d
View .gitignore
.terraform/
*.pem
*.tf
*.tfstate
*.yaml
*.backup
istio-*/
cert-manager-*/
*.swp
env
@pdxjohnny
pdxjohnny / run-vm.sh
Last active Oct 6, 2020
Use bzImage of built kernel with fedora container
View run-vm.sh
#!/usr/bin/env bash
#
# DESCRIPTION
#
# Run a virtual machine using the bzImage of a compiled Linux kernel
# with the base fedora container image as the file system.
#
# ENVIRONMENT VARIABLES
#
# This section details environment variables this script uses and shows
@pdxjohnny
pdxjohnny / zip_http_server.py
Created Sep 15, 2020
Python HTTP server for zip file
View zip_http_server.py
"""
Much of this code is copied from cpython Lib/http/server.py
It has been adapted to make a subclass of SimpleHTTPRequestHandler that serves
files from a zipfile rather than a directory.
Keeping the licensing the same for simplicity
LICENSE: https://github.com/python/cpython/raw/3.8/LICENSE
@pdxjohnny
pdxjohnny / README-setup-tunnel-as-systemd-service.md
Last active Sep 14, 2020 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward
View README-setup-tunnel-as-systemd-service.md

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@pdxjohnny
pdxjohnny / cutsominputsetcontexts.patch
Created Aug 18, 2020
Custom input set contexts with dict notation for dataflow run
View cutsominputsetcontexts.patch
diff --git a/dffml/df/memory.py b/dffml/df/memory.py
index ee6bcf4e..c5b74f62 100644
--- a/dffml/df/memory.py
+++ b/dffml/df/memory.py
@@ -1288,6 +1288,10 @@ class MemoryOrchestratorContext(BaseOrchestratorContext):
ctx: Optional[BaseInputSetContext] = None,
input_set: Optional[Union[List[Input], BaseInputSet]] = None,
) -> BaseInputSetContext:
+ if ctx is not None and not isinstance(ctx, BaseInputSetContext):
+ raise TypeError(
@pdxjohnny
pdxjohnny / patch.diff
Last active Aug 14, 2020
dffml: configloader file @
View patch.diff
diff --git a/dffml/util/cli/arg.py b/dffml/util/cli/arg.py
index 01ffa75b..e4fd9212 100644
--- a/dffml/util/cli/arg.py
+++ b/dffml/util/cli/arg.py
@@ -3,10 +3,10 @@
import copy
from typing import Optional
-from ..data import traverse_config_set
+from ..data import traverse_config_set, merge
@pdxjohnny
pdxjohnny / df-source.diff
Created Aug 4, 2020
DataFlow source accumulator operation partial modifications to source for record() etc.
View df-source.diff
diff --git a/dffml/source/df.py b/dffml/source/df.py
index 380e6312..af9e44c8 100644
--- a/dffml/source/df.py
+++ b/dffml/source/df.py
@@ -17,17 +17,70 @@ class DataFlowSourceConfig:
source: BaseSource
dataflow: DataFlow
features: Features
+ length: str = field("Definition name to add as source length", default=None)
orchestrator: BaseOrchestrator = MemoryOrchestrator.withconfig({})
@pdxjohnny
pdxjohnny / pagination.py
Last active Jul 13, 2020
Python example pagination client and server
View pagination.py
"""
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@pdxjohnny
pdxjohnny / client.py
Last active Jul 13, 2020
Have requests use Windows certs for TLS/SSL validation
View client.py
"""
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@pdxjohnny
pdxjohnny / LINUX.md
Last active Jul 10, 2020
Linux build and running tips and tricks
View LINUX.md
You can’t perform that action at this time.