Skip to content

Instantly share code, notes, and snippets.

@gaviral
gaviral / auto_refresh_random_interval.js
Created May 15, 2024 00:01
Page Auto-Refresh with Random Interval (for CJS-2 chrome extension and not using other extensions that ask permissions to read all your data)
var minRefreshIntervalInSeconds = 5;
var maxRefreshIntervalInSeconds = 10;
var seed = Date.now();
Math.seed = seed;
function seededRandom() {
var x = Math.sin(Math.seed++) * 10000;
return x - Math.floor(x);
}
@gaviral
gaviral / install-tmux.sh
Last active March 2, 2021 19:41 — forked from muralisc/install-tmux.sh
Install tmux 3.0a on Amazon Linux 2 / rhel /centos
# Install tmux 3.1c on Amazon Linux 2
# install deps
sudo yum install -y gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -LOk https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz
tar -xf libevent-2.1.11-stable.tar.gz
cd libevent-2.1.11-stable
./configure --prefix=/usr/local
##########################################################
# CODE INSTRUCTIONS: #
# 1) The method findLargestSmallerKey you're asked #
# to implement is located at line 30. #
# 2) Use the helper code below to implement it. #
# 3) In a nutshell, the helper code allows you to #
# to build a Binary Search Tree. #
# 4) Jump to line 71 to see an example for how the #
# helper code is used to test findLargestSmallerKey. #
##########################################################
import os
def main():
fName = [' ']
fName.append("1 Trees___redacted__")
fName.append("2 Trees___redacted__")
fName.append("3 Trees___redacted__")
fName.append("4 Trees___redacted__")
fName.append("5 Trees___redacted__")
@gaviral
gaviral / favouriteMovies.js
Created April 20, 2019 01:54
Automatically find and render movie trailers for a list my favorite movies.
var player;
var selectedMovieName;
console.log("branch test for CI");
// Pause the video when the modal is closed
$(document).on('click', '.hanging-close, .modal-backdrop, .modal', function(event) {
// Remove the src so the player itself gets removed, as this is the only
// reliable way to ensure the video stops playing in IE
stopVideo();
var iFrame = document.getElementById('trailer-video-container');
var trailerDiv = document.createElement("div");