These are the tools I use to obfuscate files on the
site to make it harder for bots to slurp up
my content. They are not designed for
authentication/authorization. They
are not secure.
importinit,{decryptBytes,}from"/tools/encryption/apps/wasm-decryptor/pkg/wasm_decryptor.js";asyncfunctiondecryptURL(url){constresponse=awaitfetch(url);try{if(response.ok){constblob=awaitresponse.blob();constbuffer=awaitblob.arrayBuffer();constencryptedBytes=newUint8Array(buffer);constdecryptedBytes=awaitdecryptBytes(encryptedBytes);if(decryptedBytes.length===0){console.error("Decrypion failed. Check credentails");returnundefined;}returndecryptedBytes.buffer;}else{console.error(response);returnundefined;}}catch(error){console.error(error);returnundefined;}}constvideos={};asyncfunctionloadSplitEncryptedVideo(el,baseURL){constuuid=self.crypto.randomUUID();constdetailsURL=`${baseURL}/details.json`;constdetails=awaitfetch(detailsURL);if(details.ok){try{constjson=awaitdetails.json();el.addEventListener("canplaythrough",(event)=>{// TODO: Set up to check against the UUID so
// that multiple videos can be on the
// page at once.
console.log("Got canplaythrough.");});constmediaSource=newMediaSource();if(mediaSource){videos[uuid]={baseURL:baseURL,mediaSource:mediaSource,currentSegment:0,totalSegments:json.fileCount,};el.src=URL.createObjectURL(mediaSource);mediaSource.addEventListener("sourceopen",async()=>{videos[uuid].sourceBuffer=mediaSource.addSourceBuffer(`video/webm; codecs="vp9, opus"`,);videos[uuid].sourceBuffer.addEventListener("updateend",async(event)=>{if(videos[uuid].mediaSource.readyState==="open"){loadSegment(uuid);}},);loadSegment(uuid);});}else{// Presenter error message to UI here.
console.error("MediaSource not avaialbe on this browser");}}catch(error){console.error(error);}}else{console.error(`Could not load: ${detailsURL}`);}}asyncfunctionloadSegment(uuid){if(videos[uuid].currentSegment<videos[uuid].totalSegments){try{consturl=`${videos[uuid].baseURL}/${videos[uuid].currentSegment}.bin`;console.log(`processing segment: ${videos[uuid].currentSegment}`);constbuffer=awaitdecryptURL(url);if(buffer.length===0){console.error("Could not decrypt file. Check password");videos[uuid].mediaSource.endOfStream("network");}else{// const buffer = await response.arrayBuffer();
// const bytes = new Uint8Array(buffer);
// const responseBytes = await decrypt_file(bytes, "key");
videos[uuid].sourceBuffer.appendBuffer(buffer);videos[uuid].currentSegment++;}}catch(error){console.error(error);videos[uuid].mediaSource.endOfStream("network");}}else{videos[uuid].mediaSource.endOfStream();}}asyncfunctionmain(){awaitinit();constvideoEl=document.querySelector("#splitDecryptedVideo");constvideoRootURL="/tools/encryption/apps/wasm-decryptor/samples/video";loadSplitEncryptedVideo(videoEl,videoRootURL);}main();
Footnote Link Maker
Text:
Body Link
Footnote Link
HTML Colors
via: https://drafts.csswg.org/css-color-4/#named-colors
HTML Escaper
KSUIDLines to Line Items
Ratio Converter
Formula for Width:
STARTING_WIDTH * OUTPUT_HEIGHT / STARTING_HEIGHT
Formula for Height: STARTING_HEIGHT * OUTPUT_WIDTH / STARTING_WIDTH
sed
The latest sed command I'm using:
#!/bin/bashDIR=~/workshop/al9000.com/content/toolsfind"$DIR"\
-type f \
\(\
-iname"*.html"\
-o -iname"*.js"\
-o -iname"*.txt"\
-o -iname"*.json"\
\)\
-print0\
|xargs -0 sed -E -i""\
's!tools/tools!tools!g'# Reminder: -E is for extended RegEx# Reminder: -i is for editing the file in place
Unique Words
URLs to Links (sorted)
UUID Generator
title = "UUID Generator"
flags = ["skip"]
YouTube Links to Neopolitan