Skip to content

Instantly share code, notes, and snippets.

View MarkTiedemann's full-sized avatar

Mark Tiedemann MarkTiedemann

View GitHub Profile
@echo off
git clone --depth 1 --filter=blob:none --sparse https://github.com/DefinitelyTyped/DefinitelyTyped
pushd DefinitelyTyped
git sparse-checkout set types/node
rd /q /s .git
popd
ren DefinitelyTyped node_modules
ren node_modules\types @types
import fs from "node:fs";
import crypto from "node:crypto";
const hashAlgo = "sha512";
function hash(file) {
return new Promise(resolve => {
fs.createReadStream(file).pipe(
crypto.createHash(hashAlgo).setEncoding("base64")
).on("finish", function() {
// node --experimental-policy=policy.json evil.mjs
import fs from "node:fs";
console.log(fs.readFileSync("./no-secret.txt", "utf-8"));
console.log(fs.readFileSync("./secret.txt", "utf-8"));
// Usage: node sha384.mjs <file>
import fs from "node:fs";
import crypto from "node:crypto";
import process from "node:process";
console.log(
"sha384-" + crypto
.createHash("sha384")
.update(
// node --disallow-code-generation-from-strings eval.mjs
console.log(eval("1 + 1"));
// => EvalError: Code generation from strings disallowed for this context
<!DOCTYPE html>
<style>
dl {
display: flex;
}
dt {
white-space: nowrap;
}
<!DOCTYPE html>
<body></body>
<script>
class Element extends HTMLElement {
#globalEventListeners = [];
constructor(is, styles, properties, reflectedProperties) {
super();
const style = document.createElement("style");
style.textContent = styles;
@MarkTiedemann
MarkTiedemann / retro.html
Last active February 4, 2022 13:19
Minimal Retro App
<!DOCTYPE html>
<html lang="de">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Retrospektive</title>
<style>
body {
margin: 0 auto;
<meta http-equiv="x-ua-compatible" content="ie=9" />
<script>
var ip = "192.168.0.xxx";
var username = "xxxxxxxxxxxxx";
function api_get(path, callback) {
var req = new ActiveXObject("MSXML2.ServerXMLHTTP.3.0");
req.setOption(2, 13056); // allow self-signed certificate
req.onreadystatechange = function () {

Test

C:\> deno run --allow-net single_request.ts
C:\> curl -i localhost
HTTP/1.1 200 OK
content-type: text/plain;charset=UTF-8