Skip to content

Instantly share code, notes, and snippets.

View ben-nour's full-sized avatar

Ben Nour ben-nour

View GitHub Profile
@ben-nour
ben-nour / python_re_functions.py
Last active December 12, 2025 03:40
An overview of main functions from the Python re module.
"""
Good reference: https://www.dataquest.io/cheat-sheet/regular-expressions-cheat-sheet/
Official documentation: https://docs.python.org/3/library/re.html
"""
import re
text = "dog cat dog"
########## re.findall() ##########
@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,

@timvisee
timvisee / falsehoods-programming-time-list.md
Last active August 16, 2026 05:48
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@Kartones
Kartones / postgres-cheatsheet.md
Last active August 20, 2026 02:34
PostgreSQL command line cheatsheet

PSQL Cheatsheet

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)