Skip to content

Instantly share code, notes, and snippets.

View maxkoshevoi's full-sized avatar

Maksym Koshovyi maxkoshevoi

View GitHub Profile
public bool DoWork(HtmlDocument document)
{
//Сбрасываем предыдущие результаты
for (int i = 0; i < Pathways.Count; i++)
{
for (int j = 0; j < Pathways[i].elements.Count; j++)
{
SetNull(Pathways[i].elements[j]);
}
}
@maxkoshevoi
maxkoshevoi / FindColumn.sql
Created October 9, 2019 20:08
Search for column with specific name in MSSQL database
SELECT c.name AS 'ColumnName'
,t.name AS 'TableName'
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%email%'
ORDER BY TableName
,ColumnName;
@maxkoshevoi
maxkoshevoi / SearchTextInDatabase.sql
Created October 9, 2019 20:11
Search for specific text value in every column of every table of the MSSQL database
DECLARE @SearchStr nvarchar(100) = 'TEXT_TO_SEARCH_FOR'
DECLARE @Results TABLE(ColumnName nvarchar(370), ColumnValue nvarchar(3630))
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
@maxkoshevoi
maxkoshevoi / SearchTextInSP.sql
Created October 9, 2019 20:14
Search for text inside every stored procedure of MSSQL database
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
select distinct
so.[xtype],
so.[id],
so.[name],
po.[name]
from sysobjects so
left join sysobjects po
@maxkoshevoi
maxkoshevoi / YouTube_channels.md
Last active March 28, 2022 12:11
Awesome YouTube channels

3Blue1Brown - Интересные штуки, связанные с математикой

ADVChina - Два парня из Америки, живут в Китае, и рассказывают о его особенностях

AlternateHistoryHub – Рассказывает про исторические события и что было бы, если бы их не было

CGP Grey, LEMMiNO, ApertureAperture, Brew (этот с кофе) – Очень классный канал научно-познавательный канал (сложно описать, но стоит посмотреть)

Epic How To – Как стать Бетменом? Сымитировать свою смерть? Стать шпионом? Создать свою страну? Это и не только в этом плейлисте

@maxkoshevoi
maxkoshevoi / Email.cs
Last active December 16, 2022 04:09
Sending Email using .Net
using System.Net.Mail;
static class Mail
{
public static void Send(string to, string subject, string content)
{
var mail = new MailMessage("INSERT FROM EMAIL HERE", to)
{
Subject = subject,
Body = content
@maxkoshevoi
maxkoshevoi / Ftp.cs
Created October 13, 2019 22:23
Working with FTP using .Net
using System;
using System.IO;
using System.Net;
class Ftp
{
private readonly string server, login, password;
public Ftp(string server, string login, string password)
{
@maxkoshevoi
maxkoshevoi / create_certificate.ps1
Created October 18, 2019 16:21
Creates and installs certificate with manual "Issued by" and "Issued to"
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
$filepath = $MyInvocation.MyCommand.Path
$dirpath = Split-Path $filepath
$cred = Get-Credential -UserName 'localhost' -Message "$('Enter site name and password for certificate below')"; $site = $cred.UserName; $pwd = $cred.Password #this will open prompt to enter a password manually
#$site = 'localhost'; $pwd = ConvertTo-SecureString -String "1" -Force -AsPlainText #1 is password for certificate
if ($pwd -and $site){
$cert = New-SelfSignedCertificate -Type Custom -Subject "CN=dev_cert" -CertStoreLocation cert:\localmachine\my -DnsName $site -KeyUsage DataEncipherment -KeyUsageProperty All -KeyAlgorithm RSA -KeyLength 2048 -NotAfter (Get-Date).AddYears(3)
$name = $cert.PSChildName
@maxkoshevoi
maxkoshevoi / get_dart_lint_config.ps1
Created October 31, 2019 20:46
Download lint config for Dart
iwr -outf analysis_options.yaml https://raw.githubusercontent.com/flutter/flutter/master/analysis_options.yaml
@maxkoshevoi
maxkoshevoi / WinForms_Invoke.cs
Last active January 11, 2024 20:34
Simplest way to update UI from another thread in WinForms
myControl.Invoke((Action)delegate
{
myControl.Enabled = true;
});
// More correct way
public static class ControlEx
{
public static void Invoke(this Control control, MethodInvoker action)
{