This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"time": "2023-12-11T00:00:01.123Z", "method": "GET", "path": "/foo/bar", "status_code": 200, "content_length": 423} | |
{"time": "2023-12-11T00:01:01.123Z", "method": "POST", "path": "/foo/bar", "status_code": 200, "content_length": 553} | |
{"time": "2023-12-11T00:02:01.123Z", "method": "GET", "path": "/foo/baz", "status_code": 200, "content_length": 345} | |
{"time": "2023-12-11T00:03:01.123Z", "method": "GET", "path": "/foo/baz", "status_code": 401, "content_length": 235} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# syntax=docker/dockerfile:1 | |
FROM ubuntu:22.04 | |
ENV DEBIAN_FRONTEND=noninteractive | |
ENV TZ=UTC | |
RUN <<EOF | |
set -eu | |
apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
create_bridge() { | |
local nsname="$1" | |
local ifname="$2" | |
echo "Creating bridge ${nsname}/${ifname}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
create_bridge() { | |
local nsname="$1" | |
local ifname="$2" | |
echo "Creating bridge ${nsname}/${ifname}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Usage: ethsend.py eth0 ff:ff:ff:ff:ff:ff 'Hello everybody!' | |
# ethsend.py eth0 06:e5:f0:20:af:7a 'Hello 06:e5:f0:20:af:7a!' | |
# | |
# Note: CAP_NET_RAW capability is required to use SOCK_RAW | |
import fcntl | |
import socket | |
import struct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -xeuo pipefail | |
create_bridge() { | |
local nsname="$1" | |
local ifname="$2" | |
echo "Creating bridge ${nsname}/${ifname}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import sys | |
for line in sys.stdin: | |
ds = eval(line) | |
print(json.dumps(ds)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python3 | |
import asyncio | |
import sys | |
counter = 0 | |
async def run_server(host, port): | |
server = await asyncio.start_server(serve_client, host, port) | |
await server.serve_forever() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
async function *walkdir(dir) { | |
const stack = [dir]; | |
while (stack.length) { | |
const filename = stack.pop(); | |
const stat = await fs.promises.stat(filename); | |
if (stat.isDirectory()) { | |
const files = (await fs.promises.readdir(filename)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const log = console.log; | |
console.log = (...args) => { | |
log.apply(console, [new Date().toISOString()].concat(args)); | |
}; | |
const port = process.argv[2]; | |
const server = http.createServer((req, res) => { | |
console.log('Incoming request'); |
NewerOlder