Skip to content

Instantly share code, notes, and snippets.

View nicholastay's full-sized avatar

Nicholas Tay nicholastay

View GitHub Profile
@nicholastay
nicholastay / nyaa-magnet.user.js
Created June 27, 2023 08:58
Copy all visible magnets on nyaa
// ==UserScript==
// @name nyaa copy all magnets
// @namespace nick.tay.blue
// @match https://nyaa.si/*
// @grant none
// @version 0.1.0
// @author Nicholas Tay <nick@windblume.net>
// @description Copy all visible magnet links from results page
// ==/UserScript==
@nicholastay
nicholastay / winterm_tokyonight.json
Created December 7, 2022 07:08
Tokyo Night (Night variant) - Windows Terminal
{
"background": "#1A1B26",
"black": "#15161E",
"blue": "#7AA2F7",
"brightBlack": "#414868",
"brightBlue": "#7AA2F7",
"brightCyan": "#7DCFFF",
"brightGreen": "#9ECE6A",
"brightPurple": "#BB9AF7",
"brightRed": "#F7768E",
@nicholastay
nicholastay / aoc-2022.js
Last active December 4, 2022 03:33
AOC 2022 random js attempts for fun
// 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);
@nicholastay
nicholastay / mumapbooster.user.js
Last active November 4, 2022 10:38
MUMapBooster - Adds location to Monash Maps (https://maps.monash.edu) searches to improve relevance of results
// ==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 <nick@windblume.net>
// @description Adds location as context to the MazeMap API before searching to improve relevance of searches
// ==/UserScript==
@nicholastay
nicholastay / genshinlog.sh
Last active October 12, 2023 10:39
Simple Genshin Wish URL getter in bash (tested with git bash) + Honkai Star Rail Warp getter
# 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
@nicholastay
nicholastay / ..porth-stuff.md
Last active May 23, 2022 11:11
misc porth stuff test

porth-stuff

Just some random programs in porth because I saw Tsoding's videos/stream and I thought it looked cool.

Licence: MIT

@nicholastay
nicholastay / mirror.sh
Created April 19, 2022 03:31
yum-based system (rocky) set mirrors to fixed ones - useful for firewalled env
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
@nicholastay
nicholastay / c-format.sh
Last active May 23, 2022 11:13
astyle settings for me
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 \
@nicholastay
nicholastay / aoc2021.js
Last active December 23, 2021 13:52
Advent of Code 2021 for fun in JS
// 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 --
@nicholastay
nicholastay / Program.asm
Created December 2, 2021 08:17
A Program
segment .text
global _start
_start:
mov rax, 60
mov rdi, 0
syscall