Skip to content

Instantly share code, notes, and snippets.

View rodion-m's full-sized avatar

Rodion Mostovoi rodion-m

  • Almaty
  • 19:29 (UTC +05:00)
View GitHub Profile
@rodion-m
rodion-m / AudioChunksSplitter.py
Last active May 11, 2024 18:48
Smart audio splitter for Whisper
import logging
import os
import sys
import time
from typing import List
from pydub import AudioSegment
from pydub.silence import split_on_silence
MAX_CHUNK_SIZE_MB = int(os.getenv("MAX_CHUNK_SIZE_MB", 100))
@rodion-m
rodion-m / meta-expert-prompt.txt
Created February 21, 2024 11:52
Царь-промпт Meta-Expert
You are Meta-Expert, an extremely clever expert with the unique ability to collaborate with multiple experts (such as Expert Problem Solver, Expert Mathematician, Expert Essayist, etc.) to tackle any task and solve any complex problems. Some experts are adept at generating solutions, while others excel in verifying answers and providing valuable feedback.
Note that you also have special access to Expert Python, which has the unique ability to generate and execute Python code given natural-language instructions. Expert Python is highly capable of crafting code to perform complex calculations when given clear and precise directions. You might therefore want to use it especially for computational tasks.
As Meta-Expert, your role is to oversee the communication between the experts, effectively using their skills to answer a given question while applying your own critical thinking and verification abilities.
To communicate with an expert, type its name (e.g., "Expert Linguist" or "Expert Puzzle Solver"), follow
@rodion-m
rodion-m / mentorship_reviews.md
Last active April 19, 2024 17:48
Отзывы о моей работе

Обо мне

Привет! Рад видеть вас на своей странице. Сначала ключевое обо мне:

Меня зовут Родион Мостовой. Более 10-ти лет я программирую за деньги под платформу .NET, из них 6 лет на ASP.NET Core. Почти 3 года преподаю C# и ASP.NET Core, за это время научился объяснять сложные концепции простым языком, разработал несколько собственных учебных курсов. Сейчас преподаю в OTUS. В обучении предпочитаю, прежде всего, подход через общение, наводящие вопросы и разбор практических кейсов.

Веду несколько популярных Open Source проектов на GitHub: https://github.com/rodion-m/

С чем могу помочь

С понимаем самых сложных тем:

  • Асинхронность/многопоточность (async/await, ThreadPool и т. д.)

Давайте рассмотрим пример использования контекста и хуков в React для работы с API клиентом. В этом примере мы создадим контекст для API клиента, который будет доступен во всем приложении.

  1. Создание Context для API клиента: Сначала мы создадим ApiClientContext, который будет хранить наш API клиент.
import React, { createContext } from 'react';

// Создаем контекст
export const ApiClientContext = createContext();
@rodion-m
rodion-m / GitService.cs
Last active October 26, 2023 14:48
Задача о блокирующих методах и пропускной способности в ASP.NET Core
public class GitService
{
// Вася не может взять в толк, как сделать так, чтобы этот метод не тормозил все веб-приложение на ASP.NET Core.
public string ReadGitFile(string repoUri, string fileName)
{
using var repo = new Repository(repoUri); //from LibGit2Sharp
var readmeBlob = (Blob) repo.Head[fileName].Target;
return readmeBlob.GetContentText();
}
}
@rodion-m
rodion-m / Channels_example.cs
Created May 2, 2023 16:11
Example of using Channels instead of lock (by ChatGPT)
using System;
using System.Threading.Channels;
using System.Threading.Tasks;
class Example
{
static async Task Main(string[] args)
{
var channel = Channel.CreateUnbounded<string>();
var producerTask = ProduceMessagesAsync(channel.Writer);
@rodion-m
rodion-m / Phone.cs
Last active March 13, 2023 17:12
Value object phone example
using System;
using System.Text.RegularExpressions;
using Microsoft.EntityFrameworkCore;
namespace SimpleJournal.ValueObjects;
[Owned]
public class Phone
{
public string Value { get; private set; }
@rodion-m
rodion-m / 0UserController.cs
Last active February 14, 2023 11:07
ASP.NET Core code example with code smells for Junior Dev from ChatGPT
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Data.SqlClient;
namespace UserRegistration.Controllers
{
@rodion-m
rodion-m / Program.cs
Created January 19, 2023 18:31
SetColor with CAS
var saved = new HashSet<string>();
while (saved.Count < 8)
{
RGB color = new RGB(0, 0, 0);
//Поток 1:
var task1 = Task.Run(() =>
{
color.SetColor(255, 255, 255);
});
//Поток 2:
  1. Вынесите проект, который возвращает список вакансий с сайта proglib.io в отдельную библиотеку
    Реализуйте телеграмм бота, который:
  2. По запросу /vacancies выведите все вакансии с сайта proglib.io
  3. По запросу /all_employers выведите все компании с сайта hh.ru
  4. По запросу /search_employers {текст_поиска} выведите результаты поиска нанимателей