Skip to content

Instantly share code, notes, and snippets.

@rlb3
rlb3 / README.md
Created February 26, 2021 20:25 — forked from astamicu/Remove videos from Youtube Watch Later playlist.md
Script to remove all videos from Youtube Watch Later playlist

UPDATED 3.12.2020

The old version of youtube with "disable_polymer" is not working anymore, so the script also stopped working.

Thanks to JanTheDeveloper we have a new working script. Big up!

I just changed the '//span[contains(text(),"Watch later")]', to '//span[contains(text(),"Remove from")]', and it should work for any playlist, not just the watch later one. (thanks to hudsonite for the tip)

setInterval(function () {
 document.querySelector('#primary button[aria-label="Action menu"]').click();
@rlb3
rlb3 / person.ex
Last active February 14, 2021 03:55
defmodule Person do
defstruct [:name, :age]
def new(name, age), do: __struct__(name: name, age: age)
def map(person, key, value) do
person
|> Map.from_struct()
|> Enum.map(fn
{^key, _} -> {key, value}
@rlb3
rlb3 / reply_server.ex
Last active September 9, 2020 13:35
Concurrent Synchronous
defmodule Reply.Server do
use GenServer
def long(pid) do
GenServer.call(pid, :long_process)
end
def boom(pid) do
GenServer.call(pid, :boom)
end
defmodule MacroPlayground.Json do
defmacro decode(do: block) do
quote do
json = unquote(block)
json |> Jason.decode()
end
end
def run() do
decode do
@rlb3
rlb3 / balance_parentheses.ex
Last active September 6, 2020 21:37
Balanced Parentheses
defmodule B2 do
defstruct stack: []
@matches %{
"(" => ")"
}
def new() do
%__MODULE__{}
end
defmodule ParsecPlayground do
import NimbleParsec
word =
ascii_string([?a..?z, ?A..?Z], max: 100)
|> ignore(choice([string(" "), eos()]))
defp to_map(_rest, args, context, _line, _offset, joiner) do
args =
args
@rlb3
rlb3 / fib.ex
Last active August 24, 2020 10:32
Streaming Fibonacci/lucas
Stream.resource(
fn -> {0, 1} end,
fn
{0, 1} ->
{[1], {1, 0}}
{x, y} ->
z = x + y
{[z], {z, x}}
end,
defmodule FizzBuzz do
def run(count \\ 100) do
Stream.zip(fizz(), buzz())
|> Stream.map(fn {fizz, buzz} ->
fizz <> buzz
end)
|> Stream.with_index(1)
|> Stream.map(fn
{"", index} -> index
{str, _index} -> str
defmodule MathParser do
import Parsers
def run() do
input = "1 + 2"
IO.puts("input: #{inspect(input)}")
parse(input)
end
def parse(input) do
defmodule Sort do
def binary(list, match) do
middle = list |> Enum.count() |> div(2)
case Enum.split(list, middle) do
{first_list, [test_number | _] = second_list} ->
cond do
test_number == match ->
:found