diff --git a/README.md b/README.md index 81e23a2..4ec1498 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,11 @@ The repository contains a collection of random scripts and short programs. # Contents 1. [7digital.rb](#7digitalrb) -2. [mock\_server.rb](#mock_serverrb) -3. [cross\_toolchain.rb](#cross_toolchainrb) -4. [rename.rb](#renamerb) -5. [pg\_jekyll.rb](#pg_jekyllrb) -6. [locopy](#locopy) -7. [tea-cleaner](#tea-cleaner) +2. [cross\_toolchain.rb](#cross_toolchainrb) +3. [rename.rb](#renamerb) +4. [pg\_jekyll.rb](#pg_jekyllrb) +5. [locopy](#locopy) +6. [tea-cleaner](#tea-cleaner) ## 7digital.rb @@ -26,23 +25,6 @@ according to the meta information saved in the audio files. The audio files are expected to be in 2 directories, the artist and album directories. These directories are also renamed. -## mock\_server.rb - -`bin/mock\_server.rb` takes some JSON on its STDIN and starts a simple HTTP server -that slowly (in chunks) answers all requests with the given input. - -For example: - -```sh -echo '{"var": "stuff"}' | ./bin/mock_server.rb -``` - -and in another session: - -``` -curl localhost:8082 -``` - ## cross\_toolchain.rb `bin/cross_toolchain.rb` builds a cross toolchain for 32-bit RISC-V (G). The diff --git a/bin/mock_server.rb b/bin/mock_server.rb deleted file mode 100755 index b33eac6..0000000 --- a/bin/mock_server.rb +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env ruby -# This Source Code Form is subject to the terms of the Mozilla Public License, -# v. 2.0. If a copy of the MPL was not distributed with this file, You can -# obtain one at https://mozilla.org/MPL/2.0/. - -# frozen_string_literal: true - -require 'socket' -require 'json' - -TCP_PORT = 8082 - -server = TCPServer.new TCP_PORT - -puts "Provide some JSON and press Ctrl-D oder pipe the input via STDIN." -response = '' - -while input = gets do - response += input -end - -puts "Starting the server on #{TCP_PORT}." - -loop do - client = server.accept - - puts 'Connection accepted' - puts client.gets - - begin - client.print("HTTP/1.1 200 OK\r\n") - client.print("Content-Type: application/json\r\n") - client.print("Content-Length: #{response.bytesize}\r\n") - client.print("Connection: close\r\n") - client.print("\r\n") - - response.each_char do |chunk| - client.print chunk - sleep 0.1 - end - - # client.print(response) - end - - client.close -end