Skip to content

Instantly share code, notes, and snippets.

View svenyurgensson's full-sized avatar

Yury Batenko svenyurgensson

View GitHub Profile
#!/bin/bash
RELEASE_API="https://api.github.com/repos/heiher/hev-socks5-tunnel/releases/latest"
BIN_DST_DIR=/usr/local/bin
RESOURCE_DST_DIR=/usr/local/etc/hev-socks5-tunnel
function getReleaseInfo() {
response=$(curl ${RELEASE_API})
if [ $? == 0 ]; then
echo $response
return 0
# THMC Инструкция по подключению к VPN (AmneziaVPN / AmneziaWG)
## 1. Установка клиента
В зависимости от устройства используем разные клиенты:
- **📱 Телефон / планшет**
- **iOS (за пределами РФ):** устанавливаем **AmneziaVPN** из App Store.
- **iOS (в регионе РФ):** **AmneziaVPN** недоступен — используем **AmneziaWG**.
- **Android:** устанавливаем **AmneziaVPN** из Play Market (доступен и в РФ).
@svenyurgensson
svenyurgensson / install_awg.sh
Created December 23, 2025 11:28 — forked from sm1ky/install_awg.sh
Install wireguard & awg
#!/bin/bash
set -e
export DEBIAN_FRONTEND=noninteractive
LOG_FILE="/tmp/amneziawg_install.log"
RESULT_FILE="/tmp/amneziawg_install_result.log"
AWG_WORKDIR=~/awg
echo "Начало установки AmneziaWG" > $LOG_FILE
echo "Не завершено" > $RESULT_FILE
@svenyurgensson
svenyurgensson / apple-bluetooth-keyboard-windows-10-bootcamp.md
Created March 25, 2025 18:37 — forked from mcandre/apple-bluetooth-keyboard-windows-10-bootcamp.md
How to fix Apple Bluetooth Wireless Keyboard (Windows 10)

The driver situation with Apple Bluetooth wireless keyboards and Windows 10 is horrible, even with the latest BootCamp drivers. Fortunately, a workaround is available, if you're patient.

Pair keyboard once

  1. Turn on the keyboard.
  2. Press and hold Command + w until the keyboard light begins blinking, indicating the keyboard is ready to pair.
  3. Use Windows Bluetooth settings to pair the keyboard, entering the same code (e.g. 123456 Enter) on both internal and external keyboards.

Pairing the keyboard is very trial and error. 9/10 times, Windows will complain that the keyboard is not available for pairing. Just keep trying.

@svenyurgensson
svenyurgensson / ruby_meta.md
Created May 7, 2021 11:52 — forked from jamesyang124/ruby_meta.md
Ruby meta programming

#!/bin/ruby --verion => 2.0.0-p353

Self

In Ruby, self is a special variable that always references the current object.

  • Inside class or module definition, self refer to the Class or Module object.
  • Inside instance method, self refer to future instance object.
  • Inside class method, self refer to the class.i
@svenyurgensson
svenyurgensson / clean.el
Created May 10, 2020 07:05 — forked from rougier/clean.el
A very minimal but elegant emacs configuration file
(require 'org)
(setq-default indent-tabs-mode nil)
(setq org-display-inline-images t)
(setq org-redisplay-inline-images t)
(setq org-startup-with-inline-images "inlineimages")
(setq default-frame-alist
(append (list '(width . 72) '(height . 40))))

Transactions

As your business logic gets complex you may need to implement transactions. The classic example is a bank funds transfer from account A to account B. If the withdrawal from account A fails then the deposit to account B should either never take place or be rolled back.

Basics

All the complexity is handled by ActiveRecord::Transactions. Any model class or instance has a method named .transaction. When called and passed a block, that block will be executed inside a database transaction. If there's an exception raised, the transaction will automatically be rolled back.

Example

$('form .input.array').each(function() {
var $wrapper = $('.array-inputs', this);
var $insertArea = $(".array-input button[data-action=add]").closest(".array-input");
$(".array-input button[data-action=add]", $(this)).click(function(e) {
$('.array-input:first-child', $wrapper).clone(true).insertBefore($insertArea).find('input').val('').focus();
});
$('.array-input button[data-action=remove]', $wrapper).click(function() {
if ($('.array-input', $wrapper).length > 2) {
$(this).parent('.array-input').remove();
}
@svenyurgensson
svenyurgensson / privacy.md
Created December 30, 2017 17:38 — forked from veekaybee/privacy.md
A work-in-progress post on how to protect your data and privacy online

Work-in-progress

How to protect your data and privacy online for the average user

Table of Contents

  1. Introduction and Motivation 1a. About me
  2. Ad profiling: What can be tracked
  3. Government tracking: What can be tracked
  4. Low-effort
  5. Medium-effort