Skip to content

Instantly share code, notes, and snippets.

View vklachkov's full-sized avatar
🏠
Working from home

Valery Klachkov vklachkov

🏠
Working from home
View GitHub Profile
[settings]
timeout = 1000
[relaychain]
chain = "rococo-local"
default_command = "./polkadot-sdk-2409/target/release/polkadot"
[[relaychain.nodes]]
name = "alice"
validator = true
EGLint major, minor, count, n, size, w, h, format;
EGLDisplay display = nullptr;
EGLSurface surface;
EGLContext context;
EGLConfig *configs;
EGLConfig config = nullptr;
EGLBoolean result = EGL_FALSE;
static const EGLint config_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
#include <cstdio>
#include <cstring>
#include "aes.hpp"
#define PRINTF_BUFHEX(buf, n) \
for (int i = 0; i < n; i++) \
{ \
printf("0x%02X ", buf[i]); \
} \
# Реклама групп с пометкой рекламы
vk.com#?##page_wall_posts > div[id^="post-"]:-abp-has(.wall_marked_as_ads)
# Реклама интересных авторов
vk.com#?##page_wall_posts > div[id^="post-"]:-abp-has(.wall_authors_rec)
# Рекомендации в ленте
vk.com##.feed_friends_recomm
vk.com###profile_friends_recomm
@vklachkov
vklachkov / android_text_input_layout.xml
Last active April 1, 2021 09:18
Colorize TextInputLayout.FilledBox
<!-- See: -->
<!-- https://medium.com/omisoft/textinputlayout-styling-8b36a5e0d73c -->
<!-- Style and color must be placed into different files -->
<!-- Style -->
<style name="TextInputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="hintTextColor">@color/input_box_color</item>
<item name="passwordToggleTint">@color/input_box_color</item>
<item name="boxStrokeColor">@color/input_box_color</item>
@vklachkov
vklachkov / mqtt.kt
Last active March 14, 2021 13:04
Coroutines over mqtt android client
package mqtt
import kotlinx.coroutines.suspendCancellableCoroutine
import org.eclipse.paho.android.service.MqttAndroidClient
import org.eclipse.paho.client.mqttv3.*
import timber.log.Timber
import kotlin.coroutines.resume
suspend inline fun MqttAndroidClient.awaitConnectWith(
crossinline options: MqttConnectOptions.() -> Unit
@vklachkov
vklachkov / ya_taxi_money.py
Created April 22, 2020 10:35
Calculates the amount of money spent on taxis from a message backup
import re
money = 0
with open("raw.txt", encoding="utf-8") as f:
for line in f.readlines():
if "YANDEX.TAXI" not in line:
continue
data = line.strip()
@vklachkov
vklachkov / diskutils_ntfs_vhdx_format.cs
Created April 14, 2020 18:11
C# example which create vhdx disk and create empty ntfs volume using DiskUtils
using System.IO;
using DiscUtils;
using DiscUtils.Ntfs;
using DiscUtils.Partitions;
using DiscUtils.Streams;
using DiscUtils.Vhdx;
namespace App
{
internal class Program
@vklachkov
vklachkov / tcp_counter_server.py
Created April 14, 2020 18:03
Simple tcp server
import socket
import time
SERVER_ADDRESS = ('localhost', 2353)
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(SERVER_ADDRESS)
server_socket.listen(1)
while True:
@vklachkov
vklachkov / tcp_echo_client.py
Created April 3, 2020 22:14
Simple tcp echo client
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('SERVER', 80))
while True:
raw = s.recv(1024)
print(raw.decode('ascii'))