Skip to content

Instantly share code, notes, and snippets.

View beminee's full-sized avatar

(ノ°Д°)ノ︵ ┻━┻ beminee

View GitHub Profile
@beminee
beminee / ThreadSafePriorityQueue.cs
Last active July 27, 2023 08:44
C# Thread-Safe O(logn) Priority Queue implementation
// Inspired from https://gist.github.com/khenidak/49cf6f5ac76b608c9e3b3fc86c86cec0
// Enqueue: O(log n), because we might need to "bubble up" the new element to its proper place in the heap.
// Dequeue: O(log n), because we remove the top element and then "bubble down" the swapped element to its proper place.
// Peek: O(1), since we're just returning the top element.
public class ThreadSafePriorityQueue<TItem, TPriority> where TItem : class where TPriority : IComparable<TPriority>
{
private IComparer<TPriority> comparer;
private List<KeyValuePair<TItem, TPriority>> list = new List<KeyValuePair<TItem, TPriority>>();
private ReaderWriterLockSlim rwLock = new ReaderWriterLockSlim();

Ubuntu 16.04 Installation:

Installing prerequisites

sudo su
apt-get update
apt-get install default-jdk
// ==UserScript==
// @name Volume to speed
// @author Satan
// @namespace youtube.com
// @description YouTube videos change playback speed based on the current volume. Fun.
// @include https://www.youtube.com/watch?v=*
// @version 1.0
// @grant none
// ==/UserScript==