Skip to content

Instantly share code, notes, and snippets.

@VityaSchel
VityaSchel / YouTubeChatSubscribe.js
Last active January 3, 2026 16:07
YouTube chat subscription JavaScript: Get every new message during YouTube livestream chat with DOM Mutation Observer
/* YouTube Chat Subscription Function. Written by VityaSchel
* Subscribe to new messages in YouTube chat in JS (browser-only)
* Pass callback function which gets 2 parameters: author, message
* !! Does not support emojies, user badges, message deletions !!
*/
function subscribeToChat(chatMessageCallback) {
let chatObserverCallback = (mutationsList, observer) => {
let messageMutation = mutationsList.filter(mutation => mutation.target.id === 'items').find(itemDOM => itemDOM.addedNodes.length > 0)
if(messageMutation === undefined || messageMutation.addedNodes.length === 0) { return; }
@tfeldmann
tfeldmann / duplicates.py
Last active April 5, 2026 05:55
Fast duplicate file finder written in python
#!/usr/bin/env python
"""
Fast duplicate file finder.
Usage: duplicates.py <folder> [<folder>...]
Based on https://stackoverflow.com/a/36113168/300783
Modified for Python3 with some small code improvements.
"""
import os
import sys