Skip to content

Instantly share code, notes, and snippets.

View evdokimovm's full-sized avatar

Mikhail Evdokimov evdokimovm

View GitHub Profile
@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 / 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 / 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 / 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 / index.js
Last active January 19, 2025 02:22
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 / index.html
Created April 2, 2023 12:47
tree comments structure simple client side example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
@evdokimovm
evdokimovm / index.html
Last active April 19, 2023 16:11
pie chart on js canvas. no libs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pie Chart</title>
</head>
<body>
<div class="chart-container">
@evdokimovm
evdokimovm / has_enough_space.py
Created May 16, 2023 05:11
check if the square matrix has enough space to fit the Tetris shape in using numpy
def check_space(matrix):
shape = [
[1, 1, 0],
[1, 0, 0],
[1, 0, 0]
]
shape_height = len(shape)
shape_width = len(shape[0])
matrix_height = len(matrix)
@evdokimovm
evdokimovm / index.js
Last active September 2, 2023 16:19
promise wrapper for chrome.storage.local.set and chrome.storage.local.get operations for chrome extensions
async function promiseWrapper(options, callback) {
return new Promise((resolve, reject) => {
try {
callback(options, resolve)
} catch (err) {
reject(err)
}
})
}
@evdokimovm
evdokimovm / three-phases.py
Last active January 16, 2024 18:05
visualize three phases of electrical system
import matplotlib.pyplot as plt
import numpy as np
import mplcursors
x = np.linspace(0, 500, 1000)
plt.figure(figsize=(10, 6))
plt.axhline(y=0, color='k', linestyle='-')