Skip to content

Instantly share code, notes, and snippets.

View svenyurgensson's full-sized avatar

Yury Batenko svenyurgensson

View GitHub Profile
@svenyurgensson
svenyurgensson / Readme.md
Created January 14, 2026 08:06 — forked from mapster/Readme.md
Export Google Authenticator secret OTP-keys

Export Google Authenticator secret OTP-keys

I recently got myself a Yubikey and wanted to set up the Yubico Authenticator with all the OTPs I had in Google Authenticator. Unfortunately Yubico Authenticator doesn't support scanning the QR-code that the Google Authenticator generates when you export the OTP-keys, and it seemed like quite the daunting task to log in to every service to generate new OTP-keys. So I decided to have a look at the contents of the QR code, to see if I could import the keys into Yubico Authenticator in one go. Luckily I found a blog post by Alex Bakker that describes the data format.

Transfer QR-code to computer

Unfortunately, but likely for the best, the security policy of Google Authenticator won't allow you to take a screenshot of

#!/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