Skip to content

Instantly share code, notes, and snippets.

View kylemanna's full-sized avatar

Kyle Manna kylemanna

View GitHub Profile
@kylemanna
kylemanna / falcon-zipfile-stream.py
Created May 16, 2020 00:08
Falcon + zipfile streaming proof of concept v2
#!/usr/bin/env python3
#
# Falcon + zipfile streaming content using os.pipe() to minimize RAM usage to a
# pipes worth of data.
#
# This test program generated a nearly 500 MB zip file with various compression
# arguments supported by the python3 standard library.
#
# Usage for debug webserver:
# $ ./app.py
# Run this tool and feed it stuff.
# $ python3 udp-test.py
#
# Emulate a remote client sending data:
# $ cat /dev/urandom | nc -u 127.0.0.1 7502
#
# Cancel netcat and try again, second attempt will fail because the source port
# likely changed (not guaranteed, but statistically likely)
#
#
# Proof of Concept
#
# Compose a docker image of an upstream images so that binaries packages in one
# image can be incorporated into another.
#
# TODO This copies, would be nice if there was a way to attach an image to a
# container like `docker run --volumes-from` does for containers.
# These FROMs used as a way to distribute files via an image
#include <iostream>
#include <cxxabi.h>
using namespace std;
// To execute C++, please define "int main()"
int main() {
auto words = { "Hello, ", "World!", "\n" };
int status;

Python Flatbuffer Object -> JSON

Crude proof of concept, criticism welcome.

Usage

$ flatc --python monster.fbs
$ python3 ./python-flatbuffer-to-json.py
FIXME: Equipped is a table

{"color": 0, "equipped": null, "hp": 300, "inventory": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "mana": 150, "name": "Orc", "path": [], "pos": {"x": 1.0, "y": 2.0, "z": 3.0}, "weapons": [{"damage": 3, "name": "Sword"}, {"damage": 5, "name": "Axe"}]}

Jul 15 20:29:36 buildserverdisaster07 java[99922]: at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
Jul 15 20:29:36 buildserverdisaster07 java[99922]: at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
Jul 15 20:29:36 buildserverdisaster07 java[99922]: at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
Jul 15 20:29:36 buildserverdisaster07 java[99922]: at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
Jul 15 20:29:36 buildserverdisaster07 java[99922]: at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
Jul 15 20:29:36 buildserverdisaster07 java[99922]: at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
Jul 15 20:29:36 buildserverdisaster07 java[99922]: at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
J
[This message has been removed by Norton Corporate NDA Protector(tm)]
[This message has been removed by Norton Corporate NDA Protector(tm). Warning: A third NDA violation with result in immediate termination of employment]
[Unit]
Description=Simple dnsmasq server
After=network.target
Documentation=man:dnsmasq(8)
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/sbin/dnsmasq \
--conf-file=/dev/null \
#!/usr/bin/env bash
#export GIT_TRACE=1
#export GIT_CURL_VERBOSE=1
set -ex
lfs_explode() {
cd "$i"
while true; do
#!/usr/bin/env python3
import timeit
import sys
from scapy.all import *
def read_pcap(fname, bpf, klass=PcapReader):
with klass(tcpdump(fname, args=["-w", "-", bpf], getfd=True)) as pcap_reader:
for pkt in pcap_reader:
#print(pkt.summary())
pass