Compare commits

..

32 Commits

Author SHA1 Message Date
5b3c01607d Add obs notification script 2024-06-17 07:13:26 -03:00
c11cf9202f script that tries to reformat scoop manifests into a nice order 2024-05-25 21:29:29 -03:00
4a7a367547 Add userscript that tries to show the tax on an item before checkout 2024-05-25 21:29:01 -03:00
0085d4dee2 add f4 toggle script 2024-05-25 21:28:32 -03:00
d3648342e5 Fix script 2024-05-25 21:27:29 -03:00
642edffcfe update script to be invoked only in folder where you want to remove version from folders 2024-05-25 21:11:34 -03:00
b449ded8fe Add initial folder scanning remove ver script 2024-05-25 21:05:18 -03:00
93a2d7e329 Make simple ftp server more reusable and add params 2024-04-19 15:32:12 -03:00
7be7397ab1 Add mcrcon wrapper script for ease of entering creds 2024-03-27 23:06:15 -03:00
e66fdf942a Update toggle update script to work with scoop steam installations 2024-03-27 23:04:09 -03:00
d2c5e8cdb9 Add script to compare local and remote scoop packages 2024-02-28 09:17:25 -04:00
fc62233d3f Add basic declarative scoop manager 2024-02-28 08:40:52 -04:00
5caeecb0e7 Make pip toggle utf8 2024-02-10 18:38:53 -04:00
271c4bfc92 Fix sanity check in openasar injector 2024-02-07 11:01:50 -04:00
7d90433a9a Add example on how to use java for scripting 2024-02-07 09:48:47 -04:00
30f67ab42b Merge remote-tracking branch 'refs/remotes/origin/master' 2024-02-03 15:14:47 -04:00
2acd572e8e Add rainbow test script 2024-02-03 15:14:16 -04:00
e4c6e42efb Add volumefix ahk script 2024-02-03 15:13:48 -04:00
ca5302f42f Fix syntax in obsidian checker 2024-01-31 10:14:09 -04:00
3b40a9d62f Add script that installs or uninstalls openasar on linux (tested only on mint) 2024-01-24 14:52:58 -04:00
71c14465b2 Add script for checking for updates for obsidian (only tested on linux mint) 2024-01-24 14:52:17 -04:00
f5abc5a54b Set spinner values to 0 and add update url 2024-01-07 00:57:02 -04:00
307dd6b0dc Add voltorbflip spinner userscript 2024-01-07 00:46:48 -04:00
bbb71a7c49 Add small wget script 2023-12-23 21:43:18 -04:00
f4316e598d Add tool to download from archive.org 2023-12-03 15:02:36 -04:00
76fb8c521d Add bruno api tests 2023-12-02 23:45:36 -04:00
ccc631b2ac Add stardew for upcoming 1.6 update 2023-12-02 23:42:25 -04:00
a463742cf6 Vimm's lair scraper 2023-12-02 23:40:27 -04:00
b352f4eff6 Script that just defines hq defaults for streaming 2023-12-02 23:39:50 -04:00
abdfc240e0 Add tool to convert rvz files to wbfs for hb 2023-12-02 23:39:29 -04:00
a544d40d3d Update todo 2023-11-22 04:44:13 -04:00
3d4e8e08a6 Add run config 2023-11-21 15:16:49 -04:00
57 changed files with 1251 additions and 11 deletions

10
JavaScripts/HelloWorld Executable file
View File

@ -0,0 +1,10 @@
#!/bin/env -S java --source 11
class Main {
public static void main(String args[]) {
System.out.println("HelloWorld!");
// Print the sum of 1 and 2
System.out.println(1 + 2);
}
}

View File

@ -0,0 +1,66 @@
# Import json parsing and urllib
import json
import urllib.request
# Import subprocess for running dpkg
import subprocess
# Endpoint for the latest release
API_URL = "https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest"
# DEB file name, will be filled in later
DEB_NAME = ""
# URL for the latest deb file, will be filled in later
DEB_URL = ""
# Version number, will be filled in later
DEB_VERSION = ""
# Installed version number, will be filled in later
INSTALLED_VERSION = ""
# Get the latest release from the API
with urllib.request.urlopen(API_URL) as url:
data = json.loads(url.read().decode())
assets = data["assets"]
for asset in assets:
if asset["name"].endswith(".deb"):
DEB_NAME = asset["name"]
DEB_URL = asset["browser_download_url"]
# Parse the version number from the deb file name
# Example: obsidian_0.12.15_amd64.deb -> 0.12.15
DEB_VERSION = DEB_NAME.split("_")[1]
print("Latest version: " + DEB_VERSION)
# Get the installed version number by parsing the output of dpkg -s obsidian
output = subprocess.run(["dpkg", "-s", "obsidian"], capture_output=True)
# Parse the output for the version number
# Example: Version: 0.12.15
for line in output.stdout.decode().split("\n"):
if line.startswith("Version:"):
INSTALLED_VERSION = line.split(" ")[1]
print("Installed version: " + INSTALLED_VERSION)
def semver_check_new(old, new):
# Split the version numbers into arrays of numbers
old_split = old.split(".")
new_split = new.split(".")
# Loop through the numbers
for i in range(len(old_split)):
# If the new version is higher, return true
if int(new_split[i]) > int(old_split[i]):
return True
# If the new version is the same or lower, return false
return False
# Check if the new version is higher than the installed version
if semver_check_new(INSTALLED_VERSION, DEB_VERSION):
print("New version available!")
# Download the deb file
urllib.request.urlretrieve(DEB_URL, DEB_NAME)
# Install the deb file
subprocess.run(["pkexec", "apt", "install", f"./{DEB_NAME}"])
# Remove the deb file
subprocess.run(["rm", DEB_NAME])
else:
print("No new version available")

