Skip to content

Instantly share code, notes, and snippets.

View asiryk's full-sized avatar
🌿

Alexander Siryk asiryk

🌿
View GitHub Profile
@asiryk
asiryk / yt-clear-watch-later.js
Created October 1, 2025 15:12
Clear all YouTube watch later
(async () => {
const buttons = document.querySelectorAll(
'button.style-scope.yt-icon-button[aria-label="Action menu"]'
);
for (const button of buttons) {
try {
button.click();
await new Promise(r => setTimeout(r, 200));
const item = [...document.querySelectorAll("ytd-menu-service-item-renderer")].find(el => el.textContent.includes("Remove from Watch Later"));
@asiryk
asiryk / uninstall-logitech-ghub.sh
Created February 18, 2025 09:29 — forked from timotgl/uninstall-logitech-ghub.sh
How to fully uninstall Logitech G HUB on macOS via terminal/command line
# How to fully uninstall Logitech G HUB on macOS via terminal/command line
# Tested on macOS version 12.3.1 (21E258) Monterey in April 2022
# with Logitech G HUB version 2022.3.242300 (released on 2022-03-22) installed.
# 1. Make sure "Logitech G HUB" itself is not running. If it is, quit it.
# 2. Open "Activity Monitor" and force-quit all processes named "lghub*".
# 3. Delete system-wide files
sudo rm -rf /Applications/lghub.app
@asiryk
asiryk / gitlab-api-rm-pipelines.sh
Created March 7, 2023 15:54
Remove pipelines from GitLab
#!/usr/bin/env bash
# Script that erases pipelines from GitLab
GITLAB_TOKEN="" # <required>
PROJECT_ID="" # <required>
GITLAB_INSTANCE="https://gitlab.com/api/v4/projects" # <required>
PER_PAGE="" # [optional] if not specified script will run once per page
for PIPELINE in $(curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$GITLAB_INSTANCE/$PROJECT_ID/pipelines?per_page=$PER_PAGE&sort=asc" | jq .[].id) ; do
@asiryk
asiryk / tree_style_tab_firefox.md
Last active January 7, 2023 14:25 — forked from ruanbekker/tree_style_tab_firefox.md
Hide Native Tabs with Tree Style Tabs for Firefox
@asiryk
asiryk / typescript_is_broken.ts
Last active December 4, 2022 07:51
Typescript is broken
// If A extends B, does it mean that Type<A> extends Type<B>?
//
// An example that shows broken type variance in TypeScript.
// Following code compiles, but it shouldn't.
// It also doesn't fail at runtime because there are example classes
// with no methos, but real-world classes would use wrong methos and fail at runtime.
// Let's pretend there are unique methos for each class
abstract class Animal {}
@asiryk
asiryk / match.java
Created July 12, 2022 09:15
Pattern matching for Java
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
/**
* Usage example:
* {@code (int) new Matcher(5).matchCase(1, () -> 1).defaultCase(() -> 5)}
*/
public class Matcher<V, R> {
@asiryk
asiryk / nvim-better-defaults.lua
Created February 20, 2022 12:50
Must have neovim remaps
local opts = { noremap = true, silent = true }
local expr = { noremap = true, silent = true, expr = true }
-- Center screen on the "next" and "previos" search jumps
vim.api.nvim_set_keymap("n", "n", "nzzzv", opts)
vim.api.nvim_set_keymap("n", "N", "Nzzzv", opts)
-- Move one or more selected lines up and down (in Visual mode)
vim.api.nvim_set_keymap("v", "J", ":m '>+1<CR>gv=gv", opts)
vim.api.nvim_set_keymap("v", "K", ":m '<-2<CR>gv=gv", opts)
@asiryk
asiryk / ascii-shift-decryption.java
Created February 18, 2022 09:31
Java files, regex, chars examples
import java.io.BufferedReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Collector;
public class H13_5 {
@asiryk
asiryk / compareShiftedArrays.ts
Created October 29, 2021 21:27
The function, that compares arrays with shifted values.
/**
* Compares arrays with shifted values.
*
* @example
* // returns 3
* compareShifted([1, 2, 3, 4], [4, 1, 2, 3]);
* @example
* // returns -1
* compareShifted([1, 2, 3, 4], [1, 2, 4, 3]);
* @example
@asiryk
asiryk / node_nginx_ssl.md
Created September 25, 2021 11:16 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user