Skip to content

Instantly share code, notes, and snippets.

View kuznetsov-m's full-sized avatar

Mikhail Kuznetsov kuznetsov-m

View GitHub Profile
@kuznetsov-m
kuznetsov-m / selenium_example.py
Created February 26, 2023 22:48
Python Selenium Chrome webdriver example
# Chrome webdriver: https://sites.google.com/chromium.org/driver/
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
options = Options()
options.headless = False
from kafka import KafkaConsumer
host = ''
topic = ''
user = ''
password= ''
sasl_mechanism = 'SCRAM-SHA-512'
security_protocol = 'SASL_SSL'
consumer = KafkaConsumer(
// sum_series(
// a={{0, 2}, {5, 1}},
// b={{2, 4}, {3, 6}, {8, 7}}
// ) -> {{0, 2}, {2, 6}, {3, 8}, {5, 7}, {8, 8}}
#include <vector>
struct Point {
int time;
int value;
@kuznetsov-m
kuznetsov-m / matrix_traversal_solution.cpp
Last active December 12, 2022 06:45
Matrix Traversal
#include <iostream>
#include <vector>
#include <string>
#include <limits> // <----- did not have time to fix here
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
@kuznetsov-m
kuznetsov-m / print_typename.cpp
Created August 16, 2022 10:50
print_typename c++ sample
#include <typeinfo>
#if defined __GNUC__
#include <cxxabi.h> // GCC / Clang only
#endif
#include <string>
std::string type_name_to_full_name(const char* name) {
char * n = abi::__cxa_demangle(name, 0, 0, 0);
std::string s{n};
free(n);
@kuznetsov-m
kuznetsov-m / stdin_stdout_redirect_to_file.cpp
Created July 28, 2022 15:11
gcc 4.6.1 stdin stdout (cin cout) redirection to file
#include <iostream>
#include <fstream>
#include <string>
void f()
{
std::string line;
while(std::getline(std::cin, line)) //input from the file in.txt
{
std::cout << line << "\n"; //output to the file out.txt
#!/usr/bin/env python
"""
LUFA Library
Copyright (C) Dean Camera, 2021.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
"""
@kuznetsov-m
kuznetsov-m / xcode-uninstall.sh
Created May 26, 2022 22:41 — forked from oxlb/xcode-uninstall.sh
SH file to uninstall Xcode from MacOS
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf /Applications/Xcode.app
rm -rf ~/Library/Caches/com.apple.dt.Xcode
rm -rf ~/Library/Developer
rm -rf ~/Library/MobileDevice
rm -rf ~/Library/Preferences/com.apple.dt.Xcode.plist
import pandas as pd
import numpy as np
from datetime import datetime
import json
import time
from dateutil import tz
import models
import db_utils
import telegram_client
@kuznetsov-m
kuznetsov-m / telegram_forwarder.py
Created August 19, 2021 21:37
Forward messages from channel to channel in Telegram
from telethon.tl.functions.messages import GetDialogsRequest
from telethon.tl.types import InputPeerEmpty
from telethon import TelegramClient
from telethon.tl.functions.messages import AddChatUserRequest
from telethon.tl.functions.messages import ForwardMessagesRequest
from telethon.tl.functions.messages import GetChatsRequest
from telethon.tl.functions.contacts import GetContactsRequest
from telethon.tl.functions.contacts import SearchRequest
from telethon.tl.functions.channels import InviteToChannelRequest
from telethon.tl.functions.channels import GetMessagesRequest