Skip to content

Instantly share code, notes, and snippets.

@SLaks
SLaks / Snippets.js
Created January 5, 2021 18:19
Console Snippets to manipulate YouTube Music playlists in bulk
// First, load jQuery:
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
////////////////////////////////////////////////////////////////////////////
// Remove all disliked songs:
for (const el of $('ytmusic-responsive-list-item-renderer:has([like-status="DISLIKE"])').get()) {
el.dispatchEvent(new MouseEvent('contextmenu'));
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@PaulCapestany
PaulCapestany / oi.js
Created August 4, 2013 00:43
Dan Kaminsky's DefCon RNG challenge
// TLDR: Oi, Barnes. We'll miss ya. Here's a grimy RNG in your honor.
// node oi.js or paste the below into your favorite browser's JS console.
// DEFCON CHALLENGE: Break this!
function millis() { return Date.now(); }
function flip_coin() { n=0; then = millis()+1; while(millis()<=then) { n=!n; } return n; }
function get_fair_bit() { while(1) { a=flip_coin(); if(a!=flip_coin()) { return(a); } } }
function get_random_byte(){ n=0; bits=8; while(bits--){ n<<=1; n|=get_fair_bit(); } return n; }
report_console = function() { while(1) { console.log(get_random_byte()); }}
14:02 * josephg reads up
14:03 < josephg> koppor, rawtaz: ShareJS does all the actual OT
14:03 < josephg> racer is now a wrapper around it which does things like refs, reflists
14:03 < josephg> ... it manages subscriptions for you (so if you change pages, you don't have to manually unsubscribe)
14:03 < josephg> stuff like that.
14:03 < josephg> ShareJS just does the document editing.
14:04 < josephg> Redis is currently important for 3 things:
14:05 < josephg> - We need to be able to atomically append to the op log. We're using redis's lua scripting to do atomic commits
14:05 < josephg> - Redis is also used for pubsub between your backend servers
14:05 < josephg> (well, between your servers)
@pawelpabich
pawelpabich / LogModule.cs
Created July 7, 2012 13:32
Log4Net and NLog modules for Autofac
using System;
using System.Linq;
using Autofac;
using Autofac.Core;
using NLog;
using log4net;
using LogManager = NLog.LogManager;
namespace AutofacIdea
{