This file contains hidden or 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
import ( | |
os | |
net | |
net.urllib | |
) | |
const ( | |
methods_with_form = ['POST', 'PUT', 'GET', 'DELETE', 'HEAD'] | |
HEADER_SERVER = 'Server: VWeb\r\n' // TODO add to the headers | |
HTTP_404 = 'HTTP/1.1 404 Not Found\r\nContent-Type: text/plain\r\n\r\n404 Not Found' |
This file contains hidden or 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
<script src="./static/src-min/ace.js" type="text/javascript" charset="utf-8"></script> | |
<script> | |
// initialize the content of the text editor to some Javascript | |
$("#editor").text(`function echo(m) {\n\treturn m;\n}\nconsole.log(echo("Hello World"));`); | |
// initialize the editor environment using the ace library | |
var editor = ace.edit("editor"); | |
editor.session.setMode("ace/mode/javascript"); // editor language | |
editor.setTheme("ace/theme/dawn"); // editor theme |
This file contains hidden or 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
<div> | |
<nav class="text-dark d-flex align-items-center pl-2 bg-warning"><span>Editor (Use Ctrl-Enter to execute)</span><div class="btn btn-warning" action>EXECUTE</div></nav> | |
<div id="editor"></div> | |
</div> | |
<div> | |
<nav class="text-light d-flex align-items-center pl-2 bg-dark"><span>Dev Console (Use Ctrl-I to clear console)</span><div class="btn btn-dark" action>CLEAR</div></nav> | |
<pre id="console" | |
class="border border-dark bg-light text-dark p-2">Welcome to the JS Console<br />» </pre> | |
</div> |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<!-- Required meta tags --> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<!-- Bootstrap CSS --> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" |
This file contains hidden or 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
<style> | |
body, | |
html { | |
height: 100%; | |
} | |
#editor { | |
height: 100%; | |
} | |
body > div:first-child { |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<!-- Required meta tags --> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<!-- Bootstrap CSS --> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" |
This file contains hidden or 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
$ touch sender.js receiver.js | |
$ mkdir sender receiver |
This file contains hidden or 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
$ mkdir terminect | |
$ cd terminect |
This file contains hidden or 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 net = require("net"), fs = require("fs"); | |
let server, istream = fs.createReadStream("./sender/SC-02.pdf"); | |
server = net.createServer(socket => { | |
socket.pipe(process.stdout); | |
istream.on("readable", function () { | |
let data; | |
while (data = this.read()) { |
This file contains hidden or 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 net = require("net"), fs = require("fs"), remote_server = process.argv[2]; | |
let socket; | |
socket = remote_server ? net.connect(8000, remote_server) : net.connect(8000); | |
let ostream = fs.createWriteStream("./receiver/SC-02.pdf"); | |
let date = new Date(), size = 0, elapsed; | |
socket.on('data', chunk => { | |
size += chunk.length; | |
elapsed = new Date() - date; |
NewerOlder