122
OpenAsarInjector/main.py Normal file
View File

@ -0,0 +1,122 @@
ASAR = "app.asar"
ASAR_BACKUP = ASAR + ".bak"
SYMLINK_PATH = ""
REAL_PATH = ""
DISCORD_FOLDER = ""
RESOURCES_PATH = ""
def root():
import os
if os.geteuid() != 0:
print("Script not running as root")
exit()
def backup():
import os
# Check for existing backup
if os.path.isfile(RESOURCES_PATH + ASAR_BACKUP):
print("Backup already exists, openasar is already installed")
exit()
try:
print(RESOURCES_PATH + ASAR)
os.rename(RESOURCES_PATH + ASAR, RESOURCES_PATH + ASAR_BACKUP)
except Exception as e:
print("Couldn't rename file: " + str(e))
def find():
import os
from shutil import which
# Get full path of discord symlink on path
global SYMLINK_PATH
SYMLINK_PATH = which("discord")
# Parse real path of discord symlink
global REAL_PATH
REAL_PATH = os.path.realpath(SYMLINK_PATH)
# Get containing folder
global DISCORD_FOLDER
DISCORD_FOLDER = os.path.dirname(REAL_PATH)
# Add /resources/ to the real path
global RESOURCES_PATH
RESOURCES_PATH = DISCORD_FOLDER + "/resources/"
def download():
import urllib.request
import json
# Get nightly release from github
# url: https://github.com/GooseMod/OpenAsar/
# release: https://github.com/GooseMod/OpenAsar/releases/tag/nightly
API_URL = "https://api.github.com/repos/GooseMod/OpenAsar/releases/latest"
DOWNLOAD_URL = ""
with urllib.request.urlopen(API_URL) as url:
data = json.loads(url.read().decode())
DOWNLOAD_URL = data['assets'][0]['browser_download_url']
# Download the file
urllib.request.urlretrieve(DOWNLOAD_URL, RESOURCES_PATH + ASAR)
def kill():
import os
import signal
import psutil
# Get discord process
for proc in psutil.process_iter():
if proc.name() == "Discord":
# Kill discord
os.kill(proc.pid, signal.SIGTERM)
def uninstall():
import os
if os.path.isfile(RESOURCES_PATH + ASAR_BACKUP):
try:
os.remove(RESOURCES_PATH + ASAR)
os.rename(RESOURCES_PATH + ASAR_BACKUP, RESOURCES_PATH + ASAR)
except Exception as e:
print("Couldn't remove/rename file: " + str(e))
else:
print("No backup found, openasar is not installed")
exit()
# Should check if the package has been updated, as discords asar is much larger
def sanity_check():
import os
# Get file size of asar
asar_size = os.path.getsize(RESOURCES_PATH + ASAR)
# If the asar is larger than 1MB, discord has probably updated
if asar_size > 1000000:
print("Discord has probably updated, please clear backups and reinstall")
print("Would you like to clear backups? (y/n)")
answer = input().lower()
if answer == "y":
if os.path.isfile(RESOURCES_PATH + ASAR_BACKUP):
os.remove(RESOURCES_PATH + ASAR_BACKUP)
print("Backup cleared, installation will continue as normal")
print("Backups cleared, installation will continue as normal")
else:
print("Backups not cleared, please clean manually")
exit()
def main():
import sys
root()
kill()
find()
sanity_check()
if len(sys.argv) > 1:
if sys.argv[1] == "uninstall":
uninstall()
print("Uninstalled openasar")
else:
print("Unknown argument")
else:
backup()
download()
print("Installed openasar")
if __name__ == "__main__":
main()

View File

