Skip to content

Instantly share code, notes, and snippets.

@carlHandy
carlHandy / webrtc.ts
Last active November 23, 2024 00:26
RTSP to Webrtc with GStreamer
import { WebSocketServer, WebSocketClient } from "https://deno.land/x/[email protected]/mod.ts";
import { load } from "https://deno.land/[email protected]/dotenv/mod.ts";
// Load and validate environment variables
const env = await load();
const PORT = parseInt(env.PORT || "8000", 10);
const WS_PORT = parseInt(env.WS_PORT || "8080", 10);
const ALLOWED_ORIGINS = env.ALLOWED_ORIGINS || "*";
const STUN_SERVER = env.STUN_SERVER || "stun:stun.l.google.com:19302";
@carlHandy
carlHandy / rstp_hls.ts
Last active November 22, 2024 22:57
RTSP to HLS conversion
import { serve } from "https://deno.land/[email protected]/http/server.ts";
import { ensureDir } from "https://deno.land/[email protected]/fs/mod.ts";
const server = serve({ port: 8000 });
console.log("HTTP webserver running. Access it at: http://localhost:8000/");
for await (const request of server) {
if (request.method === "POST" && request.url === "/stream") {
const body = await request.json();
const rtspUrl = body.rtspUrl;
@carlHandy
carlHandy / wp-server-block.sh
Created August 13, 2020 04:03
Installs and configures wordpress nginx server block.
#!/bin/bash
read -p 'Enter domain name: ' domain
# Functions
ok() { echo -e '\e[32m'$domain'\e[m'; } # Green
die() { echo -e '\e[1;31m'$domain'\e[m'; exit 1; }
NGINX_AVAILABLE='/etc/nginx/sites-available'
NGINX_ENABLED='/etc/nginx/sites-enabled'
WEB_DIR='/var/www'