From 9784dd520a72b775641d649153101f4672139a9e Mon Sep 17 00:00:00 2001 From: Julian T Date: Thu, 23 Sep 2021 15:22:01 +0200 Subject: Add assignments for dist 3 --- sem7/dist/lec1/exc1.bash | 26 ++++++++++++++++++++++++++ sem7/dist/lec1/openapi.yaml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100755 sem7/dist/lec1/exc1.bash create mode 100644 sem7/dist/lec1/openapi.yaml (limited to 'sem7') diff --git a/sem7/dist/lec1/exc1.bash b/sem7/dist/lec1/exc1.bash new file mode 100755 index 0000000..e777f17 --- /dev/null +++ b/sem7/dist/lec1/exc1.bash @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -e + +if [ "$#" -lt 2 ]; then + echo Not enough arguments, use $0 inputfile outputfile + exit 1 +fi + +inputfile=$1 + +if [[ ! -f "$inputfile" ]]; then + echo File $inputfile does not exist + exit 1 +fi + +outputfile=$2 + +echo Sending file $inputfile into $outputfile + +# Open a server +nc -l -p 8080 > $outputfile & + +# Connect with client and send file +nc -c 127.0.0.1 8080 < $inputfile + +echo Done diff --git a/sem7/dist/lec1/openapi.yaml b/sem7/dist/lec1/openapi.yaml new file mode 100644 index 0000000..ab547f0 --- /dev/null +++ b/sem7/dist/lec1/openapi.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.3 +info: + title: open file + version: '1.0' +servers: + - url: 'http://localhost:8080' +paths: + /read/{filename}: + get: + operationId: getFile + responses: + '201': + description: Ok here is the file + content: + 'application/json': + schema: + type: string + '404': + description: File not found + content: + 'application/json': + schema: + type: string + parameters: + - name: filename + in: path + description: Name of file to read + required: true + schema: + type: string -- cgit v1.2.3