Compare commits

..

3 Commits

5 changed files with 154 additions and 0 deletions

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

@ -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!