Skip to content

Instantly share code, notes, and snippets.

View lomomike's full-sized avatar

Mikhail Polgun lomomike

View GitHub Profile
@lomomike
lomomike / gist:566d7e65a4ddfd4d26f5
Last active August 29, 2015 14:18
Incorrect lock usage - SynchronizationLockException guarantee
class Program
{
private static object locker = new object();
static void Main(string[] args)
{
Monitor.Enter(locker);
Console.WriteLine("In Main Thread");
ThreadPool.QueueUserWorkItem((o) => {
Console.WriteLine("In New Thread");
@lomomike
lomomike / gist:7d8c647d37f4f58df59a
Created April 10, 2015 07:11
RectangularTriangleSquare
namespace Geometry
{
/// <summary>
/// Класс предназначен для геометрических операций с прямоугольным треугольником.
/// </summary>
public static class RectangularTriangle
{
/// <summary>
/// Покеазатель точности, с которой проводятся расчеты.
/// </summary>
@lomomike
lomomike / gist:770dd7df03bb951fac4e
Created October 24, 2015 19:26
Simple kernel module
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/slab.h>
struct birthday {
int day;
int month;
int year;
lkd> .for(r $t0=0; @$t0<dwo(nt!KiServiceLimit); r $t0=@$t0+1){.printf "%y\n", nt!KiServiceTable+(dwo(nt!KiServiceTable+@$t0*4)>>4)}
fffff800`2bf27ff8
fffff800`2bf788e4
nt!NtAcceptConnectPort (fffff800`1c3a0e3c)
nt!NtMapUserPhysicalPagesScatter (fffff800`1c525bd4)
nt!NtWaitForSingleObject (fffff800`1c2a55c0)
fffff800`2bfd7030
nt!NtReadFile (fffff800`1c2a00c0)
nt!NtDeviceIoControlFile (fffff800`1c2d3d60)
nt!NtWriteFile (fffff800`1c29f4b0)
0: kd> .for(r $t0=0; @$t0<dwo(nt!KiServiceLimit); r $t0=@$t0+1){.printf "%y\n", nt!KiServiceTable+(dwo(nt!KiServiceTable+@$t0*4)>>4)}
fffff803`16d7afe0
nt!NtAcceptConnectPort (fffff803`070de438)
nt!NtMapUserPhysicalPagesScatter (fffff803`07278f8c)
nt!NtWaitForSingleObject (fffff803`0704a740)
fffff803`16dd6c40
nt!NtReadFile (fffff803`0703b930)
nt!NtDeviceIoControlFile (fffff803`070f351c)
nt!NtWriteFile (fffff803`07050b54)
nt!NtRemoveIoCompletion (fffff803`07083aa0)
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using RabbitMQ.Client;
using RabbitMQ.Client.Exceptions;
namespace TestRmqConnection
{
public class Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace ArraySortBenchmark
{
@lomomike
lomomike / gosh.go
Created February 5, 2018 08:03
go shell
package main
import (
"bufio"
"fmt"
"log"
"os"
"os/exec"
"strings"
)