Skip to content

Instantly share code, notes, and snippets.

View Hereigo's full-sized avatar

Hereigo Hereigo

  • Ukraine, Kiev
View GitHub Profile
@Hereigo
Hereigo / RemoveDuplicatedRows.sql
Created June 14, 2019 14:42
SQL - Remove Duplicated Rows
DELETE FROM users WHERE id IN (
SELECT id FROM (
SELECT * FROM users a
LEFT JOIN
(SELECT Max(id) max_id FROM users GROUP BY duplic_col) b
ON a.id = max_id
WHERE max_id IS NULL
) AS select_id
);
-- Successfully Tested!
@Hereigo
Hereigo / LoggingMethodInvocations.cs
Last active December 14, 2018 09:00
Castle.DynamicProxy_Example
using System;
using System.Collections.Generic;
using Castle.Core;
using Castle.Core.Interceptor;
using Castle.DynamicProxy;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
namespace Console_CastleDynamicProxy
{
@Hereigo
Hereigo / AppDomain.CurrentDomain.Monitoring.cs
Created July 13, 2018 07:02
AppDomain...Monitoring...
public static void Main()
{
AppDomain.MonitoringIsEnabled = true;
/*
Work under monitoring here :
*/
Console.WriteLine($"Took: {AppDomain.CurrentDomain.MonitoringTotalProcessorTime.TotalMilliseconds:#,###} ms");
Console.WriteLine($"Allocated: {AppDomain.CurrentDomain.MonitoringTotalAllocatedMemorySize / 1024:#,#} kb");
@Hereigo
Hereigo / Git_Commands.md
Last active July 4, 2019 07:42
Git Commands

git remote add origin https://github.co/remote_repository_URL.git

git diff -w : WHITESPACES IGNORE

git diff --name-only : CHANGED FILES

git diff-tree --no-commit-id --name-only -r : CHANGED FILES IN

git status -u : NEW FILES IN SUBDIRS

@Hereigo
Hereigo / xUnit_MemberData.cs
Created June 5, 2018 16:21
xUnit Theory MemberData
using System.Collections;
using System.Collections.Generic;
using Xunit;
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
@Hereigo
Hereigo / dotNetCore_Start.cs
Last active June 8, 2018 07:39
dotNetCore Start template.
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
public static class Tools
{
public static string GetMethodName([System.Runtime.CompilerServices.CallerMemberName] string memberName = "")
@Hereigo
Hereigo / curl.md
Created September 22, 2017 08:57 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Hereigo
Hereigo / MVC_Facade_Controller.cs
Created August 9, 2017 06:09
.Net - MVC Smart Facade Controller
public class HomeController : Controller
{
[HttpPost]
public async Task<IFacadeMessageResponce> Post([FromBody]IFacadeMessageRequest request)
{
if (request == null)
{
var ex = new ArgumentNullException(nameof(request));
_logger.LogDebug(new EventId(501, nameof(FacadeController)), ex, ex.Message);
throw ex;
@Hereigo
Hereigo / nlog.config.xml
Last active August 7, 2017 07:02
.Nlog - full ASP.Net logs target
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Warn"
internalLogFile="c:\temp\internal-nlog.txt">
<!-- Load the ASP.NET Core plugin -->
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
@Hereigo
Hereigo / Create_WebAPI_Net.4.0_proj.cs
Last active July 28, 2017 09:30
PS - Web API with .NET Framework 4.0 (with ELMAH)
// 1. Install-Package -Id Microsoft.AspNet.WebApi -Version 4.0.30506 -DependencyVersion HighestMinor
// 2. Update-Package Newtonsoft.Json
// 3. Install-Package -Id Microsoft.AspNet.WebApi.Tracing -Version 4.0.30506 // (it is Optional)
// For Elmah : Install-Package elmah -Version 1.2.2
// 4. Add - App_Start/WebApiConfig.cs
public class WebApiConfig