Skip to content

Instantly share code, notes, and snippets.

@alydevs
alydevs / ssh-setup.sh
Last active September 27, 2023 08:00
A script to pull .ssh authorized_keys and config from a repository and update the current user's .ssh with them.
#!/bin/bash -x
# curl s.aly.pet/ssh-setup | GIT_HOSTNAME=dotfiles.example.com GIT_USERNAME=you GIT_PASSWORD=password bash -x
if [ -z $GIT_HOSTNAME ]; then
echo -n "Git hostname: "
read -s GIT_HOSTNAME
fi
if [ -z $GIT_USERNAME ]; then
echo -n "Git username: "
read -s GIT_USERNAME
fi
@alydevs
alydevs / configuration.yml
Last active December 31, 2023 17:03
My Authelia setup https://auth.aly.pet
# authelia/config/configuration.yml
# run `openssl rand -hex 20` three times and update `jwt_secret`, `session.secret` and `storage.encryption_key`
server:
host: 0.0.0.0
port: 9091
log:
level: info
jwt_secret: TODO
default_redirection_url: https://auth.example.com
totp:
#!/usr/bin/env python3
import requests
from datetime import datetime, timedelta
with open(".bottoken") as f:
token = f.read().strip()
t = '\u2705'
f = '\u274c'
class Channel:
@alydevs
alydevs / aoc1.py
Created December 1, 2022 13:24
aoc 2022
with open("aoc1.txt") as f:
data = f.read().strip()
elves = [list(map(int,_.split("\n"))) for _ in data.split("\n\n")]
ans1 = max(sum(_) for _ in elves)
ans2 = sum(sorted(sum(_) for _ in elves)[-3:])
print(ans1,ans2)
@alydevs
alydevs / 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
@alydevs
alydevs / 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:]
@alydevs
alydevs / 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' ,
@alydevs
alydevs / 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
@alydevs
alydevs / 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
@alydevs
alydevs / 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