Skip to content

Instantly share code, notes, and snippets.

View vpalmisano's full-sized avatar

Vittorio Palmisano vpalmisano

View GitHub Profile
@vpalmisano
vpalmisano / vncserver@:1.service
Created March 17, 2023 15:06 — forked from spinxz/vncserver@:1.service
systemd service file for running a vncserver (e.g. tightvncserver)
# Vncserver service file for Debian or Ubuntu with systemd
#
# Install vncserver and tools
# e.g. apt-get install tightvncserver autocutsel gksu
#
# 1. Copy this file to /etc/systemd/system/vncserver@:1.service
# 2. Edit User=
# e.g "User=paul"
# 3. Edit the vncserver parameters appropriately in the ExecStart= line!
# e.g. the -localhost option only allows connections from localhost (or via ssh tunnels)
@vpalmisano
vpalmisano / shared_mutex.c
Created May 31, 2022 12:13 — forked from ben-cohen/shared_mutex.c
Mutex in mmap memory shared between processes.
/*
* shared_mutex: Mutex in mmap memory shared between processes.
*
* Ben Cohen, July 2017.
*
* Compile using:
* gcc -o shared_mutex shared_mutex.c -ggdb -Wall -std=c99 -pthread
*
* Two processes are created with an mmap shared memory region
* containing an array of chars and a mutex. The mutex is created with
#
# Utility functions for converting an sdp textual format to/from MediaSoup format
#
def sdpToMediasoup(text, config):
"""
Converts an SDP textual description used by GStreamer into the oRTP
format used by MediaSoup
:param text: The SDP text
#!/bin/bash
#
# Usage:
# ./v4l2loopback_script start <videosource> [<total fake sources> <width> <height> <framerate>]
#
set -ex
function start() {
local SRC=${1}
#!/usr/bin/env bash
function show_usage()
{
echo
echo "USAGE"
echo "-----"
echo
echo " SERVER_URL=https://my.mediasoup-demo.org:4443 ROOM_ID=test MEDIA_FILE=./test.mp4 ./gstreamer.sh"
echo
#!/bin/bash
csv=$1
read -d '' prog <<'EOT'
function get_var(array, name, convert_bps) {
for (i in array) {
if (array[i] ~ name) {
value = gensub("^"name":", "", "g", array[i])
import sys
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GLib
Gst.init(None)
pipeline = Gst.parse_launch('uridecodebin uri=file://%s name=d d. ! autovideosink d. ! autoaudiosink' %sys.argv[1])
bus = pipeline.get_bus()
bus.add_signal_watch()
apt-get update && apt-get install -y curl apt-transport-https curl software-properties-common nfs-common ntp
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/docker.list
deb https://download.docker.com/linux/$(lsb_release -si | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable
EOF
apt-get update && apt-get install -y --force-yes docker-ce=$(apt-cache madison docker-ce | grep 17.03 | head -1 | awk '{print $3}')
apt-mark hold docker-ce
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Polymer Bin</title>
<link href="https://unpkg.com/@polymer/polymer@2.0.0/polymer.html" rel="import" >
<link href="https://unpkg.com/@polymer/polymer@2.0.0/polymer-element.html" rel="import" >
@vpalmisano
vpalmisano / Blackmagic v4l loopback
Created September 19, 2017 09:33
Blackmagic v4l loopback
#!/bin/sh
modprobe v4l2loopback exclusive_caps=1
modprobe snd_aloop
GST_DEBUG=3,*decklink*:4 gst-launch-1.0 -tv \
decklinkvideosrc connection=hdmi \
! videoconvert ! videoscale ! videorate \
! video/x-raw,width=1920,height=1080,framerate=25/1,format=UYVY \
! v4l2sink device=/dev/video0 sync=0 \