View movconcat.js
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"; | |
const sources = Deno.args.at(-2); | |
const output = Deno.args.at(-1); | |
const inputs = []; | |
for await (const {name} of Deno.readDir(sources)) inputs.push(name); | |
inputs.sort(); | |
const list = inputs.map(f => `file ${path.toFileUrl(path.join(sources, f))}\n`).join(``); |
View spiral.html
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" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r68/three.min.js" | |
></script> | |
<script src="https://rawgit.com/mrdoob/three.js/master/examples/js/controls/Trac | |
kballControls.js" | |
></script> | |
<script src="spiral.js"></script> |
View index.html
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> | |
<!-- IMPORTANT: The current Chrome requires some origin-trial token in <meta>. | |
To register origins at the last "WebGPU REGISTER" in https://developer.chrome.com/origintrials/ | |
This token is for a Web Origin "https://gist.githack.com" (maybe expired at Mar 31, 2022) | |
It can register localhost origin as "http://localhost:8000" | |
--> | |
<meta http-equiv="origin-trial" | |
content="Akv07qcAop5MFaZYxJtHHjUuM8eV3GpbHkTeuhZo/4wsNjYnQ7GSGJyo7hRVZvpvyjYwilbJ8KbFVchI4O1DpA0AAABQeyJvcmlnaW4iOiJodHRwczovL2dpc3QuZ2l0aGFjay5jb206NDQzIiwiZmVhdHVyZSI6IldlYkdQVSIsImV4cGlyeSI6MTY1MjgzMTk5OX0=" /> |
View compute-example.js
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
// Compute example for WebGPU API for Chrome-103: https://www.w3.org/TR/webgpu/ | |
// [Usage] Paste whole codes into Web Comsole of the WebGPU demo page, then output 1024 Float32Array of squares | |
const adapter = await navigator.gpu.requestAdapter(); | |
const device = await adapter.requestDevice(); | |
// WGSL shaders: https://www.w3.org/TR/WGSL/ | |
const workgroupSize = device.limits?.maxComputeInvocationsPerWorkgroup ?? 64; | |
const computeWgsl = ` | |
struct IO { | |
values: array<i32>, |
View index.html
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> | |
<!-- IMPORTANT: The current Chrome requires some origin-trial token in <meta>. | |
To register origins at the last "WebGPU REGISTER" in https://developer.chrome.com/origintrials/ | |
This token is for a Web Origin "http://localhost:8000" (maybe expired at Mar 31, 2022) | |
--> | |
<meta http-equiv="origin-trial" | |
content="AkIL+/THBoi1QEsWbX5SOuMpL6+KGAXKrZE5Bz6yHTuijzvKz2MznuLqE+MH4YSqRi/v1fDK/6JyFzgibTTeNAsAAABJeyJvcmlnaW4iOiJodHRwOi8vbG9jYWxob3N0OjgwMDAiLCJmZWF0dXJlIjoiV2ViR1BVIiwiZXhwaXJ5IjoxNjUyODMxOTk5fQ==" /> | |
<meta http-equiv="origin-trial" |
View loader.html
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" /> | |
<title>STL File Viewer</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r68/three.min.js" | |
></script> | |
<script src="https://rawgit.com/mrdoob/three.js/master/examples/js/controls/TrackballControls.js" | |
></script> | |
<script src="loader.js"></script> |
View base58.js
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
// Bitcoin Base58 encoder/decoder algorithm | |
const btcTable = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; | |
console.assert(btcTable.length === 58); | |
// Base58 decoder/encoder for BigInt | |
function b58ToBi(chars, table = btcTable) { | |
const carry = BigInt(table.length); | |
let total = 0n, base = 1n; | |
for (let i = chars.length - 1; i >= 0; i--) { | |
const n = table.indexOf(chars[i]); |
View zip.js
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
"use strict"; | |
const zip = function* () { | |
const its = Array.from(arguments, e => e[Symbol.iterator]()); | |
while (true) { | |
const es = its.map(it => it.next()); | |
if (es.some(e => e.done)) return; | |
yield es.map(e => e.value); | |
} | |
}; |
View example.js
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
import {inverse, direct} from "./vincenty.js"; | |
{ | |
// example from https://vldb.gsi.go.jp/sokuchi/surveycalc/surveycalc/bl2stf.html | |
const latlon1 = [36.10377477777778, 140.08785502777778], latlon2 = [35.65502847222223, 139.74475044444443]; | |
console.log(inverse(latlon1, latlon2)); | |
const s =58643.80450350114, a1to2 = 211.99252761069826; | |
console.log(direct(latlon1, a1to2, s)); | |
console.log(latlon2); | |
} |
View example-ipfs.html
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" /> | |
<link rel="icon" href="data:img/x-icon," /> | |
<script type="module" src="./leaflet-gpx.js"></script> | |
</head> | |
<body style="height: 100vh; display: flex; align-items: center; justify-content: center;"> | |
<leaflet-gpx | |
style="width: 80vmin; height: 80vmin;" |