You can run a secure ad-hoc HTTP server with negligible effort.
sudo apt install -y busybox-static openssl socat
I needed to load-test an HTTP client, so I used nginx. I ran into some limits:
2018/10/17 23:44:09 [alert] 1860#1860: 768 worker_connections are not enough
To get around this, edit /etc/nginx/nginx.conf and edit the events section:
events {
worker_connections 5000;
# multi_accept on;
}
| #!/usr/bin/env bash | |
| # This script uses the same secret key and example as jwt.io, | |
| # so that you can verify that it's correct. | |
| secret_key="your-256-bit-secret" | |
| base64url() { | |
| # Don't wrap, make URL-safe, delete trailer. | |
| base64 -w 0 | tr '+/' '-_' | tr -d '=' |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <sys/types.h> | |
| #include <sys/socket.h> | |
| #include <netdb.h> | |
| #include <unistd.h> | |
| #include <gnutls/x509.h> | |
| #include <assert.h> |
| sudo cat /proc/$PID/maps | perl -ne 'print sprintf("%10s", hex($2) - hex($1)), " ", $_ if /([0-9a-f]+)-([0-9a-f]+)/' |
| #!/usr/bin/env elixir | |
| defmodule Canvas do | |
| @behaviour :wx_object | |
| @title "Canvas Example" | |
| @size {600, 600} | |
| def start_link() do | |
| :wx_object.start_link(__MODULE__, [], []) |
| // Problem: | |
| // qpidd reports "[System] error SASL layer required!" | |
| // amqpnetlite reports: "Authentication failed because the remote party has closed the transport stream." | |
| // | |
| // Reason: | |
| // You're connecting to the plaintext qpidd port, and you don't have SASL configured. | |
| // | |
| // Solution: | |
| // Pass scheme: "amqp" to the Address ctor ----------vvvv | |
| var address = new Address("localhost", 5672, scheme: "amqp"); |
| function dump(o) { | |
| switch (typeof(o)) { | |
| case "table": | |
| local table = ""; | |
| foreach (k, v in o) { | |
| if (table != "") { | |
| table += ", " | |
| } | |
| table += dump(k) + ": " + dump(v); | |
| } |
| %% erl -pa deps/exec/ebin -s exec | |
| %% | |
| %% c(exec_sup). | |
| %% {ok, Pid} = exec_sup:start_link(). | |
| %% | |
| %% ps -ef | grep sleep | |
| %% killall sleep | |
| %% ps -ef | grep sleep | |
| -module(exec_sup). |
| #!/usr/bin/env escript | |
| %%% This script converts an arbitrary binary file to an Erlang module with a | |
| %%% single exported 'bin/0' function that returns the original binary. | |
| %%% | |
| %%% See the end of the file for how I figured out the correct terms. | |
| main(["+debug_info" | Files]) -> | |
| io:format("Embedding binaries with debug_info...\n"), | |
| lists:foreach(fun(X) -> embed_file_in_beam(X, [debug_info]) end, Files); |