Skip to content

Instantly share code, notes, and snippets.

bellbind / concat.mjs
Last active May 21, 2022
[nodejs][macos] 10M bps video files concation with x4 speed and x2 volume with ffmpeg command
View concat.mjs
#!/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";
bellbind / movconcat.js
Last active May 21, 2022
[deno]10M bps video files concation with x4 speed and x2 volume with ffmpeg command
View movconcat.js
#!/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 "";
const sources =;
const output =;
const inputs = [];
for await (const {name} of Deno.readDir(sources)) inputs.push(name);
const list = => `file ${path.toFileUrl(path.join(sources, f))}\n`).join(``);
bellbind / spiral.html
Created Aug 15, 2014
[javascript][threejs] sphere spiral
View spiral.html
<!doctype html>
<meta charset="utf-8" />
<script src=""
<script src="
<script src="spiral.js"></script>
bellbind / compute-example.js
Last active May 9, 2022
[WebGPU] Draw a square with WebGPU for chrome-103
View compute-example.js
// Compute example for WebGPU API for Chrome-103:
// [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:
const workgroupSize = device.limits?.maxComputeInvocationsPerWorkgroup ?? 64;
const computeWgsl = `
struct IO {
values: array<i32>,
bellbind / index.html
Last active May 7, 2022
[WebGPU] Image texture example for WebGPU API for Chrome-100
View index.html
<!doctype html>
<!-- IMPORTANT: The current Chrome requires some origin-trial token in <meta>.
To register origins at the last "WebGPU REGISTER" in
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"
bellbind / loader.html
Last active May 3, 2022
[threejs][html5]STL File Viewer with HTML5 File API
View loader.html
<!doctype html>
<meta charset="utf-8" />
<title>STL File Viewer</title>
<script src=""
<script src=""
<script src="loader.js"></script>
bellbind / base58.js
Last active Apr 27, 2022
[ECMAScript][BigInt] base58 encoder/decoder algorithm on JavaScript and base58check on node.js
View base58.js
// 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]);
bellbind / zip.js
Last active Apr 26, 2022
[es6] zip generator for ES6
View zip.js
"use strict";
const zip = function* () {
const its = Array.from(arguments, e => e[Symbol.iterator]());
while (true) {
const es = =>;
if (es.some(e => e.done)) return;
yield => e.value);
bellbind / example.js
Created Apr 26, 2022
[javascript] geodesic direct/inverse by Vincenty formulae
View example.js
import {inverse, direct} from "./vincenty.js";
// example from
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));
bellbind / example-ipfs.html
Last active Apr 23, 2022
[leaflet] Web Component for display GPX
View example-ipfs.html
<!doctype html>
<meta charset="utf-8" />
<link rel="icon" href="data:img/x-icon," />
<script type="module" src="./leaflet-gpx.js"></script>
<body style="height: 100vh; display: flex; align-items: center; justify-content: center;">
style="width: 80vmin; height: 80vmin;"