A full functional mail server to be used in a local network.
sudo apt install postfix dovecot-imapd| <dialog onclick="this.close()"> | |
| <iframe name="modal" onload="this.contentDocument.body.innerHTML.trim() ? ( | |
| this.style.height = 0, this.parentElement.showModal(), | |
| this.style.height = this.contentDocument.body.scrollHeight + 'px' | |
| ) : this.parentElement.close()"></iframe> | |
| </dialog> |
| #!/bin/sh | |
| port=8000 | |
| echo "Starting server on port $port..." | |
| while true; do | |
| echo "HTTP/1.1 200 OK | |
| Content-Type: text/plain |
| #!/bin/bash | |
| CODE='console.' | |
| INIT='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":1,"rootUri":null,"capabilities":{}}}' | |
| INITIALIZED='{"jsonrpc":"2.0","method":"initialized","params":{}}' | |
| DIDOPEN="{\"jsonrpc\":\"2.0\",\"method\":\"textDocument/didOpen\",\"params\":{\"textDocument\":{\"uri\":\"file:///dev/null\",\"languageId\":\"typescript\",\"version\":1,\"text\":\"$CODE\"}}}" | |
| COMPLETION="{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"textDocument/completion\",\"params\":{\"textDocument\":{\"uri\":\"file:///dev/null\"},\"position\":{\"line\":0,\"character\":${#CODE}}}}" | |
| { |
| document.querySelectorAll('template[id]').forEach(({id, content}) => | |
| customElements.define(id, class extends HTMLElement { | |
| constructor() { | |
| super().attachShadow({mode: 'open'}).appendChild(content.cloneNode(true)); | |
| [...this.attributes].forEach(({name, value}) => { | |
| const span = document.createElement('span'); | |
| this.appendChild(Object.assign(span, {slot: name})).textContent = value; | |
| this.removeAttribute(name) | |
| this.shadowRoot.querySelectorAll(`[${name}]`).forEach(el => | |
| !el.getAttribute(name) && el.setAttribute(name, value)); |
| <iframe hidden onload="this.replaceWith(...contentDocument.body.children)" src="head.html"></iframe> |
| <script> | |
| function formRequest(method) { | |
| const action = event.target.action; | |
| event.preventDefault(); | |
| fetch(action, { method, body: new FormData(event.target) }) | |
| .then(res => res.redirected && (location.href = res.url)); | |
| } | |
| const PUT = formRequest.bind(null, "PUT"); | |
| const DELETE = formRequest.bind(null, "DELETE"); | |
| </script> |
| package main | |
| import ( | |
| "fmt" | |
| "net" | |
| "os" | |
| "sync" | |
| "time" | |
| ) |
| (define (tokenize script-text) | |
| (let ((tkns (list "")) (in-str? #f)) | |
| (define (append-str! str) | |
| (set-car! tkns (string-append (car tkns) str))) | |
| (define (add-tkn! . strs) | |
| (if (string=? (car tkns) "") (set! tkns (cdr tkns))) | |
| (set! tkns (append (reverse strs) tkns))) |
| const ElementBuilder = new Proxy({}, { get: (_, tagName) => (...args) => { | |
| const element = Object.assign(document.createElement(tagName), ...args); | |
| element.append(...args.filter(arg => arg.constructor !== Object)); | |
| return element; | |
| }}); | |
| const EventHandler = (element, fn) => Object.assign(element || {}, { | |
| update: (...newProps) => element.replaceWith(fn(...newProps)), | |
| listen: (eventType, handler) => (element.dataset.event = "", element) | |
| .addEventListener(eventType, ({ detail }) => handler(detail)), |