Skip to content

Instantly share code, notes, and snippets.

// A BASIC Node server
// Routing Requests
const http = require("http");
const url = require("url");
const server = http.createServer(function(req, res) {
//console.log(req.url);
let parsedURL = url.parse(req.url, true);
let path = parsedURL.pathname;
@git-thinh
git-thinh / index.html
Created June 16, 2025 07:38 — forked from hubgit/index.html
Render the text of a PDF with PDF.js
<!doctype html>
<meta charset="utf-8">
<title>Render the text of a PDF with PDF.js</title>
<style>
.page-container {
box-shadow: 0 1px 3px #444;
position: relative;
font-size: 1px;
line-height: 1;
@git-thinh
git-thinh / ffmpeg.js
Created June 19, 2025 09:49 — forked from toshvelaga/ffmpeg.js
stream to twitch and youtube RTMP destinations using FFmpeg
const ffmpeg = child_process.spawn('ffmpeg', [
// the input
'-i',
'-',
// video codec config: low latency, adaptive bitrate,
// list of presets: https://trac.ffmpeg.org/wiki/Encode/H.264
// tune zerolatency is good for fast encoding and low-latency streaming
// g:v 60 ==> https://www.reddit.com/r/ffmpeg/comments/redaa2/while_livestreaming_to_youtube_using_ffmpeg_i_get/
'-c:v',
@git-thinh
git-thinh / ffmpegTee.js
Created June 19, 2025 09:50 — forked from toshvelaga/ffmpegTee.js
ffmpeg to stream live video using tee muxer
const ffmpegTee = (youtube, twitch, facebook) => {
return [
'-i',
'-',
// select first stream intended for output
'-map',
'0',
// video codec config: low latency, adaptive bitrate
'-c:v',
'libx264',