Skip to content

Instantly share code, notes, and snippets.

@Vigrond
Vigrond / ffmpeg-vaapi-chromecast.md
Last active January 7, 2023 00:36
ffmpeg vaapi chromecast
View ffmpeg-vaapi-chromecast.md
@Vigrond
Vigrond / ffmpeg-ubuntu-to-windows.txt
Last active February 12, 2021 09:59
Simple ffmpeg desktop audio sharing for Ubuntu
View ffmpeg-ubuntu-to-windows.txt
In this example, the client is Ubuntu, and the server is Windows. ffmpeg will need to be installed on both. Other scenarios will need a different command and understanding of ffmpeg.
On the "client", run the ffmpeg command:
`ffmpeg -re -f alsa -ac 2 -i default -fflags +genpts -vn -c:a pcm_s16be -sdp_file ~/sdp_stream.sdp -f rtp rtp://server:1234`
Where `server` is your barrier server IP address. This will stream desktop audio to the specified address
(If you use pulse instead of alsa, replace `-f alsa` with `-f pulse` )
@Vigrond
Vigrond / ow_streaming_guide_240.txt
Last active March 30, 2020 04:06
240hz 60fps overwatch twitch streaming guide
View ow_streaming_guide_240.txt
*Last Updated: 3/25/2020*
Does your beefy computer have annoying issues streaming and playing at the same time? Read on...
This guide is intended for peeps who have something comparable to:
* i9 9900k @ 5ghz
* 32GB DDR4
* Nvidia Geforce RTX 2080
* Acer Predator XB252Q 240hz GSYNC monitor (1080p)
@Vigrond
Vigrond / django_channels_routing.py
Created June 18, 2019 08:42
Django Channels Auth Middleware for rest_framework_simplejwt
View django_channels_routing.py
import logging
from urllib.parse import parse_qs
from django.conf.urls import url
from channels.routing import ProtocolTypeRouter, URLRouter
from rest_framework_simplejwt.authentication import JWTAuthentication
logger = logging.getLogger(__name__)
class JwtTokenAuthMiddleware:
"""
@Vigrond
Vigrond / celery_django_redis_ratelimit.py
Last active November 28, 2021 23:01
Celery / Django / Redis Rate Limits done "as expected" - Simple SMTP Example
View celery_django_redis_ratelimit.py
# Rate limiting with Celery + Django + Redis
# Multiple Fixed Windows Algorithm inspired by Figma https://www.figma.com/blog/an-alternative-approach-to-rate-limiting/
# and Celery's sometimes ambiguous, vague, and one-paragraph documentation
#
# Celery's Task is subclassed and the is_rate_okay function is added
# celery.py or however your App is implemented in Django
import os
import math
@Vigrond
Vigrond / listlinksmixin.py
Last active May 18, 2020 18:13
A Django 2.2 Admin Mixin that supports foreign key relationship links with list_links attribute
View listlinksmixin.py
from django.urls import reverse
from django.utils.html import format_html
class ListLinksMixin(object):
"""
Support for list_links attribute. Items in list_links must also be in list_display
Usage to make 'fieldTwo' a link:
list_display = ('fieldOne', 'fieldTwo',)
list_links = ('fieldTwo',)
@Vigrond
Vigrond / twitch_live_screenshot.sh
Created November 3, 2018 07:19
Take a screenshot of a live twitch stream.
View twitch_live_screenshot.sh
# "install ffmpeg"
# git clone https://github.com/FFmpeg/FFmpeg.git
# cd FFmpeg
# ./configure --enable-openssl
# make
# sudo make install
#
# "install youtube-dl"
# pip3 install youtube-dl
#