Skip to content

Instantly share code, notes, and snippets.

View Pinjasaur's full-sized avatar

Paul Esch-Laurent Pinjasaur

View GitHub Profile
@Pinjasaur
Pinjasaur / msp-restaurant-week-api.js
Last active July 12, 2023 16:46
Minneapolis/St. Paul Restaurant Week programmatically get API endpoint
(async () => {
const res = await fetch('https://mspmag.com/promotions/restaurantweek')
const html = await res.text()
const parser = new DOMParser()
const doc = parser.parseFromString(html, 'text/html');
const $scripts = Array.from(doc.querySelectorAll('script'))
const $script = $scripts.filter($script => $script.innerHTML.trim().startsWith('var _mp_require = {')).pop()
const json = JSON.parse($script.innerHTML.trim().replace(/^var _mp_require =/, '').replace(/;$/, ''))
console.log(json['config']['js/page_roundup_location']['locations_url'])
})();
@Pinjasaur
Pinjasaur / fizzbuzz.js
Created April 14, 2023 21:37
fizzy buzzers
/**
* Implement the "FizzBuzz" paradigm: iterate 'from' to 'to' inclusive
* printing "Fizz" for multiples of 3, "Buzz" for multiples of 5, and
* "FizzBuzz" for multiples of both. Otherwise, print the number.
* @param {number} from - lower bound, inclusive
* @param {number} to - upper bound, inclusive
* @return void (undefined)
*
* @example
@Pinjasaur
Pinjasaur / replies.yml
Last active November 18, 2022 15:56
refined-saved-replies test replies.yml
replies:
- body: |
:wave: @{{user.login}}
name: "{{user.login}} test"
@Pinjasaur
Pinjasaur / bookmarklet.js
Last active February 23, 2021 01:50
Prepend an anchor tag inside elements with IDs to easily get permalinks to document fragments e.g., https://domain.tld/#my-id
javascript:Array.from(document.querySelectorAll("[id]")).forEach(e=>{if(/[A-Za-z][-A-Za-z0-9_:.]*/.test(e.id)&&!e.querySelector(`a[href="#${e.id}"]`)){const r=document.createElement("a");r.innerHTML="#",r.href=`#${e.id}`,e.insertBefore(r,e.firstChild)}});
@Pinjasaur
Pinjasaur / bash.md
Last active October 2, 2017 04:39
Bash tips & tricks

Bash

Directories

dirs shows the stack of directories. dirs -v shows them vertically with their indexes. Recommend aliasing dirs to dirs -v.

pwd is always transient at the top of the stack.

Reference directories with ~[index] where [index] is the directory stack index.

@Pinjasaur
Pinjasaur / register.ahk
Last active September 30, 2017 02:50
AutoHotkey to enter course CRNs
^!a::
Send, 12708{Tab}12714{Tab}14039{Tab}14216{Tab}14217{Tab}11800{enter}
Return
@Pinjasaur
Pinjasaur / git.md
Last active October 18, 2019 20:00
Gotta git gud, ya know?

Git

Change a remote

Base recipe:

  • git remote set-url <remote> <url>

HTTPS to SSH (GitHub):

  • git remote set-url <remote> git@github.com/<username>/<repository>.git
@Pinjasaur
Pinjasaur / make.md
Last active September 29, 2017 21:23
All about dem Makefiles.

Make

Automatic variables

  • $@ first name of target
  • $< first prereq
  • $? all prereqs newer than target (space delimitted)
  • $^ all prereqs (space delimitted)

Special targets

@Pinjasaur
Pinjasaur / config
Last active May 11, 2023 18:37
SSH setup/install
Host *
Port 22
IdentityFile ~/.ssh/id_ed25519
ServerAliveInterval 120
TCPKeepAlive no
# Keep this here, it's (potentially) important
# https://serverfault.com/a/869394
# XAuthLocation /opt/X11/bin/xauth
# Host with X11 forwarding