Skip to content

Instantly share code, notes, and snippets.

View r3code's full-sized avatar

Dmitriy S. Sinyavskiy r3code

View GitHub Profile
@r3code
r3code / README.md
Created February 16, 2024 07:22 — forked from 4wk-/README.md
Clean uninstall then reinstall of WSL on Windows 10, with systemD support

Uninstall then reinstall WSL on Windows 10 (clean way)

Background

I've been using wsl (version 2) with genie mod for years without issue, but one day, Windows 10 finally catch up on wsl Windows 11 features and gives us a way to use systemD natively.

I wanted to use the new "right way" to enable systemD on Windows Subsystem for Linux (without genie), and I also had a (probably related) infinite Windows RemoteApp error poping in.

Fixing it

A - Uninstall wsl and related stuff

  1. In powershell (as admin)
@r3code
r3code / Readme.md
Last active February 13, 2024 19:15
kinescope.io video downloader

kinescope.io video downloader

  1. Install python3, download tools: ffmpeg and N_m3u8DL-RE
  2. Put kdl.py, ffmpeg and N_m3u8DL-RE into same folder
  3. Run python kdl.py it will ask you to input kinescope embed link (e.g. https://kinescope.io/embed/1234534) and referrer link (e.g. https://videos.mysite.org). kinescope forbids to access without a referrer.
  4. Wait for a download copletion.

kdl.py can automatically select the best quality of a video or you can choose it in a menu provided by N_m3u8DL-RE.
ffmpeg receives parts of the selected video and an audio and muxes them into output mp4 file.

@r3code
r3code / send-test-alert.sh
Created March 28, 2023 14:16
Sending Alertmanager test alert and resolution over API
#!/bin/bash
# set your AlertManager server url
alertmanager_url='http://localhost:9093'
url="$alertmanager_url/api/v1/alerts"
# Script will prompt you for alert params, if you hit ENTER without entering a value it uses a [default] value
# alert params
default_name="alert_$RANDOM"
read -p "Enter alertname [$default_name]: " alertname
alertname=${name:-$default_name}
@r3code
r3code / wsl-add-ssh-forwarding-enables-password-store.sh
Created February 1, 2023 11:49
WSL 2 Allow SSH password store and use
# https://1password.community/discussion/128023/ssh-agent-on-windows-subsystem-for-linux
# Script: Do not ask for SSH password in Git/GitLab
# or you will be receiving prompt or error
# USEAGE: adding this to your .bashrc or .zshrc, Restart the ubuntu terminal / resource the rc file (source .bashrc), Test with ssh-add -l Should see your ssh keys.
# Configure ssh forwarding
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
# need `ps -ww` to get non-truncated command for matching
# use square brackets to generate a regex match for the process we want but that doesn't match the grep command running it!
ALREADY_RUNNING=$(ps -auxww | grep -q "[n]piperelay.exe -ei -s //./pipe/openssh-ssh-agent"; echo $?)
if [[ $ALREADY_RUNNING != "0" ]]; then
@r3code
r3code / sre-incident-management.md
Last active January 9, 2023 09:37
SRE incident management

SRE incident management

  1. https://response.pagerduty.com/before/severity_levels/ - уровни серьезности инцидентов (пример)
  2. https://www.blameless.com/blog/severity-levels - Severity Levels (What They Are & Why They Matter)
  3. https://www.atlassian.com/incident-management/kpis/severity-levels - Understanding incident severity levels
  4. https://rootly.com/blog/practical-guide-to-sre-incident-severity-levels - руководство по составлению классификации инцидентов
  5. https://www.blameless.com/blog/severity-vs-priority - Severity vs. Priority | Понимание разницы
  6. https://www.bmc.com/blogs/impact-urgency-priority/ Матрица влияния-срочность-приоритет
  7. https://www.blameless.com/blog/incident-priority-matrix Incident Priority Matrix (Understanding Impact and Urgency)
  8. https://www.blameless.com/blog/incident-management-best-practices - Best Practices for Effective Incident Management
@r3code
r3code / github-to-gitflick-copy-repository.sh
Created December 8, 2022 12:18
Copy your gtihub repository to gitflick
Just use https://gitflic.ru/project/dbi471/git-switch
@r3code
r3code / 01_vps-vpn-setup.md
Last active June 18, 2024 19:38
Настройка VPS для VPN: IPSec/IKEv2 или Outline Server

Настройка VPS для VPN

Использую сервер на Ubuntu 20.04 LTS

Варианты для VPN

Тестировался на канале 100 Мбит/с (96/95 Мбит/с download/upload)

  • IKEv2 IPSec сервер - download: 9-10 Мбит/с, upload 29 Мбит/с
  • Outline VPN Server - download: 23-29 Мбит/с, upload 29-34 Мбит/с
  • Wireguard VPN server - download: 15-20 Мбит/с, upload 27-31 Мбит/с