Skip to content

Instantly share code, notes, and snippets.

View Pinjasaur's full-sized avatar

Paul Esch-Laurent Pinjasaur

View GitHub Profile
@Pinjasaur
Pinjasaur / bookmarklet.js
Created May 7, 2026 01:08
Open Source North 2026 Schedule .ics Bookmarklet https://opensourcenorth.com/schedule
javascript:(function(){if(document.getElementById('osn-ics-overlay')){return}const DATE='20260528';const DURATION_MS=45*60*1000;function parseTime(label){const m=label.trim().match(/^(\d+):(\d+)\s*(AM|PM)$/i);if(!m){return null}let h=parseInt(m[1],10);const min=parseInt(m[2],10);const ampm=m[3].toUpperCase();if(ampm==='PM'&&h!==12){h+=12}if(ampm==='AM'&&h===12){h=0}return{h,min}}function toLocalICSDate(h,min,offsetMs){const d=new Date('2026-05-28T'+String(h).padStart(2,'0')+':'+String(min).padStart(2,'0')+':00');const d2=new Date(d.getTime()+(offsetMs||0));const hh=String(d2.getHours()).padStart(2,'0');const mm=String(d2.getMinutes()).padStart(2,'0');return '20260528T'+hh+mm+'00'}function escapeICS(str){return str.replace(/\\/g,'\\\\').replace(/;/g,'\\;').replace(/,/g,'\\,').replace(/\n/g,'\\n')}function foldLine(line){const out=[];while(line.length>75){out.push(line.substring(0,75));line=' '+line.substring(75)}out.push(line);return out.join('\r\n')}function getCardData(card){const timeEl=card.querySelector('
@Pinjasaur
Pinjasaur / bookmarklet.js
Last active May 1, 2026 17:35
Minnebar Session Schedule .ics Bookmarklet https://sessions.minnestar.org/schedule
javascript:(function(){const r={},s=(document.querySelectorAll(".nav-top .timeslot[startsAt]").forEach(e=>{var t=e.getAttribute("href").replace("#","");r[t]={start:parseInt(e.getAttribute("startsAt"),10),end:parseInt(e.getAttribute("endsAt"),10)}}),[]);if(document.querySelectorAll(".timeslot[id]").forEach(e=>{var t=e.id;const o=r[t];o&&e.querySelectorAll(".session").forEach(t=>{var r=t.querySelector("button.toggle-attendance");if(r&&"true"===r.getAttribute("data-session-attending")){var r=t.querySelector("h3.title"),n=t.querySelector(".room"),t=t.querySelector(".description"),r=r?r.textContent.trim():"Untitled Session",n=n?n.textContent.trim():"";let e="";t&&((t=t.cloneNode(!0)).querySelectorAll("a[href]").forEach(e=>{var t=e.getAttribute("href"),r=e.textContent.trim();e.replaceWith(r===t?r:r+" ("+t+")")}),e=t.textContent.trim()),s.push({title:r,location:n,description:e,start:o.start,end:o.end})}})}),0===s.length)alert("No attended sessions found. Make sure you are marked as attending sessions.");else{const i
@Pinjasaur
Pinjasaur / readme.md
Created December 22, 2025 05:17
Star Tribune (strib) utm_source=gift bookmarklet

Tiny bookmarklet to add ?utm_source=gift to Star Tribune URLs.

javascript:(function(){const url=new URL(location.href);if(url.hostname==='www.startribune.com'){const currentUtmSource=url.searchParams.get('utm_source');if(currentUtmSource!=='gift'){url.searchParams.set('utm_source','gift');history.replaceState({},'',url.toString());}}})();
@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