Skip to content

Instantly share code, notes, and snippets.

@noman-land
noman-land / python-generators-quiz.py
Created July 26, 2023 04:00
Python generators quiz
# Modified version of https://news.ycombinator.com/item?id=36859971
question_bank={
'1+1: ': '2',
'2+3: ': '5'
}
def Quiz():
for question, correct_answer in question_bank.items():
answer = yield question
@noman-land
noman-land / get_episodes.py
Last active September 1, 2023 05:32
Download all No Such Thing As A Fish episodes to current folder.
####
#
# Download all No Such Thing As A Fish episodes to current folder
#
# How to use: `python get_episodes.py`
#
# THIS WILL DOWNLOAD OVER 20 GIGABYTES OF MP3s
#
####
@noman-land
noman-land / appify
Created January 2, 2024 21:11 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@noman-land
noman-land / open-vlc-m3u8-url-with-http.md
Created July 10, 2024 23:46 — forked from milesrichardson/open-vlc-m3u8-url-with-http.md
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,