From dc8d497a298165ec954a5ff550cd97c79dde1a8a Mon Sep 17 00:00:00 2001 From: VG Date: Thu, 11 May 2017 10:01:40 +0200 Subject: add more scripts --- scripts/qs1 | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 scripts/qs1 (limited to 'scripts/qs1') diff --git a/scripts/qs1 b/scripts/qs1 new file mode 100755 index 0000000..d524223 --- /dev/null +++ b/scripts/qs1 @@ -0,0 +1,41 @@ +#!/bin/bash +set -eu +port=8000 + +disp_quick_usage() +{ + cat < use remote filename" + echo "==================================================" +} + + +disp_quick_usage +filename="$1" +sfilename="$(echo x$filename | sed 's/^x//;s/"//')" +( + echo "HTTP/1.1 200 OK" + #echo "Content-Type: $(file -bni "$1")" + echo "Content-Type: application/octet-stream" + echo "Content-Transfer-Encoding: binary" + echo "Content-Disposition: attachment; filename=\"$sfilename\"" + echo "Content-Length: $(du -b "$filename" | cut -f1)" + echo "" + cat -- "$filename" +) | nc -l -q0 -p $port >/dev/null 2>&1 -- cgit v1.2.3