This file contains 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
#!/usr/bin/env node | |
import * as fs from "node:fs"; | |
// IPFS | |
import * as IPFS from "ipfs-core"; | |
// WebRTCStar | |
import wrtc from "@koush/wrtc"; | |
import {sigServer} from "@libp2p/webrtc-star-signalling-server"; | |
import {webRTCStar} from "@libp2p/webrtc-star"; | |
// pubsub peerDiscovery | |
//import {floodsub} from "@libp2p/floodsub"; |
This file contains 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> | |
<head> | |
<link rel="stylesheet" href="./tree.css" /> | |
</head> | |
<body> | |
<label class="css-tree"><input type="checkbox" checked="checked">Tree (root)</label> | |
<ul> | |
<li> | |
<label class="css-tree"><input type="checkbox">Tree 1</label> |
This file contains 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> | |
<head> | |
<title>Origin Private File System Viewer</title> | |
<script type="module"> | |
// see https://fs.spec.whatwg.org/ | |
const showDir = (dir, check, ul) => { | |
check.addEventListener("change", ev => { | |
if (check.checked) (async () => { |
This file contains 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
export const timeout = (msec, ...args) => new Promise(f => setTimeout(f, msec, args)); | |
export const interval = (msec, ...args) => ({ | |
[Symbol.asyncIterator]() { | |
const rs = []; | |
const id = setInterval(() => rs.shift()?.call(undefined, {value: args, done: false}), msec); | |
return { | |
next() { | |
return new Promise(f => rs.push(f)); | |
}, | |
throw() { |
This file contains 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> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="user-scalable=no" /> | |
<link rel="icon" href="././clock.svg" /> | |
<link rel="manifest" href="./manifest.json" /> | |
<title>SVG Clock</title> | |
<style> | |
html {height: 100%;} |
This file contains 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> | |
<head> | |
<script type="module"> | |
document.querySelector("#run").addEventListener("click", async ev => { | |
const modUrl = new URL("./module.js", location.href).href; | |
//console.log(modUrl); | |
const iframe = document.createElement("iframe"); | |
iframe.style.display = "none"; | |
document.body.append(iframe); |
This file contains 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> | |
<head> | |
<meta charset="utf-8"> | |
<style> | |
/* shadow button */ | |
button { | |
border-style: none; | |
border-radius: 0.5em; | |
color: inherit; |
This file contains 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
#!/usr/bin/env -S deno run --allow-net | |
// Example registration page and its server of API: navigator.registerProtocolHandler() | |
import {serve} from "https://deno.land/std/http/server.ts"; | |
// A pattern of protocol scheme name is limited with prefix "web+" as web+lowerletters , | |
// or whitelisted names in https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler | |
const protocol = "web+local"; | |
// navigator.registerProtocolHandler() should be called in user inputs (e.g. button click) | |
// - forwarded url must be same origin of the location.href |
This file contains 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
#!/usr/bin/env -S deno run --allow-read --allow-run | |
// usage: deno run --allow-read --allow-run movconcat.js /Volumes/UNTITLED/Normal/F/ result.mp4 | |
import * as path from "https://deno.land/std/path/mod.ts"; | |
import * as flags from "https://deno.land/std/flags/mod.ts"; | |
const parsed = flags.parse(Deno.args); | |
const sources = parsed._.at(-2); | |
const output = parsed._.at(-1); | |
const inputs = []; | |
for await (const {name} of Deno.readDir(sources)) inputs.push(name); |
This file contains 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
#!/usr/bin/env node | |
// usage: node concat.mjs /Volumes/UNTITLED/Normal/F/ result.mp4 | |
import * as cp from "node:child_process"; | |
import * as fs from "node:fs/promises"; | |
import * as path from "node:path"; | |
import * as process from "node:process"; | |
import * as stream from "node:stream"; | |
import * as url from "node:url"; | |
//console.log(process.argv); |