@ -26,7 +26,7 @@ if (Test-Path $location) {
Write-Host $newPipConfig Write-Host $newPipConfig
# Write the new content to the file # Write the new content to the file
$newPipConfig | Out-File $location -Force $newPipConfig | Out-File $location -Force -Encoding utf8
} else { } else {
# If it doesn't exist, create it # If it doesn't exist, create it
New-Item -Path $location -ItemType File New-Item -Path $location -ItemType File

View File

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="tsc" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="tsc" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@ -1,3 +1,3 @@
- Improve typescript support - Improve typescript support
- https://stackoverflow.com/questions/11286661/set-custom-attribute-using-javascript - Need to make the album swap only trigger when the album dropdown is selected
- https://stackoverflow.com/questions/11286661/set-custom-attribute-using-javascript

37
Rainbow/rainbow.js Normal file
View File

@ -0,0 +1,37 @@
// Approximate racket functions
function circle(color) {
print(`${color} circle`)
}
function square(color) {
print(`${color} square`)
}
function print(shape) {
console.log(shape)
}
// Cuz javascript doesn't have functional primitives
function first(list) {
return list[0]
}
function rest(list) {
return list.slice(1)
}
// Helper to cycle through the functions
function cycle(list) {
return rest(list).concat(first(list))
}
// The actual function
function rainbow(...functions) {
let colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
function rainbowRecursive(functions, colors) {
if (colors.length === 0) {
return
}
first(functions)(first(colors))
rainbowRecursive(cycle(functions), rest(colors))
}
rainbowRecursive(functions, colors)
}
rainbow(circle, square)

17
Rainbow/rainbow.rkt Normal file
View File

@ -0,0 +1,17 @@
#lang racket
(require pict)
(require pict/color)
; The actual function
(define (rainbow . shapes)
(define colors (list red orange yellow green blue purple))
(define (cycle lst) (append (rest lst) (list (first lst))))
(define (rainbow-recursive shapes colors)
(cond
[(empty? colors) (void)]
[(print((first colors) (first shapes)))
(rainbow-recursive (cycle shapes) (rest colors))]
)
)
(rainbow-recursive shapes colors))
; Example usage
(rainbow (filled-rectangle 25 25) (filled-ellipse 25 25))

View File

@ -0,0 +1,72 @@
# Get each folder in the current directory
$folders = Get-ChildItem -Directory
# Array to store the folders that need to be renamed
$work = @()
foreach ($folder in $folders) {
# Find the version number in the folder name
$version = $folder.Name -match '(\d+\.\d+\.\d+\.\d+)'
if ($version) {
# Replace entire folder name with the version number
$new_name = $matches[0]
# if version has a alpha character, remove it, eg 0.1.0a, then re-add it to new name
$alpha = $folder.Name -match '(\d+\.\d+\.\d+\.\d+)([a-zA-Z])'
if ($alpha) {
$new_name = $matches[1]
$new_name = $new_name + $matches[2]
}
$toadd = New-Object PSObject
$toadd | Add-Member -MemberType NoteProperty -Name path -Value $folder.FullName
$toadd | Add-Member -MemberType NoteProperty -Name newname -Value $new_name
$work += $toadd
Write-Host "Rename $folder to $new_name"
continue
}
# Find the version number in the folder name
$version = $folder.Name -match '(\d+\.\d+\.\d+)'
if ($version) {
# Replace entire folder name with the version number
$new_name = $matches[0]
# if version has a alpha character, remove it, eg 0.1.0a, then re-add it to new name
$alpha = $folder.Name -match '(\d+\.\d+\.\d+)([a-zA-Z])'
if ($alpha) {
$new_name = $matches[1]
$new_name = $new_name + $matches[2]
}
$toadd = New-Object PSObject
$toadd | Add-Member -MemberType NoteProperty -Name path -Value $folder.FullName
$toadd | Add-Member -MemberType NoteProperty -Name newname -Value $new_name
$work += $toadd
Write-Host "Rename $folder to $new_name"
continue
}
# Find the version number in the folder name
$version = $folder.Name -match '(\d+\.\d+)'
if ($version) {
# Replace entire folder name with the version number
$new_name = $matches[0]
# if version has a alpha character, remove it, eg 0.1.0a, then re-add it to new name
$alpha = $folder.Name -match '(\d+\.\d+)([a-zA-Z])'
if ($alpha) {
$new_name = $matches[1]
$new_name = $new_name + $matches[2]
}
$toadd = New-Object PSObject
$toadd | Add-Member -MemberType NoteProperty -Name path -Value $folder.FullName
$toadd | Add-Member -MemberType NoteProperty -Name newname -Value $new_name
$work += $toadd
Write-Host "Rename $folder to $new_name"
continue
}
}
Read-Host -Prompt "Press Enter to continue"
foreach ($item in $work) {
Rename-Item -Path $item.path -NewName $item.newname
}

View File

@ -0,0 +1,26 @@
// Run with node
// Read ~/scoop/apps.json and compare it to scoop export
// Then display the differences in the installed apps and the apps.json file
// read apps.json file
let fs = require('fs');
let apps = fs.readFileSync('C:/Users/Isaac/scoop/apps.json', 'utf8');
apps = JSON.parse(apps);
apps = apps.apps;
// run scoop export in shell and save output to variable
let { execSync } = require('child_process');
let installedApps = execSync('scoop export').toString();
installedApps = JSON.parse(installedApps);
installedApps = installedApps.apps;
// Make a set out of each of the arrays on the Name property
let appsSet = new Set(apps.map(app => app.Name));
let installedAppsSet = new Set(installedApps.map(app => app.Name));
// Find the difference between the two sets
let diffFromInstalledApps = new Set([...appsSet].filter(x => !installedAppsSet.has(x)));
let diffFromApps = new Set([...installedAppsSet].filter(x => !appsSet.has(x)));
console.log("Apps in apps.json but not installed: ", diffFromInstalledApps);
console.log("Apps installed but not in apps.json: ", diffFromApps);

View File

@ -0,0 +1,71 @@
<#
use this order to reformat json objects:
version
description
homepage
license
notes
depends
suggest
architecture
url
hash
extract_dir
extract_to
pre_install
installer
post_install
env_add_path
env_set
bin
shortcuts
persist
pre_uninstall
uninstaller
post_uninstall
checkver
autoupdate
#>
# Read all json files in the current directory
Get-ChildItem -Filter *.json | ForEach-Object {
# Read the file
$json = Get-Content $_.FullName | ConvertFrom-Json -Depth 9
# Create a new object with the properties in the desired order
$newJson = [ordered]@{
version = $json.version
description = $json.description
homepage = $json.homepage
license = $json.license
notes = $json.notes
depends = $json.depends
suggest = $json.suggest
architecture = $json.architecture
url = $json.url
hash = $json.hash
extract_dir = $json.extract_dir
extract_to = $json.extract_to
pre_install = $json.pre_install
installer = $json.installer
post_install = $json.post_install
env_add_path = $json.env_add_path
env_set = $json.env_set
bin = $json.bin
shortcuts = $json.shortcuts
persist = $json.persist
pre_uninstall = $json.pre_uninstall
uninstaller = $json.uninstaller
post_uninstall = $json.post_uninstall
checkver = $json.checkver
autoupdate = $json.autoupdate
}
# Remove any null properties
$newJson = $newJson | Where-Object { $_.Value -ne $null }
# Convert the new object back to json and write it back to the file
$newJson | ConvertTo-Json -Depth 9 | Set-Content $_.FullName
}
# Run scoop json prettier on all json files in the current directory
~/scoop/apps/scoop/current/bin/formatjson.ps1 -Dir .

54
ShowTax/showtax.js Normal file
View File

@ -0,0 +1,54 @@
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 2024-04-12
// @description try to take over the world!
// @author You
// @match https://www.amazon.ca/*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function() {
const TAX = 0.15;
// Todo: decide if it should just round up to the nearest dollar
// Todo: fix queryselectorall only finding one element at a time
const changeNode = function(node) {
var wholeNode = node.querySelector('.a-price-whole');
var fractionNode = node.querySelector('.a-price-fraction');
var whole = wholeNode ? wholeNode.textContent : '0';
var fraction = fractionNode ? fractionNode.textContent : '0';
whole = parseInt(whole);
fraction = parseInt(fraction);
whole += whole * TAX;
fraction += fraction * TAX;
whole = Math.floor(whole);
fraction = Math.floor(fraction);
if (fraction >= 100) {
whole += 1;
fraction -= 100;
}
if (fraction < 10) {
fraction = '0' + fraction;
}
wholeNode.textContent = whole;
fractionNode.textContent = fraction;
}
const find = function() {
console.log("Finding price nodes");
document.querySelectorAll('.a-price').forEach((node) => {
if (node.attributes['found']) {
return;
}
node.attributes['found'] = true;
console.log(node);
console.log("Price node found")
changeNode(node);
});
}
//find();
setInterval(find, 1000);
})();

