Skip to content

Instantly share code, notes, and snippets.

@jb-alvarado
jb-alvarado / pci-passthrough.md
Last active Sep 17, 2021
PCI Passthrough on Fedora 31
View pci-passthrough.md

PCI Passthrough

Hardware:

  • Mainboard ASUS PRIME Z390-A Z390
  • ASUS Dual-GTX1650-O4G
  • Intel i9 9900
  • 32GB Ram
  • NEC Corporation uPD720200 USB 3.0 Host Controller
  • Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 (1 TB)
View install-centos8-on-ibm-x3650.md

Install CentOS 8.2 on IBM x3650 M3

  1. prepare 2 USB sticks
  • first with Centos 8.2 minimal
  • second with correct version of dd-megaraid_sas driver from elrepo.org
  • the USB stick for the megaraid driver should have the lable OEMDRV, other while the drive is not recognize
  1. plug both USB sticks on server and boot
  2. go with F12 in boot menu and select USB device
  3. go truth the steps from CentOS install process
@jb-alvarado
jb-alvarado / urlify.js
Created Jun 30, 2021
Find URLs in text and create links out of it.
View urlify.js
function urlify(text) {
const hyperlink = /<a [^>]+>([\w\d./=:"-]+)<\/a>/g
const urlRegex = /(https?:\/\/|www\.)([\w\d./-]+)/g
return text.replace(/(?:\r\n|\r|\n)/g, '<br>')
.replace(hyperlink, '$1')
.replace(urlRegex, (url, protoOrSub, domain) => {
domain = domain.replace(/\/$/, '')
if (protoOrSub.match(/https?/)) {
View playbin_about-to-finish.py
#!/usr/bin/env python3
import gi
from urllib.parse import quote
gi.require_version('Gst', '1.0')
gi.require_version('GLib', '2.0')
from gi.repository import GLib, Gst
@jb-alvarado
jb-alvarado / hls.conf
Last active Mar 16, 2021
srs rtmp server with hls multiple bitrates
View hls.conf
listen 1935;
max_connections 20;
daemon on;
pid /usr/local/srs/objs/srs.pid;
srs_log_tank file; # console;
srs_log_file /var/log/srs.log;
ff_log_dir /dev/null;
# can be: verbose, info, trace, warn, error
srs_log_level warn;
@jb-alvarado
jb-alvarado / edge.conf
Created Sep 29, 2020
HLS - Origin / Edge Cache
View edge.conf
proxy_cache_path /mnt/ramdisk/cache_temp use_temp_path=off keys_zone=cache_temp:10m max_size=1536m inactive=1h;
server {
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/edge.example.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/edge.example.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
server_name edge.example.org;
View default-server-conf.sh
#!/bin/bash
# nano syntax highlighting
cat <<EOT > /usr/share/nano/config.nanorc
# config file highlighting
syntax "conf" "(\.(bashrc|zshrc|conf|config|cfg|cnf|cf|rc|lst|list|defs|ini|desktop|mime|types|preset|cache|seat|service|htaccess)$|(^|/)(\w*crontab|mirrorlist|group|hosts|passwd|rpc|netconfig|shadow|fstab|inittab|inputrc|protocols|sudoers)$|conf.d/|.config/)"
# default text
color magenta "^.*$"
@jb-alvarado
jb-alvarado / build.sh
Created Jan 7, 2019
build gst-plugin-bad example playout.c
View build.sh
#/bin/bash
rm -rf *.o playout
rm -rf "./deps/*"
mkdir -p ".deps"
system=$( uname -s )
if [[ "$system" == "Darwin" ]]; then
_libtool="glibtool"
@jb-alvarado
jb-alvarado / disable-global-hotkeys.patch
Created Oct 2, 2018
Disable OBS hotkeys when window is not in focus
View disable-global-hotkeys.patch
diff --git a/UI/data/locale/de-DE.ini b/UI/data/locale/de-DE.ini
index 5051ea51..791e622b 100644
--- a/UI/data/locale/de-DE.ini
+++ b/UI/data/locale/de-DE.ini
@@ -692,7 +692,7 @@ Basic.Settings.Advanced.Network="Netzwerk"
Basic.Settings.Advanced.Network.BindToIP="Interface"
Basic.Settings.Advanced.Network.EnableNewSocketLoop="Neuen Netzwerkcode aktivieren"
Basic.Settings.Advanced.Network.EnableLowLatencyMode="Niedriger Latenzmodus"
-Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Hotkeys deaktivieren, wenn das Hauptfenster im Fokus ist"
+Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Hotkeys deaktivieren, wenn das Hauptfenster nicht im Fokus ist"
@jb-alvarado
jb-alvarado / disable-plugins-in-development.php
Last active Jun 14, 2018
Disable specified WordPress plugins in your development environment. Useful for plugins that either make network calls you don't want when working (eg, auto-posting to Facebook), or for plugins that rely on services only available in production (eg, Varnish).
View disable-plugins-in-development.php
<?php
/**
* Disable specified plugins in your development environment.
*
* This is a "Must-Use" plugin. Code here is loaded automatically before
* regular plugins load. This is the only place from which regular plugins
* can be disabled programatically.
*
* Place this code in a file in WP_CONTENT_DIR/mu-plugins or specify a
* custom location by setting the WPMU_PLUGIN_URL and WPMU_PLUGIN_DIR