Skip to content

Instantly share code, notes, and snippets.

View Ghost---Shadow's full-sized avatar
🥔
eating potatoes

Souradeep Nanda Ghost---Shadow

🥔
eating potatoes
View GitHub Profile
@Ghost---Shadow
Ghost---Shadow / remove-watched.js
Created June 8, 2023 20:45
Remove all watched videos from watch later playlist
(async () => {
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
watchedVideoOverlays = Array.from(document.getElementsByClassName('ytd-thumbnail-overlay-resume-playback-renderer'))
for(let i = 0; i < watchedVideoOverlays.length; i += 1){
console.log(i)
try{
@Ghost---Shadow
Ghost---Shadow / sort-watch-later-youtube.js
Last active July 28, 2021 08:48
Sorts the disable_polymer=true Youtube Watch Later playlist by video length
/**
USAGE
1. Open the playlist you want
2. Right click > Inspect element > Console
3. Copy this and paste. Hit enter.
4. For watch later make sure to click the Edit button
EDIT: Not all playlists have hours.
*/
@Ghost---Shadow
Ghost---Shadow / filter.py
Last active October 20, 2017 15:41
Filters all english words which are valid addresses
# http://www-01.sil.org/linguistics/wordlists/english/wordlist/wordsEn.txt
with open("./wordsEn.txt") as word_file:
english_words = set(word.strip().lower() for word in word_file)
matches = []
WORD_LEN = 4
for word in english_words:
if len(word) == WORD_LEN:
var students = [];
var rows = $("tr");
for(var i = 1; i < rows.length; i++){
students[i-1] = {};
var row = rows[i];
var name = (row.children[0].innerHTML+"").trim();
students[i-1]["name"] = name.replace("&nbsp;","").replace(/\s\s+/g,' ');
var cgpa = (row.children[3].innerHTML+"").trim();
@Ghost---Shadow
Ghost---Shadow / SqueezeNet.py
Created May 14, 2017 17:41
Tensorflow implementation of SqueezeNet on MNIST
'''
SqueezeNet v1.1 (https://github.com/DeepScale/SqueezeNet/tree/master/SqueezeNet_v1.1)
Paper: https://arxiv.org/abs/1602.07360
TODO: Use Xavier initializer
'''
import tensorflow as tf
x = tf.placeholder(tf.float32,(None,28*28))
@Ghost---Shadow
Ghost---Shadow / PlaylistLength.js
Last active April 6, 2024 09:25
Calculate the total length of a youtube playlist. Just open javascript console, paste and press enter.
/**
USAGE
1. Open the playlist you want
2. Right click > Inspect element > Console
3. Copy this and paste. Hit enter.
4. For watch later make sure to click the Edit button
Make sure &disable_polymer=true flag is set
e.g.
https://www.youtube.com/playlist?list=WL&disable_polymer=true
@Ghost---Shadow
Ghost---Shadow / Main.java
Created March 23, 2017 16:29
Multiply two numbers without multiplication operators, loops, recursion, bitwise etc
class Main{
public static void main(String[]args){
float a = 5;
float b = 6;
System.out.println(Math.exp(Math.log(a)+Math.log(b)));
}
}
@Ghost---Shadow
Ghost---Shadow / FixedSVM.py
Last active February 22, 2020 07:27
Fixed a bug by rotating the decision boundary with smaller increments
import matplotlib.pyplot as plt
from matplotlib import style
import numpy as np
style.use('ggplot')
class Support_Vector_Machine:
def __init__(self, visualization=True):
self.visualization = visualization
self.colors = {1:'r',-1:'b'}
if self.visualization:
@Ghost---Shadow
Ghost---Shadow / PageReplacement.c
Last active April 27, 2016 01:53
Memory Page Replacement Strategies for learning
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define FRAMES 4
#define ITERATIONS 10
// Check if the page is already in the frame
int hasPageInFrame(int *a,int request){
int i;
@Ghost---Shadow
Ghost---Shadow / plag.py
Created December 11, 2015 05:01
Using NLTK to replace all words in a string with their synonyms.
from nltk.corpus import wordnet
from nltk.tokenize import word_tokenize
from random import randint
import nltk.data
# Load a text file if required
text = "Pete ate a large cake. Sam has a big mouth."
output = ""
# Load the pretrained neural net