Skip to content

Instantly share code, notes, and snippets.

@jgusta
jgusta / SiteSucker.js
Last active October 23, 2024 09:24
A Javascript for Automation (JXA) script for automating SiteSucker for Mac with opinionated defaults.
/**
* This script is a JavaScript for Automation (JXA) script that uses the SiteSucker app to download a website.
*
* Background: JXA is dogshit. I know there is no need to hold back on the cursing, because if you are using JXA,
* you have already explored every explitive available. The official JXA documentation is apple's changelog which
* itself is simply a log describing exactly when they themselves completely gave up on this bullshit. Also,
* AppleScript is dogshit. And that is the MUCH better documented of the two automation languages.
*
* So here you are trying to use JXA for a program that doesn't even technically support it, trying to
* translate an already god forsaken applescript descriptor into an esoteric and poorly documented,
@jgusta
jgusta / tagfactory.js
Last active July 1, 2024 06:15
DOM Tag Factory
const tf = function (attachPoint) {
const root = globalThis || window
const dom = root.document || document
function selectEl(el) {
if (el.ELEMENT_NODE) {
return el
}
else {
return dom.querySelector(el)
const walk = (acc = [], outer) => {
if (typeof outer === null) {
return acc
}
if (typeof outer === 'string') {
if (outer === ' ') {
return acc
}
@jgusta
jgusta / svn2gitmac.md
Created October 10, 2022 02:05
Getting svn2git to work on Mac 8/2020

Getting svn2git to work on Mac 8/2020

** originally posted here: nirvdrum/svn2git#295 ** ** Note this guide is old, but svn2git still hasn't been updated. **

Hello my fellow SVN refugees. We are bailing from Cloudforge as they are shutting down their SVN services. Here's how I got svn2git to work on my Mac locally. (Mojave 10.14.6). This should help with (#292) and (#283)

  • We're lucky to have a standard svn layout. I'm afraid I can't help with non-standard.
  • Using bash and iterm2.
  • Make sure your password doesn't have any dollar signs or other special bash characters like a space or backslash. If you have a dollar sign in your password you are going to have a bad time. I don't know how to get around it, its easier to just change your password.
@jgusta
jgusta / scanroom.js
Last active August 13, 2022 11:37
Run in console of Discord browser app to get a list of all users in the room.
(function () {
return new Promise(async (final) => {
const list = await new Promise((res) => {
let l = document.querySelectorAll("[aria-label=Members]")[0]
.parentElement;
l.scrollTo({ top: 0, left: 0, behavior: "instant" });
setTimeout(() => res(l), 500);
});
let names = [];
const height = list.scrollHeight - window.innerHeight;
{"ass":[
[
"2010-07-12",
"7911.39"
],
[
"2010-07-13",
"14810.13"
],
[
@jgusta
jgusta / twitchCom.fish
Last active September 2, 2021 14:26
Download all Twitch VOD Comments and the Avatars - Aug 30, 2021
function twitchCom
# requires jq, fish shell, wget and curl
set videoId "$argv[1]"
set clientId kimne78kx3ncx6brgo4mv6wki5h1ko
set deviceId p7vCimC0LlUFnAlNYCQVMuztj9DhSZa5
set jsonPart 0
set dirPrefix "$videoId-comments"
set partFormatted (string pad -c 0 -w 3 "$jsonPart")
set avatars "$dirPrefix/avatars"
set raw "$dirPrefix/raw"
@jgusta
jgusta / machine.js
Created May 10, 2020 20:17
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jgusta
jgusta / machine.js
Last active March 15, 2020 23:57
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
/*
source: https://codeburst.io/alternative-to-javascripts-switch-statement-with-a-functional-twist-3f572787ba1c
the match() function is an alternative to a switch statement.
Benefits are:
The chain is an expression, unlike a switch statement.
Each case has its own scope.
The default case (.otherwise()) is mandatory.
result = match(2)