View File

@ -1,16 +1,26 @@
param (
[int] [alias('p')] $port = 21,
[string] [alias('d')] $directory = '.',
[bool] [alias('w')] $write = $false
)
$venv = "\.pyftplib"
$venv = $HOME + $venv
# Create virtual environment # Create virtual environment
if (-not (Test-Path venv)) { if (-not (Test-Path $venv)) {
virtualenv venv write-host "Creating virtual environment at $venv"
virtualenv "$venv"
} }
# Activate virtual environment # Activate virtual environment
.\venv\Scripts\activate.ps1 . ($venv + "\Scripts\Activate.ps1")
# Install dependencies # Install dependencies
pip install pyftpdlib pip install pyftpdlib
# Run FTP server # Run FTP server
python -m pyftpdlib if ($write) {
python -m pyftpdlib -p $port -d $directory -w
# Not working for streaming video files } else {
# twistd -n ftp -r . python -m pyftpdlib -p $port -d $directory
}

View File

@ -0,0 +1,20 @@
$appId = 377160
$networkLocation = "https://raw.githubusercontent.com/IsaacShoebottom/Scripts/master/SteamToggleUpdate/ToggleUpdates.ps1"
# Test if ToggleUpdates.ps1 exists and invoke it if it does
If (Test-Path -Path ".\ToggleUpdates.ps1" -PathType Leaf) {
.\ToggleUpdates.ps1 $appId
}
Else {
# construct temp path
$env:temp = [System.IO.Path]::GetTempPath()
$tempPath = $env:temp + "\ToggleUpdates.ps1"
# Download the network script
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($networkLocation, $tempPath)
# Invoke the network script
&$tempPath $appId
# Delete the network script
Remove-Item -Path $tempPath
}

View File

@ -0,0 +1,20 @@
$appId = 413150
$networkLocation = "https://raw.githubusercontent.com/IsaacShoebottom/Scripts/master/SteamToggleUpdate/ToggleUpdates.ps1"
# Test if ToggleUpdates.ps1 exists and invoke it if it does
If (Test-Path -Path ".\ToggleUpdates.ps1" -PathType Leaf) {
.\ToggleUpdates.ps1 $appId
}
Else {
# construct temp path
$env:temp = [System.IO.Path]::GetTempPath()
$tempPath = $env:temp + "\ToggleUpdates.ps1"
# Download the network script
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($networkLocation, $tempPath)
# Invoke the network script
&$tempPath $appId
# Delete the network script
Remove-Item -Path $tempPath
}

