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 / add_all_to_lost.js
Last active January 12, 2024 19:53
Rebrickable: add all parts from set to lost parts
let _to_add = document.querySelectorAll('.js-part-data');
function handle(part_index) {
let _part = _to_add[part_index];
console.log(part_index, _part);
let _quantity = _part.getAttribute('data-quantity');
_part.click();
setTimeout(() => {
document.querySelector('a[href="#tab_lostparts"]').click();
setTimeout(() => {
@npanuhin
npanuhin / gh_remove_workflow.md
Created December 16, 2023 22:46
GitHub: remove workflow history from repository

Run in bash (linux) or Git Bash (Windows)

Remove all workflows:

gh run list --json databaseId --jq ".[].databaseId" --limit 1000 | xargs -n1 gh run delete

Remove specific workflow:

@npanuhin
npanuhin / template.typ
Last active October 28, 2023 00:42
My typst homework template
// The project function defines how your document looks.
// It takes your content and some metadata and formats it.
// Go ahead and customize it to your liking!
// Save heading and body font families in variables.
#let _body-font = "Linux Libertine"
// #let _body-font = "PT Serif"
#let _sans-font = "HK Grotesk"
// let _sans-font = "Inconsolata"
// #let _sans-font = "Liberation Sans"
@npanuhin
npanuhin / find_semitrasparent_pixels.py
Last active February 21, 2023 20:48
Find (and potentially eliminate 😈) semi-transparent pixels in a bunch of PNG files
from PIL import Image
import os
FOLDER_PATH = "output3"
for filename in os.listdir(FOLDER_PATH):
img = Image.open(os.path.join(FOLDER_PATH, filename), 'r')
has_alpha = (img.mode == 'RGBA')
print(f"Handling {filename}...")
@npanuhin
npanuhin / pyupgrade_ci.md
Created December 7, 2022 13:38
Pyupgrade in CI

How run pyupgrade in CI (real usecase)

Here is a workaround for pyupgrade's lack of --check option (one of many related issues) and folder scanning (related issue).

find . -type f -name "*.py" -exec pyupgrade --py38-plus {} \;
test $(git status --porcelain | wc -l) = 0

You can use this in any CI platform like GitHub Actions

@npanuhin
npanuhin / MailRu_mailto_protocol.md
Last active September 21, 2022 13:32
Как установить Mail.ru в качестве обработчика ссылок mailto в Firefox | How to set Mail.ru as an application for mailto links in Firefox

Как установить Mail.ru в качестве обработчика ссылок mailto в Firefox

  1. Перейдите на сайт почтового сервиса: e.mail.ru
  2. Откройте консоль Firefox одним из следующих способов:
    • Ctrl+Shift+k (Mac: Command+Alt+k)
    • F12 > вкладка Console
    • (Строка меню, нажмите Alt) Инструменты > Инструменты браузера > Web Developer Tools > вкладка Console
  3. Скопируйте следующую строчку и вставьте её в открывшуюся консоль Firefox:
@npanuhin
npanuhin / VkusVill_mango.js
Last active March 27, 2022 09:20
VkusVill mango promocode cheat
var layout = document.getElementById("app").getElementsByClassName("grid")[0];
var cards = layout.getElementsByClassName("card");
function next() {
var found = false;
for (var i = 0; i < cards.length; ++i) {
for (var j = 0; j < i && !found; ++j) {
if (
cards[i].getElementsByClassName("card__img")[0].src == cards[j].getElementsByClassName("card__img")[0].src &&
!cards[i].classList.contains("card--flipped") && !cards[j].classList.contains("card--flipped")
@npanuhin
npanuhin / strava_post_finder.js
Last active December 25, 2021 12:56
Strava: find all your posts in club
var name = "Name Surname";
function update() {
for (let post of document.querySelectorAll("#discussion-topics > li")) {
if (post.querySelector(".topic > .post-container > .post > .post-header > .post-info > a.str-click-name-js > strong").innerText == name) {
console.log(post.querySelector(".topic > .post-container > .post > .post-content .post-body > a").href);
}
post.remove();
}
@npanuhin
npanuhin / remove_submodule.cmd
Created August 19, 2021 22:10
Remove Git Submodule
set submodule_path=%1
git submodule deinit -f "%submodule_path%"
rmdir /S /Q ".git/modules/%submodule_path%"
git rm -f "%submodule_path%"
@npanuhin
npanuhin / PS_resize_to_fit.js
Last active December 25, 2021 21:09
Resize Photoshop image to specified resolution
// These are values for the end result width and height (in pixels) of our image
//
// Common values:
// Vk.com max photo size: 2560 x 2160
var target_width = 1920;
var target_height = 1080;
// ========================================================================================