Skip to content

Instantly share code, notes, and snippets.

View vyach-vasiliev's full-sized avatar

ฬะทçะรโลนร vyach-vasiliev

  • Milky Way galaxy, planet Earth
View GitHub Profile
@vyach-vasiliev
vyach-vasiliev / fix_wireguard_policy.md
Created December 23, 2024 07:19
Error of WireGuard Client (Scripts: disabled, per policy/Скрипты: отключено, по политике)

Fix for running scripts (ex. PostUp, PostDown) in WireGuard Client for Windows OS 10 and above.

reg add HKLM\Software\WireGuard /v DangerousScriptExecution /t REG_DWORD /d 1 /f
@vyach-vasiliev
vyach-vasiliev / wg0.conf
Created December 22, 2024 14:00
Wireguard Example Config with Excluded IPs for WinOS
[Interface]
PrivateKey = ...
Address = 10.8.1.3/32
DNS = 1.1.1.1
PostUp = powershell -command 'New-NetRoute -DestinationPrefix "<excluded ip>/32" -NextHop "192.168.0.1"'
PostDown = powershell -command 'Remove-NetRoute -DestinationPrefix "<excluded ip>/32"'
[Peer]
PublicKey = ...
PresharedKey = ...
@vyach-vasiliev
vyach-vasiliev / fix_wsl2_internet.md
Created December 12, 2024 20:57
WSL 2 Internet connection doesn't work until I connect to VPN

Author: @wushangwei
Source: microsoft/WSL#5784 (comment)

I once had the opposite problem: WSL2 lost internet connection when connected to WIreGuard VPN.

I solved the problem by editing the "AllowedIPs“ field of WireGuard conf:

[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@vyach-vasiliev
vyach-vasiliev / _set_google_chrom_as_default_browser.md
Last active October 30, 2024 20:23
How to REset Google Chrom by default browser in Windows OS?

RE-SET Chrome as your default browser on Windows OS

Yeah and without reinstall.

image

  1. Download new Google Chrome EXE-file from official site: https://www.google.com/chrome/
  2. Open the Terminal (or Command Line) via the context menu where the downloaded file (like chome.exe) is located.
  3. Copy and paste this command into terminal and press Enter
ChromeSetup.exe --force-fre-default-browser-step --make-chrome-default --make-default-browser

Counting score of the latest -N reviews on OZON.ru

// upd 26/10/2024
let userScores = Array.from(document.querySelectorAll('div[data-widget="webListReviews"] div'))
  .map(div => Array.from(div.children).filter(child => child.tagName === 'svg' && child.style.color === 'rgb(255, 168, 0)').length)
  .filter(score => score > 0)
  .slice(0, 10); // Get the first 10 scores

const totalScore = Math.max(1, Math.min(userScores.reduce((acc, score) => acc + score, 0) / userScores.length, 5));
@vyach-vasiliev
vyach-vasiliev / CompactWSL.bat
Created October 19, 2024 14:16 — forked from Csqhi515/CompactWSL.bat
Script to help compact WSL and vhdx.
@echo off
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Requesting administrative privileges...
powershell -Command "Start-Process '%~f0' -Verb RunAs"
exit /b
)
wsl sudo fstrim --all; echo "Exit status: $?";
@vyach-vasiliev
vyach-vasiliev / readme.md
Last active October 16, 2024 19:23
Run WSL with VcXsrv (2024)

Reason to Use VcXsrv Instead Pure WSL/WSLG

I ran the application (Intellij IDEA in my case) like this (without VcXsrv) in WSL2.

export LIBGL_ALWAYS_SOFTWARE=1 && export DISPLAY=:0 && nohup idea.sh &

But after some time I observed 1-5-10 second freezes in the GUI interface.

Setup VcXsrv on Windows OS (10 ver in my case)

  1. Install VcXsrv that is an open-source and frequently updated Windows X Server (it will be the provider of graphics resources and keyboard/mouse events), then start it as follow:
  • Use multiple windows
@vyach-vasiliev
vyach-vasiliev / lookups_in_django_admin_url.md
Created May 24, 2024 08:18
Supported Lookups in Django Admin URL

Supported Lookups in Django Admin URL

exact: exact match

icontains: case-insensitive containment test

startswith, istartswith: starts with (case-insensitive)

endswith, iendswith: ends with (case-insensitive)

@vyach-vasiliev
vyach-vasiliev / Find kinorium movie on kinopoisk.js
Last active June 27, 2026 20:58
Open free movie or kinopoisk (bookmarklet)
javascript:location.href="https://www.kinopoisk.ru/index.php?kp_query="+document.title.split("(")[0]
@vyach-vasiliev
vyach-vasiliev / README.md
Last active October 16, 2024 19:29
Modify context menu for Shell app in WindowsOS