Skip to content

Instantly share code, notes, and snippets.

View a-gu's full-sized avatar
Last seen in 1 hr

Andrew Gu a-gu

Last seen in 1 hr
View GitHub Profile
@a-gu
a-gu / itch-io.claim-bundle.js
Created December 22, 2023 19:26
Claim all items in an itch.io bundle
(async function () {
if (!/\/bundle\/download\/.+/.test(location.pathname))
return alert("Not on a supported page")
const baseURL = `${location.origin}${location.pathname}`,
baseDOM = new DOMParser().parseFromString(
await fetch(baseURL).then((res) => res.text()),
"text/html"
),
maxPage = Math.max(
@a-gu
a-gu / Invoke-RemoteCommand.ps1
Last active August 9, 2023 13:29
Invoke a PowerShell command string on a remote system using a Scheduled Task and network share access (to retrieve output). Other WMI/CIM permissions not required.
Function Invoke-RemoteCommand {
[CmdletBinding()]
Param(
[string]$ComputerName = '',
[string]$Command = { Get-ChildItem env: | Select-Object Key,Value | ConvertTo-CSV },
[boolean]$ReturnOutput = $True,
[string]$Prefix = 'Invoke-RemoteCommand'
)
# Prepare command
@a-gu
a-gu / webpack_chunks.js
Created April 16, 2022 21:19
Search webpack chunks for functions of interest
// Retrieve functions from all chunks
const webpackChunkFns = this.webpackChunk.flatMap(c => Object.values(c[1]));
// Filter by RegEx match
webpackChunkFns.filter(f => /hello world/.test(f.toString()));
@a-gu
a-gu / anti-amp.user.js
Last active February 25, 2022 05:21
Redirect AMP pages to their canonical counterparts
// ==UserScript==
// @name Anti-AMP
// @version 0.3
// @description Redirect AMP pages to their canonical counterparts
// @author Andrew Gu
// @match *://*/*
// @grant none
// @run-at document-end
// @noframes
// @updateURL https://gist.github.com/a-gu/a05caf92fdaa0612724b28aba657338c/raw/anti-amp.user.js
@a-gu
a-gu / Google_Photos_URL.ps1
Last active September 6, 2021 23:51
Automatically replace *.url files leading to Google Photos URLs on Windows systems. Hacky and hardcoded but mostly works.
Add-Type -AssemblyName System.Windows.Forms
# https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys?view=netframework-4.7.2
$Path_Downloads = 'C:\Users\YOUR_USERNAME\Downloads'
function Get-LinkURL {
Param(
[string]$Path
)
@a-gu
a-gu / webtoon_light.user.js
Last active December 23, 2020 18:36
Rewrites the WebToon viewer to still be functional with fewer resources
// ==UserScript==
// @name WebToon Light
// @version 1.0
// @description Rewrites the WebToon viewer to still be functional with fewer resources
// @author Andrew Gu
// @match https://www.webtoons.com/*viewer
// @match https://www.webtoons.com/*viewer?*
// @updateURL https://gist.github.com/a-gu/8313d8523f5e8a08e80b54beb1d7b241/raw/97ff557a0267dfc3929e63cf41873c161008239f/webtoon_light.user.js
// @grant none
// @run-at document-end
@a-gu
a-gu / better_browser_zoom.user.js
Last active October 1, 2020 06:28
Userscript for a better experience using Zoom web conferencing in a web browser
// ==UserScript==
// @name Better Browser Zoom
// @version 0.6
// @description Userscript for a better experience using Zoom web conferencing in a web browser
// @author Andrew Gu
// @updateURL https://gist.githubusercontent.com/a-gu/9cc1b4caf6440cb2b918c13c72e0d0ce/raw/better_browser_zoom.user.js
// @grant unsafeWindow
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
@a-gu
a-gu / friendlyWords.js
Last active September 15, 2020 06:58
Single-use simple testing script to convert the first 6 characters of strings (6+ chars long, A-Za-z0-9_-) into a word-based menomic based off of the 2048 English bitcoin words
const bitcoinWords = 'abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt add addict address adjust admit adult advance advice aerobic affair afford afraid again age agent agree ahead aim air airport aisle alarm album alcohol alert alien all alley allow almost alone alpha already also alter always amateur amazing among amount amused analyst anchor ancient anger angle angry animal ankle announce annual another answer antenna antique anxiety any apart apology appear apple approve april arch arctic area arena argue arm armed armor army around arrange arrest arrive arrow art artefact artist artwork ask aspect assault asset assist assume asthma athlete atom attack attend attitude attract auction audit august aunt author auto autumn average avocado avoid awake aware away awesome awful awkward axis baby bachelor bacon badge bag balance balcony ball bamboo banana banner bar barely bargain barrel
@a-gu
a-gu / ChocoUpgradeAllNoLinks.ps1
Created September 8, 2020 04:17
PowerShell script to upgrade Chocolatey packages, and remove any added links
@a-gu
a-gu / fingerprint.js
Last active August 16, 2020 02:25
basic system/browser fingerprinting function for use as a simple but robust user id
// fingerprint : basic system/browser fingerprinting function
// for use as a simple but robust user id
function fingerprint() {
// hash : simple hash-like function, not guaranteed to return same-size data
// or change output greatly on input changes
let hash = function (input) {
let temp = JSON.stringify(input),
out = BigInt(0)
for (let i = 0; i < temp.length; i++) {
out ^= BigInt(temp.charCodeAt(i)) << BigInt(i % 128)