View File

@ -1,7 +1,12 @@
# function that takes in an app id as a number and returns the path to the steam library folder that contains the app id # function that takes in an app id as a number and returns the path to the steam library folder that contains the app id
function parseVDFforPath([int]$appId) { function parseVDFforPath([int]$appId) {
# Steam libary folder vdf if using scoop
$scoopVDF = "$env:USERPROFILE\scoop\apps\steam\current\steamapps\libraryfolders.vdf"
# Steam library folders vdf absolute path # Steam library folders vdf absolute path
$steamLibraryFoldersVDF = "C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf" $normalVDF = "C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf"
# Set the path to the vdf file based on whether you are using scoop or not
$steamLibraryFoldersVDF = if (Test-Path $scoopVDF) { $scoopVDF } else { $normalVDF }
# convert the app id to a string # convert the app id to a string
$appIdString = $appId.ToString() $appIdString = $appId.ToString()

5
VoltorbFlipSpinners/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
VoltorbFlipSpinners/.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/VoltorbFlipSpinners.iml" filepath="$PROJECT_DIR$/.idea/VoltorbFlipSpinners.iml" />
</modules>
</component>
</project>

6
VoltorbFlipSpinners/.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,84 @@
// ==UserScript==
// @name Voltorb Flip Spinners
// @namespace http://tampermonkey.net/
// @version 0.0.2
// @description Adds spinners to the inputs of numbers
// @author Isaac Shoebottom
// @match http://voltorbflip.com/
// @icon http://voltorbflip.com/favicon.ico
// @grant none
// @run-at document-idle
// @updateURL https://git.shoebottom.ca/IsaacShoebottom/Scripts/raw/branch/master/VoltorbFlipSpinners/src/VoltorbFlipSpinners.js
// @downloadURL https://git.shoebottom.ca/IsaacShoebottom/Scripts/raw/branch/master/VoltorbFlipSpinners/src/VoltorbFlipSpinners.js
// ==/UserScript==
// To add spinners I just need to change the input type from text to numbers
/**
* Finds the board element
* @returns {HTMLElement}
*/
function findBoard() {
return document.getElementById("board");
}
/**
* Finds all inputs that are children of the passed element
* @param {HTMLElement} element
* @returns {Array<HTMLElement>}
*/
function findInputs(element) {
// Find all input elements that are children of the root element
// Should have the type="text" attribute
let col = element.getElementsByTagName("input");
// Convert the HTMLCollection to an array
return Array.from(col).filter((input) => input.type === "text");
}
/**
* Adds a spinner to the input element on mouseover
* @param {HTMLElement} inputElement
* @returns {void}
*/
function addMouseOverSpinner(inputElement) {
console.log("Adding mouseover spinner on element: " + inputElement);
inputElement.addEventListener("mouseover", () => {
console.log("Mouseover on element: " + inputElement);
inputElement.type = "number";
});
inputElement.addEventListener("mouseout", () => {
console.log("Mouseout on element: " + inputElement);
inputElement.type = "text";
});
}
/**
* Sets the content of the input to be the passed value
* @param {HTMLElement} inputElement
* @param {number} value
* @returns {void}
*/
function setInputValue(inputElement, value) {
console.log("Setting input value of" + inputElement + "to" + value);
inputElement.value = value;
}
/**
* Executes the script
* @returns {void}
*/
function execute() {
let board = findBoard();
if (!board) {
console.log("Could not find board");
return;
}
let inputs = findInputs(board);
console.log("Found " + inputs.length + " inputs");
inputs.forEach(addMouseOverSpinner)
inputs.forEach((input) => setInputValue(input, 0));
}
execute();

12
VolumeFix/VolumeFix.ahk Normal file
View File

@ -0,0 +1,12 @@
; Fix Windows Volume:
$Volume_Up::
SoundGet, volume
Send {Volume_Up}
SoundSet, volume + 1
Return
$Volume_Down::
SoundGet, volume
Send {Volume_Down}
SoundSet, volume - 1
Return

8
archive-rom/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

8
archive-rom/.idea/archive-rom.iml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.9 (archive-rom)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,12 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="list.__getitem__" />
</list>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

11
archive-rom/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.9 (archive-rom)" />
</component>
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (archive-rom)" project-jdk-type="Python SDK" />
</project>

8
archive-rom/.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/archive-rom.iml" filepath="$PROJECT_DIR$/.idea/archive-rom.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,60 @@
import os
import sys
import requests
import humanize
from urllib.parse import unquote
def parse_file(file_name):
urls = []
with open(file_name, 'r') as f:
for line in f:
urls.append(unquote(line.strip()))
return urls
def get_filename(url):
return url.split('/')[-1]
def print_progress(amount_written, file_size, sizes):
for size in sizes:
if amount_written >= size:
sizes.remove(size)
percentage = (10 - len(sizes)) * 10
print(f"{percentage}% Written {humanize.naturalsize(amount_written)} / {humanize.naturalsize(file_size)}")
return sizes
def download_url(url, filename):
# Constant
temp_file = filename + ".tmp"
chunk_size = 1024 * 1024 * 8 # 8MB
# Request
r = requests.get(url, stream=True)
# More constants
file_size = int(r.headers.get('Content-Length'))
sizes = [file_size * (i / 100) for i in range(0, 101, 10)] # 101, because range is exclusive lmao
# Statistics
amount_written = 0
with open(temp_file, 'wb') as f:
for chunk in r.iter_content(chunk_size=chunk_size):
if chunk:
f.write(chunk)
amount_written += chunk_size
sizes = print_progress(amount_written, file_size, sizes)
# Rename
os.rename(temp_file, filename)
def main():
file = sys.argv[1]
urls = parse_file(file)
for url in urls:
filename = get_filename(url)
print(f"Downloading {filename}")
download_url(url, filename)
if __name__ == '__main__':
main()

2
archive-rom/run.ps1 Normal file
View File

@ -0,0 +1,2 @@
.\venv\Scripts\activate.ps1
python .\download-urls.py .\urls.txt

5
archive-rom/todo.url Normal file
View File

@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://stackoverflow.com/questions/62007674/multi-thread-requests-python3

36
archive-rom/urls.txt Normal file
View File

@ -0,0 +1,36 @@
https://archive.org/download/wii_rvz_usa/wii_rvz_usa/Animal%20Crossing%20-%20City%20Folk%20%28USA%2C%20Asia%29%20%28En%2CFr%2CEs%29%20%28Rev%201%29.rvz
https://archive.org/download/wii_rvz_usa/wii_rvz_usa/Donkey%20Kong%20-%20Barrel%20Blast%20%28USA%29.rvz
https://archive.org/download/wii_rvz_usa/wii_rvz_usa/Donkey%20Kong%20Country%20Returns%20%28USA%29%20%28En%2CFr%2CEs%29%20%28Rev%201%29.rvz
https://archive.org/download/wii_rvz_usa_p2/wii_rvz_usa/GoldenEye%20007%20%28USA%29%20%28En%2CFr%29.rvz
https://archive.org/download/wii_rvz_usa_p2/wii_rvz_usa/Kirby%27s%20Dream%20Collection%20-%20Special%20Edition%20%28USA%29.rvz
https://archive.org/download/wii_rvz_usa_p2/wii_rvz_usa/Kirby%27s%20Epic%20Yarn%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p2/wii_rvz_usa/Kirby%27s%20Return%20to%20Dream%20Land%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p2/wii_rvz_usa/Last%20Story%2C%20The%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p2/wii_rvz_usa/Legend%20of%20Zelda%2C%20The%20-%20Skyward%20Sword%20%28USA%29%20%28En%2CFr%2CEs%29%20%28Rev%202%29.rvz
https://archive.org/download/wii_rvz_usa_p2/wii_rvz_usa/Legend%20of%20Zelda%2C%20The%20-%20Twilight%20Princess%20%28USA%29%20%28En%2CFr%2CEs%29%20%28Rev%202%29.rvz
https://archive.org/download/wii_rvz_usa_p2/wii_rvz_usa/Mario%20Kart%20Wii%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/New%20Super%20Mario%20Bros.%20Wii%20%28USA%29%20%28En%2CFr%2CEs%29%20%28Rev%202%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/No%20More%20Heroes%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/No%20More%20Heroes%202%20-%20Desperate%20Struggle%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Ookami%20%28USA%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Pikmin%202%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Pokemon%20Battle%20Revolution%20%28USA%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Punch-Out%21%21%20%28USA%29%20%28En%2CFr%2CEs%29%20%28Rev%201%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Rhythm%20Heaven%20Fever%20%28USA%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Super%20Mario%20All-Stars%20%28USA%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Super%20Mario%20Galaxy%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Super%20Mario%20Galaxy%202%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Super%20Paper%20Mario%20%28USA%29%20%28Rev%202%29.rvz
https://archive.org/download/wii_rvz_usa_p3/wii_rvz_usa/Super%20Smash%20Bros.%20Brawl%20%28USA%29%20%28Rev%202%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Wario%20Land%20-%20Shake%20It%21%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/WarioWare%20-%20Smooth%20Moves%20%28USA%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Wii%20Music%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Wii%20Party%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Wii%20Play%20%28USA%29%20%28Rev%201%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Wii%20Sports%20%28USA%29%20%28Rev%201%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Wii%20Sports%20Resort%20%28USA%29%20%28En%2CFr%2CEs%29%20%28Rev%201%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Wii%20Sports%20%2B%20Wii%20Sports%20Resort%20%28USA%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Xenoblade%20Chronicles%20%28USA%2C%20Asia%29%20%28En%2CFr%2CEs%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Trauma%20Center%20-%20New%20Blood%20%28USA%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Trauma%20Center%20-%20Second%20Opinion%20%28USA%29.rvz
https://archive.org/download/wii_rvz_usa_p4/wii_rvz_usa/Trauma%20Team%20%28USA%29.rvz

View File

@ -0,0 +1,17 @@
# Converts all rvz files in the current directory to wbfs files
# Warning: Removes the RVZ files after conversion if the -r argument is passed
# Requires: dolphintool, wit
$files = Get-ChildItem -Filter *.rvz .
foreach ($file in $files) {
$name = $file.BaseName
$rvz = $name + ".rvz"
$iso = $name + ".iso"
$wbfs = $name + ".wbfs"
dolphintool convert -i $rvz -o $iso -f iso
if ($args[0] -eq "-r") {
Remove-Item $rvz
}
wit copy -B $iso $wbfs
Remove-Item $iso
}

View File

@ -0,0 +1 @@
wget -r -nd -np $args[0]

4
mcrcon/rcon.ps1 Normal file
View File

@ -0,0 +1,4 @@
$ip = "localhost"
$ip = Read-Host -Prompt 'Enter the RCON IP (default: localhost)'
$password = Read-Host -MaskInput -Prompt 'Enter the RCON Password'
mcrcon -H $ip -p $password

View File

@ -0,0 +1,29 @@
local obs = obslua
local ffi = require("ffi")
local winmm = ffi.load("Winmm")
-- Put a sound of your choosing next to "Beep on replay save.lua" and don't forget to match its name either in code below or rename your file.
PROP_AUDIO_FILEPATH = script_path() .. "sound_npc_scanner_scanner_photo1.wav"
ffi.cdef[[
bool PlaySound(const char *pszSound, void *hmod, uint32_t fdwSound);
]]
function playsound(filepath)
winmm.PlaySound(filepath, nil, 0x00020000)
end
function on_event(event)
if event == obs.OBS_FRONTEND_EVENT_REPLAY_BUFFER_SAVED
then playsound(PROP_AUDIO_FILEPATH)
end
end
function script_load(settings)
obs.obs_frontend_add_event_callback(on_event)
end
-- This Lua script was downloaded from https://gist.github.com/snakecase/e816384a071cec31efbb4b9e429c108d
-- Credits: upgradeQ (https://gist.github.com/upgradeQ/b2412242d76790d7618d6b0996c4562f), gima (https://gitlab.com/gima/obsnotification)
-- Thank you guys!

View File

@ -0,0 +1,2 @@
# Want higher bitrate, 20Mbps, and to use AAC audio codec at 320kbps, as well as up to 144 fps
scrcpy --video-bit-rate=20M --audio-codec aac --audio-bit-rate=320K --max-fps 144 --turn-screen-off

5
vimm/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Don't commit virtualenv
venv
# Ignore pycache
__pycache__

8
vimm/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

11
vimm/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.11" />
</component>
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (vimm)" project-jdk-type="Python SDK" />
</project>

8
vimm/.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/vimm.iml" filepath="$PROJECT_DIR$/.idea/vimm.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="update reqs" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="pipreqs ." />
<option name="INDEPENDENT_SCRIPT_PATH" value="false" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/wbfs-test.ps1" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

24
vimm/.idea/runConfigurations/vimm.xml generated Normal file
View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="vimm" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="vimm" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/vimm.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="wbfs test" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="false" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/wbfs-test.ps1" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="true" />
<envs />
<method v="2" />
</configuration>
</component>

8
vimm/.idea/vimm.iml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.9 (vimm)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

9
vimm/README.md Normal file
View File

@ -0,0 +1,9 @@
# Vimm's Lair Downloader
Functional but less than optimal Vimm's lair downloader
Only tested on Wii games, but it could be adapted for other stuff
Created because I wanted to download without clicking overnight (does not bypass more than 1 file limit)
But after doing some research and remembering I made my archive.org ROM downloader, which is very simple but more fully featured

View File

@ -0,0 +1,5 @@
{
"version": "1",
"name": "vimm",
"type": "collection"
}

32
vimm/bruno-vimm/test1.bru Normal file
View File

@ -0,0 +1,32 @@
meta {
name: test1
type: http
seq: 1
}
get {
url: https://download2.vimm.net/download/?mediaId=9709&alt=1
body: none
auth: none
}
query {
mediaId: 9709
alt: 1
}
headers {
Referer: https://vimm.net/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
~Accept-Encoding: gzip, deflate, br
~Connection: keep-alive
~Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/jxl,image/webp,*/*;q=0.8
~Accept-Language: en,en-CA;q=0.7,en-US;q=0.3
~DNT: 1
~Sec-GPC: 1
~Upgrade-Insecure-Requests: 1
~Sec-Fetch-Dest: document
~Sec-Fetch-Mode: navigate
~Sec-Fetch-Site: same-site
~Sec-Fetch-User: ?1
}

32
vimm/bruno-vimm/test2.bru Normal file
View File

@ -0,0 +1,32 @@
meta {
name: test2
type: http
seq: 2
}
get {
url: https://download2.vimm.net/download/?mediaId=9704&alt=1
body: none
auth: none
}
query {
mediaId: 9704
alt: 1
}
headers {
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/jxl,image/webp,*/*;q=0.8
Accept-Language: en,en-CA;q=0.7,en-US;q=0.3
Accept-Encoding: gzip, deflate, br
DNT: 1
Sec-GPC: 1
Connection: keep-alive
Referer: https://vimm.net/
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-site
Sec-Fetch-User: ?1
}

2
vimm/requirements.txt Normal file
View File

@ -0,0 +1,2 @@
beautifulsoup4==4.12.2
Requests==2.31.0

18
vimm/vimm-bulk.py Normal file
View File

@ -0,0 +1,18 @@
import sys
from vimm import download
def main():
if len(sys.argv) != 3:
print("Usage: python vimm-bulk.py <filename> <filetype>")
exit(1)
with open(sys.argv[1], "r") as file:
for line in file:
line = line.strip()
download(line, sys.argv[2])
if __name__ == "__main__":
main()

119
vimm/vimm.py Normal file
View File

@ -0,0 +1,119 @@
import json
import sys
import logging
import requests
from enum import Enum
from bs4 import BeautifulSoup
# User Agent
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0"
# Referer
referer = "https://vimm.net/"
# Download URL
download_url2 = "https://download2.vimm.net/download/"
# Enum for type of download,
class WiiType(Enum):
wbfs = 0
rvz = 1
def get_media_id(page_content):
# Could be used later to be a method to extract the id from passed in json
pass
def download(url, filetype):
page_request = requests.get(url, headers={"User-Agent": user_agent})
page_content = BeautifulSoup(page_request.content, 'html.parser')
# Find div with the class "sectionTitle"
section_titles = page_content.find_all("div", class_="sectionTitle")
section_title = section_titles[0].text
# TODO: use match statement
if section_title == "Wii":
if filetype == "wbfs":
download_wii(page_content, WiiType.wbfs)
elif filetype == "rvz":
download_wii(page_content, WiiType.rvz)
def download_wii(page_content, filetype):
# Wish there was a better way to do this, manually parsing javascript for a variable
# Find script that contains 'var media = '
scripts = page_content.find_all("script")
script = str
# Find script that contains 'var media = '
for i in scripts:
if "var media = " in i.text:
script = i.string
media = list()
# This is the default usage, pycharm bug
# noinspection PyArgumentList
for lines in script.splitlines():
if "var media = " in lines:
media.append(lines)
for i in range(0, len(media)):
media[i] = media[i].replace(" var media = ", "")
media[i] = media[i].replace(";", "")
# Parse lines as json
media_json = list()
for i in media:
media_json.append(json.loads(i))
# Sort by version
media_json.sort(key=lambda x: x["Version"])
# Get ID of last entry
last_id = media_json[-1]["ID"]
logging.log(logging.INFO, "File ID of Download: " + str(last_id))
# Get the title of the last entry
filename = media_json[-1]["GoodTitle"].replace(".iso", ".7z")
logging.log(logging.INFO, "File Name of Download: " + filename)
# TODO: Parse json for file size
chunk_size = 1024 * 1024 * 10 # 10 MB
# Build request
request = requests.Session()
request.headers.update({"User-Agent": user_agent, "Referer": referer})
request.params.update({"mediaId": last_id})
if filetype == WiiType.rvz:
request.params.update({"alt": filetype.value})
r = request.get(download_url2, stream=True)
with open(filename, "wb") as file:
for chunk in r.iter_content(chunk_size=chunk_size):
if chunk:
file.write(chunk)
def main():
# Comment out to disable logging
logging.getLogger().setLevel(logging.INFO)
if len(sys.argv) != 3:
print("Usage: python vimm.py <url> <filetype>")
exit(1)
# Get arguments
url = sys.argv[1]
filetype = sys.argv[2]
download(url, filetype)
if __name__ == "__main__":
main()

1
vimm/wbfs-test.ps1 Normal file
View File

@ -0,0 +1 @@
python vimm.py https://vimm.net/vault/18170 wbfs

35
vimm/wii-games.txt Normal file
View File

@ -0,0 +1,35 @@
https://vimm.net/vault/17392
https://vimm.net/vault/17508
https://vimm.net/vault/17667
https://vimm.net/vault/17668
https://vimm.net/vault/17669
https://vimm.net/vault/17677
https://vimm.net/vault/17683
https://vimm.net/vault/17746
https://vimm.net/vault/17874
https://vimm.net/vault/17892
https://vimm.net/vault/17893
https://vimm.net/vault/17902
https://vimm.net/vault/17873
https://vimm.net/vault/17938
https://vimm.net/vault/17951
https://vimm.net/vault/17978
https://vimm.net/vault/18170
https://vimm.net/vault/18171
https://vimm.net/vault/18172
https://vimm.net/vault/18175
https://vimm.net/vault/18177
https://vimm.net/vault/18235
https://vimm.net/vault/18234
https://vimm.net/vault/18236
https://vimm.net/vault/18275
https://vimm.net/vault/18293
https://vimm.net/vault/18294
https://vimm.net/vault/18295
https://vimm.net/vault/18296
https://vimm.net/vault/18297
https://vimm.net/vault/18298
https://vimm.net/vault/18299
https://vimm.net/vault/18292
https://vimm.net/vault/18291
https://vimm.net/vault/18334