Just some random programs in porth because I saw Tsoding's videos/stream and I thought it looked cool.
Licence: MIT
| // ==UserScript== | |
| // @name nyaa copy all magnets | |
| // @namespace nick.tay.blue | |
| // @match https://nyaa.si/* | |
| // @grant none | |
| // @version 0.1.0 | |
| // @author Nicholas Tay <[email protected]> | |
| // @description Copy all visible magnet links from results page | |
| // ==/UserScript== |
| { | |
| "background": "#1A1B26", | |
| "black": "#15161E", | |
| "blue": "#7AA2F7", | |
| "brightBlack": "#414868", | |
| "brightBlue": "#7AA2F7", | |
| "brightCyan": "#7DCFFF", | |
| "brightGreen": "#9ECE6A", | |
| "brightPurple": "#BB9AF7", | |
| "brightRed": "#F7768E", |
| // Day 1 Part 1 | |
| Math.max(...input.split('\n').reduce((acc, val) => (val === '' ? [...acc, 0] : (acc.slice(0, -1).concat(acc[acc.length-1] + Number(val)))), [0])); | |
| // Day 1 Part 2 | |
| new Int32Array(input.split('\n').reduce((acc, val) => (val === '' ? [...acc, 0] : (acc.slice(0, -1).concat(acc[acc.length-1] + Number(val)))), [0])).sort().slice(-3).reduce((a, b) => a + b); | |
| // Day 2 Part 1 | |
| input | |
| .split('\n') | |
| .map(x => [x[2].charCodeAt(0)-88, x[0].charCodeAt(0)-65]) | |
| .reduce((acc, [hand, opp]) => (acc + hand+1 + ((hand === opp) ? 3 : (((opp + 1) % 3 === hand) ? 6 : 0))), 0); |
| // ==UserScript== | |
| // @name Monash Maps location search booster | |
| // @namespace nick.tay.blue | |
| // @match https://maps.monash.edu/ | |
| // @grant none | |
| // @version 0.1.2 | |
| // @author Nicholas Tay <[email protected]> | |
| // @description Adds location as context to the MazeMap API before searching to improve relevance of searches | |
| // ==/UserScript== |
| # Place in `.bashrc` or similar for easy access! | |
| # (This script was made because I didn't really trust running a random .ps1 script every time, and it's hard | |
| # for me to audit those. This is much simpler and doesn't involve executing a script off a URL.) | |
| # | |
| # Last updated for 4.1 updated wish page | |
| genshinlog() { | |
| GENSHIN_INSTALL_DIR="/c/Games/Genshin Impact" | |
| LATEST_CACHE="$(find "$GENSHIN_INSTALL_DIR"'/Genshin Impact game/GenshinImpact_Data/webCaches' -maxdepth 1 -type d -name '2.*' | sort | tail -1)" | |
| grep -aoP 'https://hk4e-api-os.hoyoverse.com/.+?/getGachaLog.+?&game_biz=hk4e_global' "$LATEST_CACHE/Cache/Cache_Data/data_2" | tail -1 | tee /dev/tty | clip |
Just some random programs in porth because I saw Tsoding's videos/stream and I thought it looked cool.
Licence: MIT
| sed -i 's/^mirrorlist=/#mirrorlist=/g;s/^#baseurl.*\/\(.*\)\/$basearch.*/baseurl=https:\/\/mirror.aarnet.edu.au\/$contentdir\/$releasever\/\1\/$basearch\/os\/\nbaseurl=https:\/\/rockylinux.mirror.digitalpacific.com.au\/$releasever\/\1\/$basearch\/os\//g' /etc/yum.repos.d/Rocky-*.repo |
| astyle \ | |
| --mode=c \ | |
| --style=linux \ | |
| --indent=tab=4 \ | |
| --break-one-line-headers \ | |
| --keep-one-line-blocks \ | |
| --align-pointer=name \ | |
| --pad-comma \ | |
| --pad-header \ | |
| --unpad-paren \ |
| // AoC 2021 for fun in JS (real implementation in rust on my git repo) | |
| // Probably not going to do this past first few days | |
| // -- Day 1 -- | |
| // Part 1 | |
| input.split('\n').map(Number).map((x, i, arr) => x > arr[i-1]).filter(x => x).length | |
| // Part 2 | |
| input.split('\n').map(Number).map((x, i, arr) => arr[i+1] + arr[i-1] > arr[i-1] + arr[i-2]).filter(x => x).length | |
| // -- Day 2 -- |
| segment .text | |
| global _start | |
| _start: | |
| mov rax, 60 | |
| mov rdi, 0 | |
| syscall |