Skip to content

Instantly share code, notes, and snippets.

View m1k1o's full-sized avatar

Miroslav Šedivý m1k1o

View GitHub Profile
@m1k1o
m1k1o / ubuntu-cuda-gstreamer.Dockerfile
Last active April 1, 2024 12:05
Ubuntu Cuda Gstreamer Dockerfile (with nvcodec support)
ARG UBUNTU_RELEASE=20.04
ARG CUDA_VERSION=11.4.2
ARG GSTREAMER_VERSION=1.22
#
# Stage 1
#
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_RELEASE} AS gstreamer-builder
ARG GSTREAMER_VERSION
@m1k1o
m1k1o / vod-hls-loop.php
Last active May 19, 2021 18:48
Simple VOD HLS Loop in PHP
<?php
header("Content-Type: application/x-mpegURL");
header("Content-Disposition: attachment; filename=index.m3u8");
$target_duration = 10;
$segments_total = 93;
$segments_live = 5;
$segment_path = "%03d.ts";
$start_offset = 0; // starts with 000.ts
@m1k1o
m1k1o / nvidia-docker.md
Last active March 29, 2021 19:41
Install Nvidia for Docker on Ubuntu

Install Nvidia CUDA and use it in Docker

1. Download

Should be something like this:

wget https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda_11.2.2_460.32.03_linux.runsudo
sh cuda_11.2.2_460.32.03_linux.run
@m1k1o
m1k1o / ffmpeg-icecast.sh
Created November 3, 2020 14:40
Live stream to Icecast using FFMPEG
#!/bin/sh
SOURCE="rtmp://localhost:1935/live"
BITRATE="64k"
IC_USER="source"
IC_PASS="abc"
IC_HOST="localhost"
IC_PORT="8080"
IC_STREAM="stream"
@m1k1o
m1k1o / ffmpeg-yt-storybaord.sh
Created October 4, 2020 20:57
Create youtube storyboards from VOD videos using FFMPEG
#!/bin/bash
# Storyboard frequency:
#
# 0 - 2 min, every 1 sec.
# 2 min - 5 min, every 2 sec.
# 5 min - 15 min, every 5 sec.
# 15 min + every 10 sec.
#
# Storyboard size:
@m1k1o
m1k1o / easy-rsa.sh
Created June 18, 2020 23:05
Generate files for OpenVPN
#!/bin/bash
# Source: https://wiki.archlinux.org/index.php/Easy-RSA
VER="3.0.7"
CA_NAME="EasyRSA CA"
#
# install easy-rsa
#
wget -O EasyRSA.tgz "https://github.com/OpenVPN/easy-rsa/releases/download/v${VER}/EasyRSA-${VER}.tgz"
@m1k1o
m1k1o / filerun-traefik-middleware.php
Created March 27, 2020 19:17
Use Filerun's session as auth middle in traefik.
<?php
// Stay logged in for 30min
$time_diff = 60 * 30;
// Create login page
$login_page = $_SERVER["HTTP_X_FORWARDED_PROTO"]."://".$_SERVER["HTTP_X_FORWARDED_HOST"].":".$_SERVER["HTTP_X_FORWARDED_PORT"];
$sess = $_COOKIE["FileRunSID"];
if(!preg_match("/^[a-zA-Z0-9]+$/", $sess)) {
header('HTTP/1.0 401 Unauthorized');
@m1k1o
m1k1o / source-maps-recover.js
Created January 30, 2020 23:12
Create file structure from source-maps.
const path = require('path');
const fs = require('fs');
function ensureDirectoryExistence(filePath) {
let dirname = path.dirname(filePath);
if (fs.existsSync(dirname)) {
return true;
}
ensureDirectoryExistence(dirname);
fs.mkdirSync(dirname);
@m1k1o
m1k1o / sueddeutsche-anti**2-adblock.js
Created December 9, 2019 13:15
Block adblock blocker on Süddeutsche zeitung.
// ==UserScript==
// @name Süddeutsche zeitung - Anti^2:Adblock.
// @namespace https://www.sueddeutsche.de/
// @version 1.0
// @description Block adblock blocker on Süddeutsche zeitung.
// @author kronos
// @match https://www.sueddeutsche.de/*
// @grant none
// ==/UserScript==
@m1k1o
m1k1o / oe3-player-display-songs.js
Last active December 8, 2019 11:38
View song names in OE3 player.
// ==UserScript==
// @name OE3 Player - display songs
// @namespace https://oe3.orf.at
// @version 1.0
// @description try to take over the OE3 Player!
// @author kronos
// @match https://oe3.orf.at/player*
// @grant none
// ==/UserScript==