View string.compress.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
/* | |
@fliptopbox | |
LZW Compression/Decompression for Strings | |
Implementation of LZW algorithms from: | |
http://rosettacode.org/wiki/LZW_compression#JavaScript | |
Usage: | |
var a = 'a very very long string to be squashed'; | |
var b = a.compress(); // 'a veryāăąlong striċ to bečquashed' |
View udp.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
var udp = require('dgram'); | |
// --------------------creating a udp server -------------------- | |
// creating a udp server | |
var server = udp.createSocket('udp4'); | |
// emits when any error occurs | |
server.on('error',function(error){ | |
console.log('Error: ' + error); |
View peertube.conf
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
# PeerTube Apache configuration version 23.8.15 | |
# For Apache version 2.4.47+ | |
SSLSessionCache "shmcb:/usr/local/apache/logs/ssl_gcache_data(512000)" | |
SSLSessionCacheTimeout 87400 | |
SSLStaplingCache shmcb:logs/stapling-cache(150000) | |
# Please check your Apache installation features the following modules via 'apachectl -M': | |
# STANDARD HTTP MODULES: core_module, proxy_module, proxy_http2_module, proxy_wstunnel_module, proxy_http_module, headers_module, remoteip_module, ssl_module, filter_module, reqtimeout_module | |
# THIRD PARTY MODULES: None. |
View convert.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
const WIDTH = 176 | |
const HEIGHT = 144 | |
const progRGB = yuv420ProgPlanarToRgb(base64ToArrayBuffer(yuv420ProgPlanarImage()), WIDTH, HEIGHT) | |
const canvas = document.createElement("canvas") | |
document.body.appendChild(canvas) | |
const ctx = canvas.getContext("2d") | |
const imageData = ctx.createImageData(WIDTH, HEIGHT) | |
putRGBToRGBA(imageData.data, progRGB, WIDTH, HEIGHT) | |
ctx.putImageData(imageData, 0, 0) |
View yuv_canvas
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
function yuv2canvas(yuv, width, height, canvas) { | |
/* | |
canvas.width = width; | |
canvas.height = height; | |
*/ | |
context = canvas.getContext("2d"); | |
output = context.createImageData(width, height); | |
outputData = output.data; | |
yOffset = 0; |
View frame-transformer-js-wasm.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
const W = 640; // video frame width | |
const H = 360; // video frame height | |
const pixelData = await imageLoader("./seaside.png"); // get the pixel data of the backgroung image in RGBA format | |
const buffer = new Uint8Array(W * H * 1.5); // byte buffer for the incoming frame in YUV 422 format | |
const bufferRGB = new Uint8Array(W * H * 4); // byte buffer for the result frame in RGBA format | |
const transformer = new TransformStream({ | |
async transform(videoFrame, controller) { | |
const copyResult = await videoFrame.copyTo(buffer); |