Skip to content

Instantly share code, notes, and snippets.

View austinjreilly's full-sized avatar

Austin J. Reilly austinjreilly

View GitHub Profile
@bvaughn
bvaughn / index.md
Last active April 17, 2025 15:47
How to use profiling in production mode for react-dom

React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.

Table of Contents

Profiling in production

React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.

Random thoughts on sets

Sets can be generalized as a function that takes an argument and returns true or false.

Sets of numbers

For a specific set of numbers, you can write it as:

const mySetOfNumbers = num => [1,2,3,4,5].includes(num);
import moment from 'moment';
/**
* XXX: Okay, so, no date library, other than moment, appears to currently
* support _formatting a date with a specified time offset_. That is, given the
* date string `2018-11-21T15:00:00+0100` (UTC+1:00), I want to format it as
* `3:00 PM`, regardless of the system's current local time.
*
* This seems like it should be easy, right? We don't need time zone data,
* because we're not specifying a time zone, just a UTC offset. All we need to
@cleverdevil
cleverdevil / overcast-recently-played.py
Last active March 4, 2024 09:28
Fetch recently played episodes from Overcast.fm. Then, publish history to my website.
'''
You'll need to pip install some dependencies:
* python-dateutil
* requests
Also, populate your EMAIL and PASSWORD below.
'''
from xml.etree import ElementTree
@milesrichardson
milesrichardson / open-vlc-m3u8-url-with-http.md
Created July 10, 2024 21:50
How to use VLC to watch m3u8 playlist at URL with custom HTTP referrer and user agent

Imagine this: it's Sunday afternoon at 1pm, and you want to watch some live content. But you don't have a TV subscription. So you do a little Googling, and eventually you find yourself on a sketchy website where you can watch the content you're looking for. But while the website has a video player, it's surrounded by advertisements, and probably a cryptominer too. You don't want this website eating your CPU for 2 hours while you're watching your favorite Sunday afternoon content.

Wouldn't it be nice if you could watch that video in VLC instead? Then you can close the sketchy website and still watch your content. It's like having your cake and taking a bite of it too!

Here's how you do it:

  1. Capture the m3u8 request in dev tools. Open the site (or just the iframe, if possible) in DevTools and click "play." Search the network tab for m3u8 and grab the first request.

  2. Run VLC with command line flags to set the User Agent and Referrer. From the request body, you need to copy the requested URL,