Skip to content

Instantly share code, notes, and snippets.

View npanuhin's full-sized avatar
☄️
There is no «Exception» in this library

Nikita Panuhin npanuhin

☄️
There is no «Exception» in this library
  • Constructor University
  • Bremen, Germany
  • LinkedIn in/npanuhin
View GitHub Profile
@npanuhin
npanuhin / convert_base.py
Last active September 23, 2022 20:37
Base converter on Python 3
from string import ascii_uppercase, digits
alphabet = digits + ascii_uppercase
def convert_base(n: str, from_base: int = 10, to_base: int = 10) -> str:
if isinstance(n, str):
n = int(n, from_base)
if n < to_base:
@npanuhin
npanuhin / lazy_load.js
Last active June 18, 2021 20:30
Lazy loading fonts and styles (JS)
function loadFont(name, local=[],
eot=undefined, woff=undefined, woff2=undefined, ttf=undefined,
font_weight="normal", font_style="normal", font_display="auto") {
name = `font-family:'${name}';`;
let eot_sep = (eot == undefined ? '' : `src:url('${eot}');`);
paths = [];
for (let path of local) paths.push(`local('${path}')`);
@npanuhin
npanuhin / vk_remove_documents.js
Last active June 6, 2021 06:28
Script for automatically removing all documents from your VK account
// Run on vk.com/docs page:
for (let item of document.getElementsByClassName("docs_delete_row")) item.click();
@npanuhin
npanuhin / recursive_git_gc.cmd
Last active July 15, 2021 18:04
Run "git gc" recursively
@echo off
set ROOT_PATH="."
set COMMAND=git gc
FOR /R "%ROOT_PATH%" %%F IN (.) DO (
IF EXIST "%%F/.git" (
echo Handling "%%F"...
cd %%F
%COMMAND%
@npanuhin
npanuhin / reset_commit_date.cmd
Last active February 17, 2024 10:46
Reset git CommitDate (for all commits in current branch)
set FILTER_BRANCH_SQUELCH_WARNING=1
git filter-branch -f --commit-filter "GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE";GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME";GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL";git commit-tree "$@";" HEAD
or
git filter-branch -f --commit-filter "GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE";GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME";GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL";git commit-tree -S "$@";" HEAD
@npanuhin
npanuhin / VKClicker.js
Last active June 6, 2021 06:32
VK chat bot clicker
var clicker_button = document.getElementsByClassName("Keyboard")[0].getElementsByClassName("Button")[0],
clicker_count = 100000,
clicker_delay = 2000;
function botClick() {
clicker_button.click();
if (--clicker_count) {
setTimeout(botClick, clicker_delay);
}
}