Skip to content

Instantly share code, notes, and snippets.

View EgorBo's full-sized avatar
🛠️
Working from home

Egor Bogatov EgorBo

🛠️
Working from home
View GitHub Profile
@EgorBo
EgorBo / TopFloodersOfJabberRu.cs
Created September 25, 2015 17:22
Top jabber.ru (dotnet conf) flooders
using System;
using System.Collections.Generic;
using System.Linq;
using HtmlAgilityPack;
namespace ConsoleApplication16
{
class Program
{
static void Main(string[] args)
@EgorBo
EgorBo / Urho3D binding
Created July 28, 2016 19:37
binding.cpp
// Autogenerated, do not edit
#include "../../Native/AllUrho.h"
#include "../../Native/interop.h"
using namespace Urho3D;
extern "C" {
DllExport void *
RefCount_RefCount ()
{
return new RefCount();
}
static int Case(bool b)
{
switch (b)
{
case true:
return 1;
case false:
return 2;
default:
return 3;
@EgorBo
EgorBo / FFF
Last active March 23, 2017 16:44
using System;
namespace ConsoleApp1
{
public class Program
{
public struct Foo
{
//private int foo;
}
class P { static void Main() {} }
class X<A,B,C,D,E,F> { class Y:X<Y,Y,Y,Y,Y, Y> { Y.Y.Y.Y.Y.Y.Y.Y.Y y; } }
using System.Data.SqlClient;
namespace ConsoleApp1
{
public class Program
{
public static void Main(string[] args)
{
var cs = @"Server=EGORBO\SQLEXPRESS;Database=testo;User Id=sa;Password=qwerty123;";
using (var connection1 = new SqlConnection(cs))
//STEP 1: open a socket and network streams
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect("localhost", 1433);
var tcpStream = new NetworkStream(socket, true);
var sslOverTdsStream = new SslOverTdsStream(tcpStream); //simple Stream wrapper - https://github.com/dotnet/corefx/blob/master/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SslOverTdsStream.cs
var sslStream = new SslStream(sslOverTdsStream, leaveInnerStreamOpen: true, userCertificateValidationCallback: new RemoteCertificateValidationCallback(ValidateServerCertificate), userCertificateSelectionCallback: null);
//STEP 2: send & receive data via tcpStream (not ssl)
tcpStream.Write...
using System;
namespace StaticTest
{
public class Program
{
public static void Main(string[] args)
{
//args are empty but .NET and MONO will init Foo anyway, .NET core - won't.
var obj = args.Length > 0 ? Foo.Instance : null;
using System;
namespace StaticTest
{
public class Program
{
public static void Main(string[] args)
{
//args are empty but .NET and MONO will init Foo anyway, .NET core - won't.
var obj = args.Length > 0 ? Foo.Instance : null;
using System;
using System.IO;
using System.Net.Security;
using System.Net.Sockets;
using System.Text;
namespace SslBug
{
class Program
{