club.syntax.feed.snap
Samples
4 randomly sampled records from the AT Protocol firehose
club.syntax.feed.snap (2 samples)
{
"$type": "club.syntax.feed.snap",
"title": "speed test client",
"content": {
"$type": "club.syntax.content.files",
"files": [
{
"id": "3mstfj6r4zs25",
"content": "#!/usr/bin/env bash\r\n#\r\n# speedtest_client.sh\r\n#\r\n# Runs download, upload, and latency tests against a speedtest server\r\n# (see the accompanying app.py) using only curl -- nothing needs to be\r\n# installed on the client side, since curl ships by default on virtually\r\n# every Linux distro, macOS, and Windows 10+.\r\n#\r\n# Usage:\r\n# ./speedtest_client.sh http://<server-ip-or-host>:8000\r\n#\r\n# Example:\r\n# ./speedtest_client.sh http://10.240.1.50:8000\r\n\r\nset -euo pipefail\r\n\r\n# --- Argument handling -------------------------------------------------------\r\nif [ $# -lt 1 ]; then\r\n echo \"Usage: $0 <server-url>\"\r\n echo \"Example: $0 http://10.240.1.50:8000\"\r\n exit 1\r\nfi\r\n\r\nSERVER_URL=\"$1\"\r\n\r\n# Which pre-generated file(s) to run the download test against. These must\r\n# match filenames that actually exist on the server -- check\r\n# http://<server-url>/ in a browser or with `curl <server-url>/` to see\r\n# the full list, and edit this array to match whatever sizes you care about.\r\nDOWNLOAD_FILES=(\"testfile_10mb.bin\" \"testfile_100mb.bin\")\r\n\r\n# Size (in MB) of the local file to generate for the upload test.\r\nUPLOAD_SIZE_MB=100\r\nUPLOAD_TEMP_FILE=\"/tmp/speedtest_upload_payload.bin\"\r\n\r\necho \"==============================================\"\r\necho \" Speedtest against: $SERVER_URL\"\r\necho \"==============================================\"\r\necho\r\n\r\n# --- 1. Latency check ---------------------------------------------------------\r\n# Hits /ping a handful of times and reports round-trip time for each. This\r\n# gives you a baseline latency number *before* the link gets loaded with\r\n# real download/upload traffic, so you can later compare it against\r\n# latency measured while the link is busy (i.e. bufferbloat-style checks).\r\necho \"--- Latency (ping endpoint) ---\"\r\nfor i in 1 2 3 4 5; do\r\n # curl -w lets us pull specific timing fields out of the response\r\n # without parsing curl's normal output ourselves.\r\n # time_total = full round-trip time for the request, in seconds.\r\n curl -s -o /dev/null -w \" request $i: %{time_total}s\\n\" \"$SERVER_URL/ping\"\r\ndone\r\necho\r\n\r\n# --- 2. Download test ----------------------------------------------------------\r\necho \"--- Download test ---\"\r\nfor filename in \"${DOWNLOAD_FILES[@]}\"; do\r\n echo \" downloading $filename ...\"\r\n # -o /dev/null : discard the actual file content, we only care about timing\r\n # -w : print the metrics we care about once the transfer finishes\r\n # size_download -> bytes actually transferred\r\n # time_total -> total time for the request, in seconds\r\n # speed_download -> curl's own bytes/sec calculation for this transfer\r\n curl -s -o /dev/null -w \\\r\n \" size: %{size_download} bytes | time: %{time_total}s | speed: %{speed_download} bytes/sec\\n\" \\\r\n \"$SERVER_URL/files/$filename\"\r\ndone\r\necho\r\n\r\n# --- 3. Upload test --------------------------------------------------------------\r\necho \"--- Upload test ---\"\r\n\r\n# Generate a local throwaway file to upload, if one doesn't already exist.\r\n# We use /dev/urandom (not /dev/zero) for the same reason the server uses\r\n# random data for its download files: random bytes can't be shrunk by any\r\n# transparent compression sitting in the network path, which would\r\n# otherwise make the test look faster than the link actually is.\r\nif [ ! -f \"$UPLOAD_TEMP_FILE\" ]; then\r\n echo \" generating ${UPLOAD_SIZE_MB}MB local test file at $UPLOAD_TEMP_FILE ...\"\r\n dd if=/dev/urandom of=\"$UPLOAD_TEMP_FILE\" bs=1M count=\"$UPLOAD_SIZE_MB\" status=none\r\nfi\r\n\r\necho \" uploading $UPLOAD_TEMP_FILE ...\"\r\n# -X POST --data-binary \"@file\" sends the file as the raw request body\r\n# (rather than wrapping it in multipart/form-data), which keeps things\r\n# simple and matches what the server's /upload endpoint expects -- it\r\n# just reads the raw request stream as it arrives.\r\ncurl -s -X POST --data-binary \"@$UPLOAD_TEMP_FILE\" \\\r\n -w \" client-side: time: %{time_total}s | speed: %{speed_upload} bytes/sec\\n\" \\\r\n -o /tmp/speedtest_upload_response.json \\\r\n \"$SERVER_URL/upload\"\r\n\r\necho \" server-reported stats:\"\r\ncat /tmp/speedtest_upload_response.json\r\necho\r\necho\r\n\r\necho \"==============================================\"\r\necho \" Done.\"\r\necho \"==============================================\"",
"language": "javascript"
}
],
"primaryId": "3mstfj6r4zs25"
}
}
did:plc:useqzgsgxz2nhnurhu4377f5 | at://did:plc:useqzgsgxz2nhnurhu4377f5/club.syntax.feed.snap/3mstfj6winp2p
club.syntax.content.files (nested within club.syntax.feed.snap) (2 samples)
{
"$type": "club.syntax.feed.snap",
"title": "speed test client",
"content": {
"$type": "club.syntax.content.files",
"files": [
{
"id": "3mstfj6r4zs25",
"content": "#!/usr/bin/env bash\r\n#\r\n# speedtest_client.sh\r\n#\r\n# Runs download, upload, and latency tests against a speedtest server\r\n# (see the accompanying app.py) using only curl -- nothing needs to be\r\n# installed on the client side, since curl ships by default on virtually\r\n# every Linux distro, macOS, and Windows 10+.\r\n#\r\n# Usage:\r\n# ./speedtest_client.sh http://<server-ip-or-host>:8000\r\n#\r\n# Example:\r\n# ./speedtest_client.sh http://10.240.1.50:8000\r\n\r\nset -euo pipefail\r\n\r\n# --- Argument handling -------------------------------------------------------\r\nif [ $# -lt 1 ]; then\r\n echo \"Usage: $0 <server-url>\"\r\n echo \"Example: $0 http://10.240.1.50:8000\"\r\n exit 1\r\nfi\r\n\r\nSERVER_URL=\"$1\"\r\n\r\n# Which pre-generated file(s) to run the download test against. These must\r\n# match filenames that actually exist on the server -- check\r\n# http://<server-url>/ in a browser or with `curl <server-url>/` to see\r\n# the full list, and edit this array to match whatever sizes you care about.\r\nDOWNLOAD_FILES=(\"testfile_10mb.bin\" \"testfile_100mb.bin\")\r\n\r\n# Size (in MB) of the local file to generate for the upload test.\r\nUPLOAD_SIZE_MB=100\r\nUPLOAD_TEMP_FILE=\"/tmp/speedtest_upload_payload.bin\"\r\n\r\necho \"==============================================\"\r\necho \" Speedtest against: $SERVER_URL\"\r\necho \"==============================================\"\r\necho\r\n\r\n# --- 1. Latency check ---------------------------------------------------------\r\n# Hits /ping a handful of times and reports round-trip time for each. This\r\n# gives you a baseline latency number *before* the link gets loaded with\r\n# real download/upload traffic, so you can later compare it against\r\n# latency measured while the link is busy (i.e. bufferbloat-style checks).\r\necho \"--- Latency (ping endpoint) ---\"\r\nfor i in 1 2 3 4 5; do\r\n # curl -w lets us pull specific timing fields out of the response\r\n # without parsing curl's normal output ourselves.\r\n # time_total = full round-trip time for the request, in seconds.\r\n curl -s -o /dev/null -w \" request $i: %{time_total}s\\n\" \"$SERVER_URL/ping\"\r\ndone\r\necho\r\n\r\n# --- 2. Download test ----------------------------------------------------------\r\necho \"--- Download test ---\"\r\nfor filename in \"${DOWNLOAD_FILES[@]}\"; do\r\n echo \" downloading $filename ...\"\r\n # -o /dev/null : discard the actual file content, we only care about timing\r\n # -w : print the metrics we care about once the transfer finishes\r\n # size_download -> bytes actually transferred\r\n # time_total -> total time for the request, in seconds\r\n # speed_download -> curl's own bytes/sec calculation for this transfer\r\n curl -s -o /dev/null -w \\\r\n \" size: %{size_download} bytes | time: %{time_total}s | speed: %{speed_download} bytes/sec\\n\" \\\r\n \"$SERVER_URL/files/$filename\"\r\ndone\r\necho\r\n\r\n# --- 3. Upload test --------------------------------------------------------------\r\necho \"--- Upload test ---\"\r\n\r\n# Generate a local throwaway file to upload, if one doesn't already exist.\r\n# We use /dev/urandom (not /dev/zero) for the same reason the server uses\r\n# random data for its download files: random bytes can't be shrunk by any\r\n# transparent compression sitting in the network path, which would\r\n# otherwise make the test look faster than the link actually is.\r\nif [ ! -f \"$UPLOAD_TEMP_FILE\" ]; then\r\n echo \" generating ${UPLOAD_SIZE_MB}MB local test file at $UPLOAD_TEMP_FILE ...\"\r\n dd if=/dev/urandom of=\"$UPLOAD_TEMP_FILE\" bs=1M count=\"$UPLOAD_SIZE_MB\" status=none\r\nfi\r\n\r\necho \" uploading $UPLOAD_TEMP_FILE ...\"\r\n# -X POST --data-binary \"@file\" sends the file as the raw request body\r\n# (rather than wrapping it in multipart/form-data), which keeps things\r\n# simple and matches what the server's /upload endpoint expects -- it\r\n# just reads the raw request stream as it arrives.\r\ncurl -s -X POST --data-binary \"@$UPLOAD_TEMP_FILE\" \\\r\n -w \" client-side: time: %{time_total}s | speed: %{speed_upload} bytes/sec\\n\" \\\r\n -o /tmp/speedtest_upload_response.json \\\r\n \"$SERVER_URL/upload\"\r\n\r\necho \" server-reported stats:\"\r\ncat /tmp/speedtest_upload_response.json\r\necho\r\necho\r\n\r\necho \"==============================================\"\r\necho \" Done.\"\r\necho \"==============================================\"",
"language": "javascript"
}
],
"primaryId": "3mstfj6r4zs25"
}
}
did:plc:useqzgsgxz2nhnurhu4377f5 | at://did:plc:useqzgsgxz2nhnurhu4377f5/club.syntax.feed.snap/3mstfj6winp2p