Skip to content

Instantly share code, notes, and snippets.

@Vigrond
Vigrond / twitch_live_screenshot.sh
Created November 3, 2018 07:19
Take a screenshot of a live twitch stream.
# "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
#
@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
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 / celery_django_redis_ratelimit.py
Last active February 12, 2024 05:42
Celery / Django / Redis Rate Limits done "as expected" - Simple SMTP Example
# 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 / django_channels_routing.py
Created June 18, 2019 08:42
Django Channels Auth Middleware for rest_framework_simplejwt
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 / ow_streaming_guide_240.txt
Last active March 30, 2020 04:06
240hz 60fps overwatch twitch streaming guide
*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 / ffmpeg-ubuntu-to-windows.txt
Last active February 12, 2021 09:59
Simple ffmpeg desktop audio sharing for Ubuntu
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 / jellyfinchromecast.md
Last active October 29, 2024 21:58
Jellyfin with Chromecast
@Vigrond
Vigrond / ffmpeg-vaapi-chromecast.md
Last active January 7, 2023 00:36
ffmpeg vaapi chromecast

system info

Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz

Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy

ensure vaapi setup correctly