Skip to content

Instantly share code, notes, and snippets.

View alyssadev's full-sized avatar

Aly Smith alyssadev

View GitHub Profile
@alyssadev
alyssadev / nbl_dl.py
Created March 29, 2022 06:29
A script to download game vods, condensed vods, or highlights from nbl.com.au without an account
#!/usr/bin/env python3
from requests import get, post
from subprocess import Popen
from os import remove
from datetime import datetime
class Category:
HIGHLIGHTS = 71361
CONDENSED = 71377
FULL = 71385
@alyssadev
alyssadev / plexbrowse.py
Last active February 15, 2022 06:16
a script to get direct download urls from a plex host. pass numbers as arguments to preselect choices instead of entering when prompted
#!/usr/bin/env python3
import requests
from sys import stderr, stdout, argv
from os import environ
from os.path import basename
host = environ.get("PLEX_HOST", "localhost")
token = environ.get("PLEX_TOKEN", "")
args = argv[1:]
@alyssadev
alyssadev / twitch_emotes.py
Created October 6, 2021 06:55
A script to download all twitch emotes for a given channel. pipe to bash or something idk
#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup as Soup
from sys import argv
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0' ,
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' ,
'Accept-Language': 'en-US,en;q=0.5',
'Content-Type': 'application/x-www-form-urlencoded' ,
@alyssadev
alyssadev / ytdl.sh
Created September 3, 2021 08:46
A script to launch a DO droplet in nyc3, download a video, and upload it somewhere with rclone, because geofencing sucks
#!/bin/bash
PUB_URL="https://example.com/"
REMOTE="remote:path/"
cat >/tmp/cloud.conf <<EOFF
#!/bin/bash
apt-get update
apt-get install python3-pip ffmpeg -y
pip3 install youtube-dl
@alyssadev
alyssadev / fwf-dl.sh
Created August 11, 2021 18:43
a thing to download every series from First We Feast for some reason
#!/bin/bash
function dlyt {
i=1
while read p; do
mkdir -p "$1/Season $i"
cd "$1/Season $i"
youtube-dl -ciw -f 22 -o "%(autonumber)s - %(title)s.%(ext)s" "$p"
cd "$OLDPWD"
i=$((i+1))
done
@alyssadev
alyssadev / scoophelper.py
Last active August 1, 2021 17:48
flask app for easier windows setup scoop.alyssasmith.id.au
#!/usr/bin/env python3
from flask import *
app = Flask(__name__)
@app.route("/")
def index():
buckets = "\n".join(f"scoop bucket add {bucket}" for bucket in request.args.get("buckets","").split(",")) if "buckets" in request.args else ""
packages = "\n".join(f"scoop install {package}" for package in request.args.get("pkgs","").split(",")) if "pkgs" in request.args else ""
return f"""Set-ExecutionPolicy RemoteSigned -scope CurrentUser
@alyssadev
alyssadev / hlstranscode.sh
Last active July 30, 2021 05:23
A script to launch a DO droplet with a script to download a file via http, transcode it using video2hls, upload the results to b2:ads-share/hls, then delete itself
#!/bin/bash
# hlstranscode $URL
cat >/tmp/cloud.conf <<EOFF
#!/bin/bash
apt-get update -qq
apt-get install ffmpeg -y -qq
curl https://rclone.org/install.sh | bash 2>/dev/null >/dev/null
export ID=\$(curl http://169.254.169.254/metadata/v1/id 2>/dev/null)
#!/usr/bin/env python3
# let's say you have a bucket on b2 containing videos which you've converted,
# using https://github.com/vincentbernat/video2hls, to a HLS file structure
# in subdirectories named for the sha1 sum of the original file.
# This script would produce an index of files available via HLS by parsing
# the output of `b2 ls BUCKET DIRECTORY --json --recursive` (available as
# data.json), returning json like
# [
# ["d5db29cd03a2ed055086cef9c31c252b4587d6d0",
# "filename.mp4"],
@alyssadev
alyssadev / cors.js
Last active July 21, 2021 23:27
cors proxy cloudflare worker
// We support the GET, POST, HEAD, and OPTIONS methods from any origin,
// and allow any header on requests. These headers must be present
// on all responses to all CORS preflight requests. In practice, this means
// all responses to OPTIONS requests.
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS",
"Access-Control-Max-Age": "86400",
}
@alyssadev
alyssadev / archive_size
Created July 8, 2021 22:55
A tool to get the size of an archive.org bucket
#!/usr/bin/env python3
import xmltodict
import requests
def sizeof_fmt(num, suffix='B'):
for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
if abs(num) < 1024.0:
return "%3.1f%s%s" % (num, unit, suffix)
num /= 1024.0
return "%.1f%s%s" % (num, 'Yi', suffix)