Skip to content

Instantly share code, notes, and snippets.

@Vontux
Vontux / vidprep.sh
Created February 25, 2020 20:03
requires youtube-dl, ffmpeg and qrencode. Requires directories called "subs" and "output" to be present alongside vidprep.sh. USAGE: vidprep.sh <YTURL> LANGUAGE ABBREVIATION. EXAMPLE: vidprep.sh https://youtu.be/jNQXAC9IVRw en
#!/bin/bash
yeet=$(youtube-dl -cites --write-auto-sub $1)
ext=mp4
#in case title pull fails, set yeet to uuidgen
echo "yeet is: " "${#yeet}"
echo $2
if [ -z "$yeet" ] || [ "${#yeet}" -gt 254 ]
then
yeet=$(uuidgen)
@Vontux
Vontux / prepvid.sh
Created February 13, 2020 05:29
downloads youtube videos, downloads the automatically generated subtitles, converts them to srt, burns them into video file, takes youtube url makes qr code and burns that into video.
#!/bin/bash
#youtube-dl -cit --write-auto-sub $1
yeet=$(youtube-dl -cites --write-auto-sub $1)
#in case title pull fails, set yeet to uuidgen
if [ -z "$yeet" ]
then
yeet=$(uuidgen)
fi
@Vontux
Vontux / grabusb.sh
Created January 30, 2020 07:06
grabs files from usb device, copies to disk and uses PiFmRds using the files pulled off the usb drive.
#!/bin/bash
USBDIR="/home/pi/usbmount"
AUDIODIR="/home/pi/sounds"
freq=$(cat /home/pi/settings.txt)
name=$(cat /home/pi/name.txt)
radtxt=$(cat /home/pi/radiotext.txt)
echo "mounting usb"
sudo mount -t vfat -o rw,users /dev/sda1 $USBDIR
@Vontux
Vontux / ffmpeg_waveform_animatedgifs.txt
Created November 25, 2019 23:12
Wave Form overlay audio source rendered to video with animated gif looped in the background , minor tweak, have -t based on how many times you want the gif to loop, will be unique for each gif and audio file pair
ffmpeg -y -i output.mp3 -ignore_loop 0 -t 28800 -i kel.gif -filter_complex "[0:a]showwaves=s=400x240:mode=line,colorkey=0x000000:0.01:0.1,format=yuva420p[v];[1:v][v]overlay[outv]" -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output1.mp4
@Vontux
Vontux / gist:a7a049a70fd95b9e7f876d10f041e689
Created October 22, 2019 07:09
get youtube title, date, url within date range
youtube-dl -s --print-json --dateafter 20180101 --datebefore 20181001 "https://www.youtube.com/user/USER/videos" | jq -r '.upload_date','.fulltitle','.webpage_url'
@Vontux
Vontux / ytviews.py
Created January 30, 2019 19:33
youtube video view count script that takes a youtube url as a commandline argument and prints its view count to the console, uses code from https://stackoverflow.com/questions/42926027/how-can-i-get-some-data-from-a-video-youtube-python
import sys
import urllib2
source = sys.argv.pop()
response = urllib2.urlopen(source)
html = response.read()
wordBreak = ['<','>']
html = list(html)
i = 0
while i < len(html):
#!/bin/bash
curl 'https://api.coinbase.com/v2/prices/LTC-USD/spot' 2>/dev/null | jq '.data'.'amount' --raw-output
#!/bin/bash
curl 'https://api.coinbase.com/v2/prices/LTC-USD/spot' 2>/dev/null | jq '.data'.'amount' --raw-output
#!/bin/bash
arecord -f S16_LE -D hw:1,0 $(date '+%Y-%m-%d_%H-%M-%s.wav')
@Vontux
Vontux / testbutton.py
Created October 22, 2017 08:09
Script to test TTP223 Capacitive Touch Switch
#!/usr/bin/env python
#tweaked a script from an adafruit tutorial
#https://learn.adafruit.com/playing-sounds-and-using-buttons-with-raspberry-pi?view=all
import os
from time import sleep
import random
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)