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
Created June 19, 2016 14:10
JavaScript Convert Radians to Degrees and Degrees to Radians
// Convert from degrees to radians.
Math.radians = function(degrees) {
return degrees * Math.PI / 180;
}
Math.radians(90); // 1.5707963267948966
// Convert from radians to degrees.
Math.degrees = function(radians) {
return radians * 180 / Math.PI;
}
@evdokimovm
evdokimovm / pomodoro.py
Last active March 20, 2024 04:58
pomodoro timer in python
import winsound
import tkinter as tk
from PIL import Image, ImageDraw, ImageTk
class PomodoroClock:
def __init__(self, master):
self.master = master
self.total_time_in_seconds = 0
self.elapsed_time_in_seconds = 0
self.timer_running = False
@evdokimovm
evdokimovm / index.html
Last active February 15, 2024 08:13
chess puzzles from The Password Game with answers
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chess Puzzles from The Password Game with Solutions</title>
</head>
<body>
<style>
#container {
display: flex;
@evdokimovm
evdokimovm / Microsoft.PowerShell_profile.ps1
Created February 14, 2024 09:29
My PowerShell 7 Microsoft.PowerShell_profile.ps1 profile
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\amro.omp.json" | Invoke-Expression
Import-Module Terminal-Icons
Import-Module PSReadLine
New-Alias code code-insiders
New-Alias curl C:\curl-7.81.0-win64-mingw\bin\curl.exe
Remove-Alias md
function md {
param (
@evdokimovm
evdokimovm / index.html
Last active January 26, 2024 02:44
drag a box around the screen and drop it onto one of three target areas. check if the draggable element is inside any of the target elements
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
margin: 0;
padding: 0;
}
@evdokimovm
evdokimovm / get_rank_by_RP.py
Created January 17, 2024 12:33
get rainbow six siege r6s rank by rp mmr ranked points
def value_to_rank(RP):
titles_list = ['Copper', 'Bronze', 'Silver', 'Gold', 'Platinum', 'Emerald', 'Diamond', 'Champion']
min_value = 1000
rank_interval = 500
increment = 100
if RP <= 1000:
return 'Copper 5'
@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='-')
@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 / 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 / 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)
}
})
}