Skip to content

Instantly share code, notes, and snippets.

View unbelauscht's full-sized avatar

unbelauscht unbelauscht

  • Germany
View GitHub Profile
@unbelauscht
unbelauscht / deployment.yaml
Last active June 19, 2024 19:52
Streaming a webcam to Owncast using ffmpeg & k3s
apiVersion: apps/v1
kind: Deployment
metadata:
name: weedcam-live-ffmpeg
namespace: default
spec:
strategy:
type: Recreate
template:
metadata:
@unbelauscht
unbelauscht / siteatcf.py
Last active May 21, 2024 17:15
checks if a website is using cloudflare
#!/usr/bin/env python3
import ipaddress
import requests
import socket
from sys import argv, exit
def getIPs() -> ipaddress.ip_network:
r4 = requests.get("https://www.cloudflare.com/ips-v4")
@unbelauscht
unbelauscht / stream.sh
Last active April 8, 2024 15:05
stream webcam in h264 with hardware encoding to rtmp server like owncast
ffmpeg -f lavfi -i anullsrc -f v4l2 -r 5 -video_size 1920x1080 -i "/dev/video0" -c:v h264_omx -preset ultrafast -b:v 1000k -c:a aac -f flv 'rtmp://x.x.x.x/live/streamkey'
# rotate and crop
ffmpeg -f lavfi -i anullsrc -f v4l2 -r 1 -video_size 1920x1080 -i "/dev/video0" -vf "transpose=2,crop=1080:1080:960:540" -c:v h264_omx -preset ultrafast -b:v 1000k -c:a aac -f flv 'rtmp://x.x.x.x:xxxx/live/streamkey'
@unbelauscht
unbelauscht / get.py
Created December 27, 2023 20:43
Get "In Therapie" from Arte in German
#!/usr/bin/env python3
from yt_dlp import YoutubeDL
URLS = []
for i in range(1,36):
URLS.append(f"https://www.arte.tv/de/videos/089024-{str(i).zfill(3)}-A/in-therapie-staffel-1-{i}-35/")
URLS.append(f"https://www.arte.tv/de/videos/102958-{str(i).zfill(3)}-A/in-therapie-staffel-2-{i}-35/")
@unbelauscht
unbelauscht / convert.py
Created October 16, 2023 17:06
Convert a bunch of pngs to pdf with ocr
#!/usr/bin/env python3
from PIL import Image
from os import stat
from glob import glob
import subprocess
try:
subprocess.check_output('rm *.gs.png temp_no_ocr.pdf output.pdf', shell=True, executable="/bin/bash")
@unbelauscht
unbelauscht / deleteyoutubecomments.js
Created July 30, 2023 19:33
Bulk delete Youtube comment history
/*
Found here: https://webapps.stackexchange.com/questions/106093/how-do-i-bulk-delete-all-of-my-youtube-comments-and-replies#comment140001_115717
*/
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
} async function d() {
var i=0;
document.body.querySelectorAll('.VfPpkd-Bz112c-LgbsSe.yHy1rc.eT1oJ').forEach(
async (e) => { await sleep(1000 * i++); e.click(); });
@unbelauscht
unbelauscht / docker-compose.yml
Created February 3, 2023 14:28
Dendrite homeserver with Traefik configuration
version: "3.4"
services:
postgres:
image: postgres:14
restart: always
volumes:
- ./src/build/docker/postgres/create_db.sh:/docker-entrypoint-initdb.d/20-create_db.sh
# To persist your PostgreSQL databases outside of the Docker image,
# to prevent data loss, modify the following ./path_to path:
- ./data/postgresql:/var/lib/postgresql/data
@unbelauscht
unbelauscht / docker-compose.yml
Created February 3, 2023 13:36
docker-compose.yml with Cloudflare and Let's Encrypt
version: '3.7'
services:
traefik:
image: traefik:latest
restart: always
container_name: traefik
command:
#- --api.insecure=true
#- --api.dashboard=true
#- --api.debug=true
@unbelauscht
unbelauscht / fix_mtime.sh
Created March 24, 2022 15:41
fix nextcloud invalid modification time issues
#!/bin/bash
files=`find . -newermt "0000-12-31 23:59:59" ! -newermt "1970-00-01 23:59:59"`
for filename in $files; do
touch -a -m "${filename}"
done
# You need to run
# php occ files:scan --all
@unbelauscht
unbelauscht / ansible.txt
Created March 2, 2022 08:49
Ansible commands
# restart icinga2 service on all hosts
ansible -i hosts.live.yml all -b -m service -a "name=nginx state=restarted"
# check if host is reachable from Ansible hosts
ansible -i hosts.live.yml all -m wait_for -a "host=google.com port=443"