Skip to content

Instantly share code, notes, and snippets.

View alyssadev's full-sized avatar

Aly Smith alyssadev

View GitHub Profile
@alyssadev
alyssadev / afterpay-fetch-data.py
Last active April 23, 2021 07:33
A script to download afterpay payment due information and save to afterpay-due.json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from subprocess import Popen, PIPE
from os import environ
try:
driver = webdriver.Chrome(environ.get("CHROMEDRIVER_PATH", "chromedriver.exe"))
driver.get("https://portal.afterpay.com/au/login-email")
@alyssadev
alyssadev / plexbrowse.py
Last active February 17, 2021 17:20
A script to let you play things from a given plex host using a token from your environment
#!/usr/bin/env python3
# python3 plexbrowse.py | while read p; do mpv "$p"; done
# use --host to set the hostname of the server to access
# set PLEX_TOKEN in your environment with your X-Plex-Token
import requests
from os import environ
from os.path import basename
import xml.etree.ElementTree as ET
from sys import stderr
@alyssadev
alyssadev / win-remote-ssh.ps1
Last active March 13, 2021 14:17
A script that should configure a given windows machine to have openssh running at least. opens vim to paste in authorized keys, installs scoop as well
Set-ExecutionPolicy RemoteSigned
New-Item -path $profile -type file -force
Add-Content -path $profile -value '[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"'
& $profile
iwr -useb get.scoop.sh | iex
scoop install git
scoop update
iwr https://github.com/PowerShell/Win32-OpenSSH/releases/download/v8.1.0.0p1-Beta/OpenSSH-Win64.zip -outfile "C:\Program Files\OpenSSH-Win64.zip"
expand-archive -path "C:\Program Files\OpenSSH-Win64.zip" -destinationpath "C:\Program Files"
move-item "C:\Program Files\OpenSSH-Win64" "C:\Program Files\OpenSSH"
@alyssadev
alyssadev / tdsdec.sh
Created April 12, 2021 07:22
Linux .3ds decrypt
#!/bin/bash -x
# https://gbatemp.net/download/batch-cia-3ds-decryptor.35098/
# adapted from the .bat file in this zip
# requires wine
# intended for e.g Homebrew.Game.Title/asdf.rar, produces Homebrew.Game.Title.3ds as decrypted output
_PWD=$(pwd)
DECRYPTPATH=/root
cd "$1"
unrar -o+ x $(find . -name *.rar | head -n1)
echo | wine $DECRYPTPATH/decrypt.exe *.3ds
@alyssadev
alyssadev / vultrwin.sh
Last active April 25, 2021 20:54
A windows startup cmd script, and bash script to execute it on vultr. installs all the things i think are useful to have on a new windows server
#!/bin/bash
domain="alyssasmith.id.au"
if [ -z "$1" ]; then
region="syd"
else
region="$1"
fi
if [ -z "$2" ]; then
size="vc2-4c-8gb"
else
@alyssadev
alyssadev / ending1.md
Last active June 6, 2021 20:52
A guide for all endings in Analogue: A Hate Story, and some notes

Ending 1: *Hyun-ae leaves home, in the care of a new friend

tbd

@alyssadev
alyssadev / dur
Last active July 1, 2021 23:16
A script to get total duration of files provided in arguments. Python3 and ffprobe
#!/usr/bin/env python3
from sys import stderr, argv, exit
import subprocess
from math import floor
def hms(inp):
s,ms = divmod(inp,1)
m,s = divmod(s,60)
h,m = divmod(m,60)
return f"{h:02.0f}:{m:02.0f}:{s:02.0f}.{floor(ms*100):02.0f}"
@alyssadev
alyssadev / acnhmusic.py
Created July 8, 2021 01:07
plays the acnh soundtrack synced to real time kinda
#!/usr/bin/env python3
# videos from https://tane.us/ac/nhIds.js, rename to hh00.m4a
# python3 acnhmusic.py | mpv - --loop-playlist=inf
from glob import glob
from datetime import datetime
from sys import stderr
print("#EXTM3U")
files = sorted(glob("*.m4a"))
@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)
@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",
}