Skip to content

Instantly share code, notes, and snippets.

View ROBERT-MCDOWELL's full-sized avatar

ROBERT MCDOWELL ROBERT-MCDOWELL

View GitHub Profile
@ROBERT-MCDOWELL
ROBERT-MCDOWELL / webgl.js
Created December 16, 2023 12:39 — forked from x-labz/webgl.js
WebGL initialization
var glRef = {};
function loadImage(src) {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => {
resolve(img);
};
img.src = src;
});
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);
@ROBERT-MCDOWELL
ROBERT-MCDOWELL / yuv_canvas
Created August 25, 2023 21:33 — forked from Teaonly/yuv_canvas
Draw YUV in a HTML5's Canvas
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;
@ROBERT-MCDOWELL
ROBERT-MCDOWELL / convert.js
Created August 25, 2023 02:18 — forked from ryohey/convert.js
Convert YUV420(I420) Progressive Planar to RGB in JavaScript
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)
@ROBERT-MCDOWELL
ROBERT-MCDOWELL / apache-peertube-for-v5.conf
Last active June 29, 2024 15:30 — forked from rigelk/peertube.conf
Unofficial support of the last and updated httpd/Apache vhost to run PeerTube 5.x ONLY
# PeerTube Apache configuration version 24.6.29 (for PeerTube version 5.x only)
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.
# check https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=modern&openssl=1.1.1d&hsts=false&ocsp=false&guideline=5.6 for hardening security
@ROBERT-MCDOWELL
ROBERT-MCDOWELL / udp.js
Created July 19, 2022 13:55 — forked from sid24rane/udp.js
Simple UDP Client and Server in Node.js ==> ( Echo Server )
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);
@ROBERT-MCDOWELL
ROBERT-MCDOWELL / string.compress.js
Created October 30, 2021 12:59 — forked from fliptopbox/string.compress.js
JavaScript String compression
/*
@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'