Skip to content

Instantly share code, notes, and snippets.

View evdokimovm's full-sized avatar

Mikhail Evdokimov evdokimovm

View GitHub Profile
@evdokimovm
evdokimovm / index.js
Last active October 1, 2023 05:27
Save the whole list of your saved youtube playlists to text file. Open youtube.com/feed/library or youtube.com/feed/you press "show more" in playlists section. scroll page down to load all playlists list and run the following script in console
var all_contents = document.querySelectorAll('div#contents > ytd-item-section-renderer:nth-of-type(3) > div#contents > ytd-shelf-renderer > div#dismissible > div#contents > ytd-grid-renderer > div#items > ytd-grid-playlist-renderer > div#details > yt-formatted-string > a')
async function getFullTitle(item) {
var double_parent_node = item.parentNode.parentNode
var channel_name_container = double_parent_node.querySelector('ytd-video-meta-block > div#metadata > div#byline-container > ytd-channel-name > div#container > div#text-container > yt-formatted-string')
var playlist_title = double_parent_node.querySelector('h3 > a')
var _a = channel_name_container.querySelector('a')
if (_a) {
return playlist_title.title + ' | -> ' + _a.text + ' | -> ' + _a.href + '\n'
} else {
@evdokimovm
evdokimovm / frames_grid_generator.py
Last active March 17, 2022 09:06
generate frames grid for the given video
import numpy
import cv2
import sys
import datetime
background = numpy.full((1080, 1920, 3), (0, 216, 255), numpy.uint8)
background_w, background_h = background.shape[1], background.shape[0]
cap = cv2.VideoCapture(sys.argv[1])
count = 0
@evdokimovm
evdokimovm / src.js
Last active January 6, 2024 14:00
replies on 4chan will be closed only when you click on them
// ==UserScript==
// @name 4ChReplies (Improve Replies)
// @namespace 4ChReplies
// @version 1.0
// @description Make navigate on 4chan replies more comfortable with this script for tampermonkey. Now replies closes only by click on it.
// @author https://github.com/evdokimovm
// @match https://boards.4chan.org/*
// @match https://boards.4channel.org/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
@evdokimovm
evdokimovm / bot.py
Created May 12, 2021 15:57 — forked from angch/bot.py
I'm bored. Python telegram bot for posting desktop screenshots.
#!/usr/bin/env python3
# FIXME: requirements.txt
# pip3 install python-telegram-bot --upgrade
# pip3 install pyscreenshot
# pip3 install pillow
from telegram.ext import Updater
from telegram.ext import CommandHandler
@evdokimovm
evdokimovm / get.c
Created May 29, 2020 15:29
Get nth byte of integer
// Get nth byte of integer
// https://stackoverflow.com/a/7787433/5526354
int x = (number >> (8*n)) & 0xff;
@evdokimovm
evdokimovm / getpermissions.sh
Created May 29, 2020 15:18
Get octal file permissions number
# Get octal file permissions number
# https://www.cyberciti.biz/faq/get-octal-file-permissions-from-command-line-on-linuxunix/
stat -c '%a' /etc/passwd
@evdokimovm
evdokimovm / copy.sh
Last active March 11, 2020 09:23
copy all files with specific extension using grep. supports files with spaces in their titles also.
ls | grep "png" | xargs -d "\n" cp -t $target_dir
@evdokimovm
evdokimovm / distance.py
Created February 24, 2019 08:30
distance formulas euclidean manhattan hamming
def euclidean_distance(pt1, pt2):
distance = 0
for i in range(len(pt1)):
distance += (pt1[i] - pt2[i]) ** 2
return distance ** 0.5
def manhattan_distance(pt1, pt2):
distance = 0
for i in range(len(pt1)):
distance += abs(pt1[i] - pt2[i])
@evdokimovm
evdokimovm / euclidean_distance.py
Created February 24, 2019 08:05
euclidean distance
def euclidean_distance(pt1, pt2):
distance = 0
for i in range(len(pt1)):
distance += (pt1[i] - pt2[i]) ** 2
return distance ** 0.5
print(euclidean_distance([1, 2], [4, 0]))
print(euclidean_distance([5, 4, 3], [1, 7, 9]))
@evdokimovm
evdokimovm / gist:08f34089f0d032f2d7364fc1de9d70da
Created November 25, 2018 06:33 — forked from AndrewRayCode/gist:3784055
jQuery plugin for shift + click to select multiple checkboxes
// Usage: $form.find('input[type="checkbox"]').shiftSelectable();
// replace input[type="checkbox"] with the selector to match your list of checkboxes
$.fn.shiftSelectable = function() {
var lastChecked,
$boxes = this;
$boxes.click(function(evt) {
if(!lastChecked) {
lastChecked = this;