Skip to content

Instantly share code, notes, and snippets.

Avatar
☢️

John Andersen pdxjohnny

☢️
View GitHub Profile
@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 / 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 / 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 / full.patch
Created Jun 25, 2020
saksham defaults edits (NO_DEFAULTS)
View full.patch
commit 722561381fb70aa895b786b39934ed2316420aab
Author: sakshamarora1 <sakshamarora1001@gmail.com>
Date: Tue Jun 23 20:48:06 2020 +0530
df: memory: Support default values for definitions
Signed-off-by: sakshamarora1 <sakshamarora1001@gmail.com>
diff --git a/dffml/df/base.py b/dffml/df/base.py
index d11c3f73..a7695722 100644
@pdxjohnny
pdxjohnny / edits.diff
Created Jun 25, 2020
saksham defaults edits (NO_DEFAULTS)
View edits.diff
diff --git a/dffml/df/base.py b/dffml/df/base.py
index 2494fcc4..a7695722 100644
--- a/dffml/df/base.py
+++ b/dffml/df/base.py
@@ -17,7 +17,7 @@ from dataclasses import is_dataclass
from contextlib import asynccontextmanager
from .exceptions import NotOpImp
-from .types import Operation, Input, Parameter, Stage, Definition
+from .types import Operation, Input, Parameter, Stage, Definition, NO_DEFAULT
@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 / default-values.patch
Created Jun 16, 2020
DFFML memory support default values TODO
View default-values.patch
diff --git a/dffml/df/memory.py b/dffml/df/memory.py
index 7d29c84f..f6c7cdfb 100644
--- a/dffml/df/memory.py
+++ b/dffml/df/memory.py
@@ -586,8 +586,27 @@ class MemoryInputNetworkContext(BaseInputNetworkContext):
],
)
)
- # Return if there is no data for an input
+ # There is no data in the network for an input
You can’t perform that action at this time.